Soap ui maven plugin Java 17 - testing

After migration to Java 17 I faced with a next issue
java.lang.IllegalAccessException: class org.apache.commons.beanutils.PropertyUtilsBean cannot access class sun.security.ssl.SSLSocketImpl (in module java.base) because module java.base does not export sun.security.ssl to unnamed module #a0bdbe2
My question is, How to apply --add-opens java.base/java.lang=ALL-UNNAMED args for run soapUI test command. Or do we have some another approach to execute soapUI test on JDK17

Added it to the SoapUI-5.6.0/bin/SoapUI-5.6.0.sh java execution line
$INSTALL4J_JAVA_PREFIX exec "$app_java_home/bin/java" "-splash:$app_home/.install4j/s_12opuop.png" **--add-opens java.base/sun.security.ssl=ALL-UNNAMED** -Dinstall4j.jvmDir="$app_java_home" -Dexe4j.moduleName="$prg_dir/$progname" "-Dinstall4j.launcherId=64" "-Dinstall4j.swt=false" "$vmov_1" "$vmov_2" "$vmov_3" "$vmov_4" "$vmov_5" $INSTALL4J_ADD_VM_PARAMS -classpath "$local_classpath" com.install4j.runtime.launcher.UnixLauncher launch a0622774 "$prg_dir/error.log" 0 com.eviware.soapui.SoapUI "$#"

Parameters can be passed vis MAVEN_OPTS

Related

How to compile and run Kotlin code involing coroutines on Windows

I want to study Kotlin coroutines more, but sometimes to lazy to debug on Android phone, so prefer PC instead.
Here's a sample code:
import kotlinx.coroutines.*
fun main() = runBlocking { // this: CoroutineScope
launch { // launch a new coroutine and continue
delay(1000L) // non-blocking delay for 1 second (default time unit is ms)
println("World!") // print after delay
}
println("Hello") // main coroutine continues while a previous one is delayed
}
Let's compile it:
kotlinc CoMain01.kt -cp C:\kotlin\lib\kotlinx-coroutines-core-jvm.jar
-include-runtime -d CoMain01.jar
Seems OK. CoMain01.jar is generated and no error message/warning. The unsolved question is: how to run the jar?
java -jar -cp C:\kotlin\lib\kotlinx-coroutines-core-jvm.jar
CoMain01.jar
java -cp C:\kotlin\lib\kotlinx-coroutines-core-jvm.jar
CoMain01.jar
don't work. Same error message:
Error: Could not find or load main class CoMain01.jar Caused by:
java.lang.ClassNotFoundException: CoMain01.jar
I'm on Windows 10 with OpenJDK Runtime Environment Corretto-11.0.12.7.1 and Kotlin 1.5.30 (on C:\Kotlin) installed.
Any help/information is appreciated.
You need to specify both jars on your classpath, and then give the name of the main class to run as argument.
The main class is named based on the file containing the main() method. If your file is main.kt, then the main class name will be MainKt. In that case the following should work:
java -cp "C:\kotlin\lib\kotlinx-coroutines-core-jvm.jar;CoMain01.jar" MainKt
But honestly using an IDE would be more practical for little local experiments :)

RobotFramework - ClassNotFound Exception when selenium org.openqa.selenium is added to my JavaLibrary

