Error occurred during initialization of boot layer java.lang.module.FindException executing Selenium tests using TestNG and Java 12 through Eclipse - eclipse

ErrorOccuredDuringInitializationofbootlayer I keep getting this error when I run
my test:
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for
C:\Users\Bonfire.eclipse\org.eclipse.platform_4.12.0_867647348_win32_win32_x86_64\plugins\com.beust.jcommander_1.72.0.jar
Caused by: java.lang.IllegalArgumentException:
com.beust.jcommander.1.72.0: Invalid module name: '1' is not a Java
identifier
How can I fix it?

Add TestNG Library to classpath in buildpath ( not to module path). It will work fine.

To avoid this error, do not add TestNG library in the project or src folder. Try adding it into the package. To do so , follow the below mentioned procedure.
Right click on the package, click Build Path->Configure Build Path, go to Libraries tab, select Classpath and click on Add Library to select TestNG.

This error message...
Error occurred during initialization of boot layer java.lang.module.FindException:
Unable to derive module descriptor for C:\Users\Bonfire.eclipse\org.eclipse.platform_4.12.0_867647348_win32_win32_x86_64\plugins\com.beust.jcommander_1.72.0.jar
Caused by: java.lang.IllegalArgumentException: com.beust.jcommander.1.72.0: Invalid module name: '1' is not a Java identifier
...implies that there was an issue with the java classpath.
As per the discussion Launch with java 11 fails: Error: Could not find or load main class with Caused by: java.lang.ClassNotFoundException: with there are some issues with some particular classpaths for java-11 and the launch fails if:
The classpath contains a folder with spaces
The classpath length is larger than 32767 characters.
Where as java-8 works fine.
Reference
Unable to import org.openqa.selenium.WebDriver using Selenium and Java 11
Outro
Eclipse plugin: TestNG testcase does not run with Jdk11

Need to add 1.8 version library
Remove TestNG from build path library and add again
Recheck - the issue should be resolved.

I got same issue and I solved it. When creating the project, don't create module-info.java. When the project was already created with the module-info.java, deleting this file didn't help me.
I just created new project without module-info.java, and all works good now.

Best option to resolve this:
Find all file and folder starting with . e.g. — .metadata / .setting and delete them.
Add all the JARS.
Add testNG Libraries.
Execute it.
Done.

Related

Drools project throws "The Eclipse JDT Core jar is not in the classpath"

When I run the sample Drools project in Eclipse, it throws an Exception "The Eclipse JDT Core jar is not in the classpath". I have created the Drools 6 runtime manually. Am I missing something?
Full stacktrace
org.drools.core.RuntimeDroolsException: Unable to load dialect 'org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration'
at org.drools.compiler.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:360)
at org.drools.compiler.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:346)
at org.drools.compiler.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:228)
at org.drools.compiler.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:196)
at org.drools.compiler.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:152)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:166)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:244)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:204)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:347)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:322)
at com.sample.ProcessTest.main(ProcessTest.java:17)
Caused by: java.lang.RuntimeException: The Eclipse JDT Core jar is not in the classpath
at org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:100)
at org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:61)
at org.drools.compiler.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:356)
... 10 more
You are missing the Ecliose jdt core jar. Add yhat jar and it should work.
Added the org.eclipse.jdt.core-3.7.1.jar file to the buildpath of the project and it works perfectly fine. Not sure why this was not part of the Drools runtime which i created manually.

java.lang.NoClassDefFoundError: com.google.android.gms.gcm.GoogleCloudMessaging

I am trying to implement push notification for my app. i had set up the project in eclipse added google-play-services.jar in the java buildpath and checked it in order and export.so my app was working absolutely fine when i was doing registration with gcm and was getting the registration id from gcm too.but when i try to build my app from command line i am getting the below error
java.lang.NoClassDefFoundError: com.google.android.gms.gcm.GoogleCloudMessaging
i added the google-play-services.jar in the classpath so the code compiled without any issue but at runtime i am getting the above exception.looks like its not able to find the jar at runtime. how can i make the jar available at runtime also please help.
Go to configure build path -> order and export and select(check box) the packages(jars).
No matter what the build path contains in eclipse, it has nothing to do with an application. All the jars have to be added to the classpath.
I would use the following command to start the application after build:
java -cp google.jar;jarA.jar;jarB.jar;jarC.jar -jar application.jar
After the -cp option fill in the semicolon separated list of jars that you use.

