When I deploy my application to the integrated WebSphere server, I get NoClassDefFoundErrors for two classes that are contained in the same project.
Note: I call the missing class com.my.package.MyClass here.
The consuming project contains Session Beans and imports the exporting project in "Configure Build path". The exporting project is listed as "EAR library" if the consuming project in the Enterprise Explorer.
The exporting project is a normal java project that contains com.my.package.MyClass. It exports its source folders.
The exceptions look like that:
com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is com.ibm.ejs.container.ContainerEJBException: Unable to initialize deferred EJB.; nested exception is: java.lang.NoClassDefFoundError: com.my.package.MyClass]
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1033)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:175)
at com.ibm.ws.naming.urlbase.UrlContextImpl.processBoundObjectForLookup(UrlContextImpl.java:1736)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1249)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1225)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1276)
at javax.naming.InitialContext.lookup(Unknown Source)
...
or like that
[22.03.13 14:56:12:994 CET] 00000025 EJBContainerI E WSVR0068E: Attempt to start EnterpriseBean MyEar#MyJar.jar#MyBean failed with exception: java.lang.NoClassDefFoundError: com.my.package.MyClass
at java.lang.Class.getDeclaredMethodsImpl(Native Method)
at java.lang.Class.getDeclaredMethods(Class.java:673)
at com.ibm.ws.metadata.ejb.EJBMDOrchestrator.processTimeoutMetaData(EJBMDOrchestrator.java:6494)
at com.ibm.ws.metadata.ejb.EJBMDOrchestrator.finishBMDInit(EJBMDOrchestrator.java:1488)
at com.ibm.ws.runtime.component.EJBContainerImpl.finishDeferredBeanMetaData(EJBContainerImpl.java:5036)
at com.ibm.ws.runtime.component.EJBContainerImpl.initializeDeferredEJB(EJBContainerImpl.java:4845)
at com.ibm.ejs.container.HomeOfHomes$1.run(HomeOfHomes.java:406)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:403)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:339)
at com.ibm.ejs.container.util.EJBLocalInterfaceObjectFactory.getObjectInstance(EJBLocalInterfaceObjectFactory.java:139)
at javax.naming.spi.NamingManager.getObjectInstanceByFactoryInReference(Unknown Source)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:927)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:175)
at com.ibm.ws.naming.urlbase.UrlContextImpl.processBoundObjectForLookup(UrlContextImpl.java:1736)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1249)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1225)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1276)
at javax.naming.InitialContext.lookup(Unknown Source)
...
I'm using IBM Rational Application Developer for WebSphere in Version 8.0.4
and IBM WebSphere Application Server in Version 7.0.0.11
My workspace has no errors in the Problems view.
What I already tried:
- Starting RAD with the -clean parameter
- Refreshing all projects in the Enterprise Explorer
- Project > Clean
- In the Server view: stopping, restarted, cleaning, publishing
- Closing and restarting RAD
First I had a second problem: in RAD I wasn't able to find com.my.package.MyClass by Ctrl + Shift + T.
I solved it by deleting files (*.index files and the "savedIndexNames.txt") in
/.metadata/.plugins/org.eclipse.jdt.core.
But unfortunately that didn't solve the problem at runtime / deploy time. :-(
Can somebody give me hints?
Thanks in advance!
what you need to do is add the Java Project as a Deployment Assembly for the EAR project.
This will than automatically add the $PROJECT.jar from your Java Project under /lib/ folder for thie .ear
WebSphere automatically pics .jar files from lib folder and add them to the classpath and these .jar can be found by all EJB.jar and .war packaged inside the .ear file.
So, right click your EAR project, go to properties, and than selec "Deployment Assembly" than add your Java Project there, you should than see the generated jar under lib folder.
Related
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.
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.
I have a simple web app using that uses servlets. I created it as a maven project and then imported it into eclipse ( file ->import -> existing maven projects)
The war gets deployed to tomcat 7 correctly.
However when I create a tomcat 7 server in Eclipse and then start tomcat in eclipse I get an exception when I run the application.
root cause
java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
first.model.BeerExpert.<clinit>(BeerExpert.java:12)
first.servlet.BeerServlet.doPost(BeerServlet.java:26)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
first.model.BeerExpert.<clinit>(BeerExpert.java:12)
first.servlet.BeerServlet.doPost(BeerServlet.java:26)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
is there any specific class path setting that needs to be done in the eclipse/tomcat
Note: I am able to run mvn clean install and it creates the jar file. And then when I move the jar to a tomcat(7) webapp directory and restart it works just fine.
I am not posting details of the pom.xml because the application itself is working fine. However id it is needed in resolution I can post it.
Tomcat & Spring Web - Class Not Found Exception org.springframework.web.context.ContextLoaderListener
Right Click on your web project in Project Explorer -> select 'Properties'. Under project properties, select 'Deployment Assembly'.
The Deployment Assembly property page shows the content that will be published as a assembled artifact by Eclipse to the server. You need to tell Eclipse that you want all your Maven dependencies to be published too.
To do that, click 'Add' button, then select 'Java Build Path Entries'. Click Next and select Maven Dependencies. This will publish the Maven dependency JAR files to the lib folder when Eclipse publishes your project to WST server
I have a maven project in Eclipse Java EE IDE for Web Developers.
When running Tomcat, I'm getting an error for a class that I can see that I have included.
My question is - do I have to add these JARs to an additional place because of Tomcat Apache?
Error:
SEVERE: Servlet /Resource threw load() exception
java.lang.ClassNotFoundException: org.odata4j.jersey.producer.resources.ODataApplication
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:240)
at com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:220)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:711)
And here is the class in my Library:
UPDATE:
My Web Deployment Assembly looks like:
The issue you are seeing is due to the fact that tomcat is looking at the wrong directory. It is currently most likely pointed at your src/main/webapp directory of your project. This does not jive with how maven works. Maven downloads the dependencies, but will only include them in the target build. You need to have the tomcat server look at target/myapp-0.0.1, or build to a war and deploy that way. The easiest solution as of now, would be for you to use the tomcat plugin. After setting it up, you can use an imbedded server, and just use the following command 'mvn tomcat:run'.
Maven Tomcat Plugin Docs
UPDATE:
I looked at the properties settings, and you should actually be able to edit the "Web Deployment Assembly" settings for your project (under project properties). Check screenshot for how I have mine setup. Notice how Maven Dependencies is mapped.
http://imgur.com/ofxryns
Out of the box, it is not possible to deploy an EAR to Oracle WebLogic using Eclipse.
Environment details:
Eclipse version: Indigo (includes Oracle Enterprise Pack for Eclipse 12.1.1.0.0)
Weblogic version: 10.3.5 (11gR1)
Oracle guide: http://www.oracle.com/technetwork/articles/javaee/marx-oepe-spring-095718.html
The error I receive when trying to start the server is:
java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:486)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1466)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:898)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:686)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:539)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3027)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:341)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: weblogic.management.DeploymentException: VALIDATION PROBLEMS WERE FOUND
problem: cvc-complex-type.2.4c: Expected element 'module#http://java.sun.com/xml/ns/javaee' before the end of the content in element application#http://java.sun.com/xml/ns/javaee:<null>
at weblogic.application.internal.EarDeploymentFactory.findOrCreateComponentMBeans(EarDeploymentFactory.java:193)
at weblogic.application.internal.MBeanFactoryImpl.findOrCreateComponentMBeans(MBeanFactoryImpl.java:48)
at weblogic.application.internal.MBeanFactoryImpl.createComponentMBeans(MBeanFactoryImpl.java:110)
at weblogic.application.internal.MBeanFactoryImpl.initializeMBeans(MBeanFactoryImpl.java:76)
at weblogic.management.deploy.internal.MBeanConverter.createApplicationMBean(MBeanConverter.java:89)
at weblogic.management.deploy.internal.MBeanConverter.createApplicationForAppDeployment(MBeanConverter.java:67)
at weblogic.management.deploy.internal.MBeanConverter.setupNew81MBean(MBeanConverter.java:315)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.compatibilityProcessor(ActivateOperation.java:81)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.setupPrepare(AbstractOperation.java:295)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:97)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
problem: cvc-complex-type.2.4c: Expected element 'module#http://java.sun.com/xml/ns/javaee' before the end of the content in element application#http://java.sun.com/xml/ns/javaee:<null>
at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:245)
at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:231)
at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:155)
at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:323)
at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:788)
at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:409)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:759)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:768)
at weblogic.application.ApplicationDescriptor.getApplicationDescriptor(ApplicationDescriptor.java:296)
at weblogic.application.internal.EarDeploymentFactory.findOrCreateComponentMBeans(EarDeploymentFactory.java:178)
I am posting this up in the hope that someone who has been bitten by this before can simply reel off the answer - this question features heavily on Oracle and DevX forums when I post the stack into Google, and has not been answered.
Note: Company constraints insist on the use of the specific version of the software quoted at the top of the question - I am fully aware that this version of WebLogic is not Java EE 6 compliant.
Thanks for the steer guys. It appears that my application.xml file is a red herring - whilst I do have one, my Maven POM has a plugin which generates its own during build. The problem was that, for Eclipse, the Deployment Assembly (Right Click > Deployment Assembly) did not contain any references to the WAR and JAR project dependenices. I wrongly assumed that Eclipse would simply detect and use an application.xml file found in the folder hierarchy. An empty application.xml file was being created, and thus the stack trace correctly bemoans the lack of modules to deploy.
My problem was with the web.xml file, for some reason, my Eclipse modified the "faces / dynamic web module" of my project, and with it, the header of the web.xml file. The new web.xml file didn't have the "<web-app xmlns:xsi" full header, as soon as I fixed that, the weblogic stopped with the exceptions.