Please help me on this situation. I followed the below steps in Java and Added this jar file into Robot framework project. When executing the test, I received ClassNotFoundException.
Java Corrected Code:
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.openqa.selenium.WebElement;
public class StoreElements{
public static final String ROBOT_LIBRARY_SCOPE = "GLOBAL";
public String storeTexts(List<WebElement> text){
for(WebElement theElement : text){
System.out.println("The Element class is:
"+theElement.getAttribute("class")+", text: " + theElement.getText());
}
return ((WebElement) text).getText();
}
}
Robot Framework Code:
*** Settings ***
Library Selenium2Library
Library keywords.kcc.StoreElements
*** Keyword ***
Get the customer Names
#{customers} get webelements xpath=//div[contains(#class,'name-column')]
store Texts #{customers}
IS that Something like i need to include Selenium2Library in Java Project rather than just selenium Or is it possible include Selenium2Library in Java?
The Exception that i received is,
[ ERROR ] Unexpected error: NoClassDefFoundError:
org/openqa/selenium/WebElement
java.lang.NoClassDefFoundError:
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at robot.utils.importer$py.import_$32(C:\jython2.7.0\Lib\site-
packages\robot\utils\importer.py:274)
at robot.utils.importer$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\utils\importer.py)
at
robot.utils.importer$py._import_class_or_module$5(C:\jython2.7.0\Lib\site-
packages\robot\utils\importer.py:77)
at robot.utils.importer$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\utils\importer.py)
at robot.utils.importer$py.import_class_or_module$4(C:\jython2.7.0\Lib\site-
packages\robot\utils\importer.py:74)
at robot.utils.importer$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\utils\importer.py)
at robot.model.visitor$py.visit_suite$2(C:\jython2.7.0\Lib\site-
packages\robot\model\visitor.py:88)
at robot.model.visitor$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\model\visitor.py)
at robot.model.testsuite$py.visit$19(C:\jython2.7.0\Lib\site-
packages\robot\model\testsuite.py:161)
at robot.model.testsuite$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\model\testsuite.py)
at robot.model.itemlist$py.visit$11(C:\jython2.7.0\Lib\site-
packages\robot\model\itemlist.py:75)
at robot.model.itemlist$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\model\itemlist.py)
at robot.model.visitor$py.visit_suite$2(C:\jython2.7.0\Lib\site-
packages\robot\model\visitor.py:88)
at robot.model.visitor$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\model\visitor.py)
at robot.model.testsuite$py.visit$19(C:\jython2.7.0\Lib\site-
packages\robot\model\testsuite.py:161)
at robot.model.testsuite$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\model\testsuite.py)
at robot.utils.application$py._execute$10(C:\jython2.7.0\Lib\site-
packages\robot\utils\application.py:94)
at robot.utils.application$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\utils\application.py)
at robot.utils.application$py.execute_cli$5(C:\jython2.7.0\Lib\site-
packages\robot\utils\application.py:49)
at robot.utils.application$py.call_function(C:\jython2.7.0\Lib\site-
packages\robot\utils\application.py)
at runpy$py._run_code$9(C:\jython2.7.0\Lib\runpy.py:73)
at runpy$py.call_function(C:\jython2.7.0\Lib\runpy.py)
at runpy$py._run_module_as_main$14(C:\jython2.7.0\Lib\runpy.py:161)
at runpy$py.call_function(C:\jython2.7.0\Lib\runpy.py)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebElement
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 191 more
As suggested by Kootstra, added selenium-server-standalone-3.3.1 jar file and currently the RED.xml is as below, This time red line is not shown under keyword 'Store Texts'. The exception is thrown only when executing this. And not the longer exception message too.
Console Command:
Command: C:\jython2.7.0\bin\jython.exe -J-Dpython.path=C:\jython2.7.0\Lib\site-packages -J-cp .;C:\Program Files\Java\jdk1.8.0_121\lib;C:\Program Files\Java\jdk1.8.0_121\jre\lib;;.;C:\Java\Jars_KCC\GetElementText.jar;C:\jython2.7.0\selenium-server-standalone-3.3.1 -m robot.run -P C:\jython2.7.0\Lib\site-packages\Selenium2Library -i SmokeTest --listener C:\Users\CON_RT~1\AppData\Local\Temp\RobotTempDir3926709749247362236\TestRunnerAgent.py:63501:False -s KCC_Automation.TestSuites.TestResource -t KCC_Automation.TestSuites.TestResource.logon to kcc with valid credentials -t KCC_Automation.TestSuites.TestResource.navigate to customer's page -t KCC_Automation.TestSuites.TestResource.display customer names -t KCC_Automation.TestSuites.TestResource.stop testing C:\Java\Workspace\KCC_Automation
Suite Executor: Robot Framework 3.0.2 (Jython 2.7.0 on java1.8.0_121)
I created new project, then added only the 'c:\jython2.7.0\selenium-server-standalone-3.3.1\' into classpath along with Selenium2library and own java library. I also tried adding .jar at the end of the jar file. It still has exception. But one thing is that now it stopped showing ;;.;
Here is the console command now,
Command: C:\jython2.7.0\bin\jython.exe -J-Dpython.path=C:\jython2.7.0\Lib\site-packages -J-cp .;C:\Java\JarsKCC\GetElementList.jar;C:\jython2.7.0\selenium-server-standalone-3.3.1.jar -m robot.run -P C:\jython2.7.0\Lib\site-packages\Selenium2Library -i SmokeTest --listener C:\Users\CON_RT~1\AppData\Local\Temp\RobotTempDir9154227905398549031\TestRunnerAgent.py:54485:False -s KCC_Automation.TestSuites.TestResource -t KCC_Automation.TestSuites.TestResource.logon to kcc with valid credentials -t KCC_Automation.TestSuites.TestResource.navigate to customer's page -t KCC_Automation.TestSuites.TestResource.display customer names -t KCC_Automation.TestSuites.TestResource.stop testing C:\Java\Workspace\KCC_Automation
Suite Executor: Robot Framework 3.0.2 (Jython 2.7.0 on java1.8.0_121)
This time the exception is different. ClassCastException: org.python.core.PyObjectDerived cannot be cast to org.openqa.selenium.WebElement
The error is in my view quite straight forward: [ ERROR ] Unexpected error: NoClassDefFoundError: org/openqa/selenium/WebElement it is missing this class. This is a class found in the regular selenium-server-standalone-x.x.x.jar.
In the past couple of days you've asked some questions in context of RED and Jython, and I'm going to assume that this is your development environment. That being said, if it happens to be different the steps would still apply but applied differently.
I've taken your java class and converted it to a Jar file. In RED I've created a robot project and added it as a Library file. In this StackOverflow response I've detailed the process step-by-step.
Because the robot script wasn't complete, I've complemented it so that it now looks like this:
*** Settings ***
Library StoreElements
Library Selenium2Library
*** Test Cases ***
Get the customer Names
#{customers} Get Webelements xpath=//div[contains(#class,'name-column')]
Store Texts ${customers}
The addition of the Libraries is needed to ensure the keywords are recognized and that means the libraries are loaded correctly.
Because the new Jar file refers to the Selenium Server class it needs to be able to access it. This requires that this class is part of the class path. In RED this can be achieved by adding the selenium-server-standalone-x.x.x.jar to the class path in the RED.xml project file.
This should then look like this:
Although this robot file will fail when run, the generated command might be of some interest if you want to specify the java path from the command line when working with Jython and Robot Framework in RED:
C:\jython2.7.0\bin\jython.exe
-J-Dpython.path=C:\jython2.7.0\Lib\site-packages
-J-cp
.;
C:\Eclipse\Workspace\JavaSelenium\ExampleLibrarySelenium.jar;
C:\Eclipse\Workspace\ExampleJavaSelenium\selenium-server-standalone-3.3.1.jar
-m robot.run
-P C:\jython2.7.0\Lib\site-packages\Selenium2Library
--listener C:\Users\User\AppData\ ... \TestRunnerAgent.py:54540:False
-s JavaSelenium.Example
C:\Eclipse\Workspace\JavaSelenium
In the above formatted command, the class path is defined by the -J-cp argument. The added custom Java Robot library ExampleLibrarySelenium.jar and the additionally required dependency selenium-server-standalone-3.3.1.jar complement the standard . which refers to the folder where jython.exe is located.
Although adding the jar files to the existing . folder would have worked too, it is better to add the required files per project, in order to ensure that the right version is added but also to allow for local experimentation.