ejb-javaee6 with error when generated by eclipse

When I create an ejb project through ejb-javaee6 archetype in Eclipse I get the following errors:
Description Resource Path Location Type
Endorsed directory '/home/hfluz/workspace/maven-test/web2/target/endorsed' is missing. You may need to a perform a Maven command line build in order to create it. pom.xml /web2 line 28 Maven Configuration Problem
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.1:copy (execution: default, phase: validate) pom.xml /web2 line 53 Maven Project Build Lifecycle Mapping Problem
There is already an /target/endorsed/javaee-endorsed-api-6.0.jar file.
IDE: JBoss Developer Studio 7 Beta 1 (tried with embedded 3.0.4 maven version and also with 3.0.5).
When I generate this same archetype through command line (maven 3.0.4) and import the project to eclipse, these errors are not displayed.
I just tried and the same happens with webapp-javaee6 archetype (also from org.codehaus.mojo.archetypes).
Anyone have any idea about what is causing this issue?
Try refreshing the target folder in eclipse (workspace seems out of sync).
Read http://docs.jboss.org/tools/whatsnew/maven/maven-news-3.3.0.CR1.html about endorsed library support in JBDS/JBT

Error in Eclipse about type indirectly referenced from required .class file

I'm having this exception with some stubs generateds by Axis2:
"The type org.apache.axiom.om.OMElement cannot be resolved. It is
indirectly referenced from required .class files"
I've been reading many posts, and trying to find a solution. What I've found so far is to add the apache tomcat 5.5 library to the build path. It removed the error in the java file, but then, when I to execute any java program inside the project, I got this error:
'Launching myApp' has encountered a problem Exception occurred
executing command line. Cannot run program "C:\Program
Files\Java\jdk1.5.0_22\bin\javaw.exe" (in directory
"D:\Digicel\workspace\Digicel\myClassSample"): CreateProcess error=87,
The parameter is incorrect
then if I remove the apache tomcat library from the build path, I can run the other java programs, but not the one mentioned initially.
Any thoughts about it?
Okay, I've found the cause of the problem with the help of a friend :)
The thing is that Eclipse is aware that one of my dependencies, depends of another library, and Eclipse is checking for it when it tries to build the code.
So, what I've done is try to check which jar file contains this library: " org.apache.axiom.om.OMElement".
I've googled it and found that it is "axiom-api-1.2.10.jar" and finally my file compiled with 0 errors.
He also explained to me that my original solution of adding the apache tomcat server library is adding all the jars that cames with apache tomcat (which is a big list), and probably there may have been a version conflict with my current list of added jars.
So, the fix was to find the appropriate jar and add it to the project.
This error can also occur when a indirect dependency has a corrupt jar file. This may be caused by problems at the public maven repository.
If this is the case removing the local maven repository to download fresh jar files will fix your problem:
rm -Rf ~/.m2/repository/{enter/path/to/broken/stuff}
Goto Maven >Update Maven project>checkmark the Force update >Then Run
..That error Will gone....

Eclipse VM Argument and external JAR file error

I just added "-Djava.library.path=" to the "VM Arguments" under Run Configuration in Eclipse and everything works fine until I tried to add an external JAR file. I get the following error:
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
Am I not setting something properly in Eclipse?
If your interested I forked RXTXserial a while back since thier update "schedule" sucks. I have just ported it over to the Android platform too. We decided to move the native libs into the jar and use reflection to deploy them. The API is the same as RXTX, but everything just works. You can find jars and full project sources at:
http://code.google.com/p/nrjavaserial/
The exception indicates that the class gnu.io.RXTXCommDriver tries to load a native library, which would be named rxtxSerial.dll on Windows and rxtxSerial.so on Linux, and the JVM cannot find it in the directories listed in java.library.path. Have you tried to add a JAR containing the library to java.library.path? I don't think that's possible, it has to be a directory containing the extracted library file.
Appearently that external library has a dependancy with another class gnu.io.RXTXCommDriver
. Perhaps you will need to add that library to class path.