How to run TestNG suite from command line

I would like to run TestNG Suite from command line on Linux. I'm using eclipse to run test, but I have problem with command line. I know that I need to have testng.jar and I have it in /home/karcio/dev/testng-6.4.jar, location my suite xml is /home/karcio/git/java-test-automation/Automation/test-output/Default suite/TestSuite.xml . Commands what I tried,
set classpath /home/karcio/dev/testng-6.4.jar
cd /location to my suite xml file: java org.testing.TestNG TestSuite.xml
This is error what I see:
Exception in thread "main" java.lang.NoClassDefFoundError: org/testing/TestNG
Caused by: java.lang.ClassNotFoundException: org.testing.TestNG
I'm new in those path and classpath, I'm little bit confusing :(
Thank you
Little update,
I think I did all good, now when I put to terminal: java org.testng.TestNG Test.xml
I've got this error:
Exception in thread "main" org.testng.TestNGException: No sourcedir
was specified at org.testng.TestNG.checkConditions(TestNG.java:1170)
at org.testng.TestNG.privateMain(TestNG.java:1010) at
org.testng.TestNG.main(TestNG.java:997)
all path are exported, so maybe this is wrong version of testng.jar, tried with versions 5.5, 6.4, 6.5, 6.6, 6.7 but I think only version 5.5 is working,
There is a typo in the class package
org.testing.TestNG
should be
org.testng.TestNG
(There no i in the .testng. part)
http://testng.org/javadoc/org/testng/TestNG.html

java.lang.ClassFormatError: LVTT entry for 'list' in class file

I have one Web application:
IDE Netbeas 7.2
Weblogic server 11 g
this WApp compile and run on Tomcat 7.0.22
and on Weblogic compile too but don't run. Error:
java.lang.ClassFormatError: LVTT entry for 'list' in class file [file.class]
any idea??
thanks!
Try compiling with -g:none. Maybe this helps over the error in the variable table.
See here for the javac options.

How to Deploy OSGI bundle of smooks in servicemix?

When i create simple maven project and run inside eclipse for smooks then it works fine but when i create osgi bundle for that and deploy it in servicemix then it shows following error...
I put my smook configuration file in servicemix_home/ConfigurationFiles/smook/......
Ex : org.milyn.SmooksException: Failed to apply processing unit [org.milyn.javabean.ext.PropertyChecker] to [org:milyn:smooks:unknowndoc:/smooks-resource-list/jb:bean/jb:wiring].
org.milyn.SmooksException: Failed to apply processing unit [org.milyn.javabean.ext.PropertyChecker] to [org:milyn:smooks:unknowndoc:/smooks-resource-list/jb:bean/jb:wiring].
at org.milyn.delivery.dom.SmooksDOMFilter.processVisitorException(SmooksDOMFilter.java:823)
at org.milyn.delivery.dom.SmooksDOMFilter.access$700(SmooksDOMFilter.java:134)
...
Caused by: org.milyn.cdr.SmooksConfigurationException: Bean class 'com.test.pojo.Order' not avilable on classpath.
at org.milyn.javabean.ext.PropertyChecker.getBeanClass(PropertyChecker.java:97)
at org.milyn.javabean.ext.PropertyChecker.getBeanType(PropertyChecker.java:78)
at org.milyn.javabean.ext.PropertyChecker.visitBefore(PropertyChecker.java:47)
Change Classloader
Get current class loader from getClass().getClassLoader() and set in
Thread.currentThread().setContextClassLoader(classLoader);
and
smooks.setClassLoader(classLoader);