i`m getting NoClassDefintion found error in my application even though i had the associated jars in my lin folder of my ear the error is
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NoClassDefFoundError: com/sun/rave/web/ui/model/Option
Note i had added the same user library to my eclipse its not showing any compilation error this error is only at runtime ......!!!!!
I haven't used EJBs for a while but I seem to remember having to set up the classpath differently for EJBs. I think you have to set it in the manifest.mf file in the EJB jar.
A quick Google turns up this thread, suggesting you need to put:
Class-Path: jar1.jar, jar2.jar
In your manifest.mf file.
You might also find this page (scroll right down to the bottom) and this one (search for "Class-Path") helpful.
Related
Can you please help me with following error I'm facing in WAS9 environment:
In order to resolve the import
org.apache.cxf.binding.soap.SoapHeader
I added the following dependencies in my pom.xml:
cxf-api-2.7.7
cxf-rt-bindings-soap-2.7.7
But when I'm trying to run my application, I'm getting the following error.
Default Executor-thread-7] ([ ]) Controllerclass - org.apache.cxf.bus.extension.ExtensionException
at org.apache.cxf.bus.extension.Extension.load(Extension.java:222)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:199)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.initialize(ExtensionManagerImpl.java:118)
at org.apache.cxf.bus.extension.ExtensionManagerBus.doInitializeInternal(ExtensionManagerBus.java:147)
at org.apache.cxf.bus.CXFBusImpl.initialize(CXFBusImpl.java:191)
at com.ibm.ws.jaxws.bus.LibertyApplicationBusFactory.createBus(LibertyApplicationBusFactory.java:119)
at com.ibm.ws.jaxws.bus.LibertyApplicationBusFactory.createClientScopedBus(LibertyApplicationBusFactory.java:86)
at com.ibm.ws.jaxws.metadata.JaxWsClientMetaData.<init>(JaxWsClientMetaData.java:28)
at com.ibm.ws.jaxws.metadata.JaxWsModuleMetaData.getClientMetaData(JaxWsModuleMetaData.java:123)
at com.ibm.ws.jaxws.support.JaxWsMetaDataManager.getJaxWsClientMetaData(JaxWsMetaDataManager.java:84)
at com.ibm.ws.jaxws.support.JaxWsMetaDataManager.getJaxWsClientMetaData(JaxWsMetaDataManager.java:123)
at com.ibm.ws.jaxws.client.LibertyProviderImpl.createServiceDelegate(LibertyProviderImpl.java:56)
at javax.xml.ws.Service.<init>(Service.java:57)
Caused by: java.lang.InstantiationException:org.apache.cxf.bus.osgi.OSGIBusListener
at java.lang.Class.newInstance(Class.java:427)
at org.apache.cxf.bus.extension.Extension.load(Extension.java:218)
Caused by: java.lang.NoSuchMethodException:org.apache.cxf.bus.osgi.OSGIBusListener.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
The server where your WAS9 has been deployed has different version of the above jar file. You need to have same version of jar files both in your eclipse where you have developed your codes and the server where you are deploying the war or ear.
mavan dependency file pom.xml is used during your project compilation. It might add the jar in your binary under lib folder as well. But WAS9 might considering the one which is in server's CLASSPATH. Hence check your class path and replace that jar with the one which you have mentioned in your pom.xml file. Hope that will fix your issue.
We can eliminate this exception by adding webProfile-7.0 in our server.xml, but how ever this is not working with javaee-7.0 not sure, if one knows about how to handle this in javaee-7.0 please share your approach.
Summary: I have a very basic Java 1.8 and Spring 4.0.5 project, I'm using Maven 3.2.3 to manage it. Maven exec cannot seem to see my Spring context, even though it appears to me that it is in the classpath.
My spring context is in
<project root>/src/main/resources/spring/ch2-beans.xml
and I load it using:
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("/spring/ch2-beans.xml");
after a "mvn clean compile" I see
<project root>/target/classes/spring/ch2-beans.xml
and when I run:
mvn -X exec:java -Dexec.mainClass="com.wiley.beginning.spring.ch2.Main"
I see the following debug output which makes me think the classpath is indeed correct:
[DEBUG] Collected project classpath [/Users/me/Documents/workspace/BeginningSpring/chapter2/spring-book-ch2/target/classes]
[DEBUG] Adding to classpath : file:/Users/me/Documents/workspace/BeginningSpring/chapter2/spring-book-ch2/target/classes/
Yet I get the following error:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/ch2-beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/ch2-beans.xml] cannot be opened because it does not exist
Can anyone point me in the direction of sorting this out? What I've posted above is the result of many different attempts to solve this, and I'm stumped by the error when it certainly appears that the file path should be in the classpath, so perhaps this is something that has changed since I last coded (a while ago..). Thanks!
Update..
Thinking that it might be some classpath issue with exec:java I ran the same code inside a unit test, executed within maven. Same error. I've also tried loading the xml file as "classpath:/spring/ch2-beans.xml", did not fix it.
There was a hyphen in the file name of the Spring configuration I was trying to load, and it appears that the classloader won't accept that. Hyphens are illegal in identifier names in Java, apparently this applies also to external resources.
Once I removed the hyphen from the xml file name, it was found.
On a related note, I'm pretty annoyed with the "Beginning Spring" book example which uses these hyphenated names.
Our web service client in live environment recently got the exception:
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
at com.sun.proxy.$Proxy146.search(Unknown Source)
....
I've done a lot of search online, including a few posts here at StackOverflow:
Catching webservice exception with CXF: NoClassDefFoundError: SOAPFaultBuilder
Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
And my understanding was our client received a SOAP Fault from the server and it's missing some jar file. So I'm trying to solve the problem by first recreating it.
I created a simple Web Service server project in Eclipse which has a web method throws a simple fault class annotated by #WebFault. Then I created a simple Web Service client project which consumes the web method. The client project doesn't have any additional libraries/jars in its classpath; all it has is the JRE. To my surprise, it didn't throw the NoClassDefFoundError exception! Instead, I got the javax.xml.ws.soap.SOAPFaultException I defined on the server side.
The class SOAPFaultBuilder is indeed in rt.jar in JRE. So the simple web service projects I created probably just work as they should. However, how come the web service client in our live environment throw the NoClassDefFoundError exception? That project definitely has rt.jar in the classpath.
Can anyone please shed some light on this problem? If it's missing some jar files (either from the jaxws RI or Apache CXF or others), why would the super simple client I created didn't throw the error? Both the live environment and my local environment use Java7u51.
I have encountered the same problem and I could subsequently resolve this.
Due to the following error mentioned in the Problem, the underlying cause of the SOAP Fault could not be found.
I followed the steps mentioned in the following link, to identify the reason for NoClassDefFoundError.
http://javarevisited.blogspot.in/2011/06/noclassdeffounderror-exception-in.html
I could find the following errors in my application log:
java.lang.ExceptionInInitializerError
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
The reason for the above classcast exception is due to conflicting jar files.
rt.jar (this is present in jre classpath)
jaxb-impl-2.0.1.jar (this is present in my application classpath).
I have removed the file jaxb-impl-2.0.1.jar from my classpath and the actual error is gone.
I had the same erorr and I resolved this issue by deleting the jax-impl.jar from the tomcat lib folder. It was a possible conflict of the jaxb jar versions with one of my webapps installed in tomcat.
http://programtalk.com/java/i-was-running-gwt-application-on-tomca/
I have modified an EAR for Weblogic 10 ( BEA 10 )which is already running on BEA 8..
I am getting the following error while deploying the EAR..
[HTTP:101163]Could not load user defined listener: com.xxx.xxxx.jmx.LifecycleListener java.lang.NoClassDefFoundError: com/tibco/sdk/MException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357) at java.lang.Class.getConstructor0(Class.java:2671) at java.lang.Class.newInstance0(Class.java:321) at java.lang.Class.newInstance(Class.java:303) at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:187) at weblogic.servlet.internal.WebComponentContributor.createListenerInstance
Have you faced this error ?Please help me...
From the Exception it seems that some library is missing from your ear file. Make sure that com.xxx.xxxx.jmx.LifecycleListener is a valid package and included correctly in your ear.
If you are developing and building the ear with JDeveloper make sure you add this lib in your application resources. If you do this manualy make sure that this lib exists in your WEB-INF/lib folder
I am using My-eclipse and doing a struts project there is no syntax error but on starting tomcat server the following error appear in console.
java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
and
javax.servlet.UnavailableException: Parsing error processing resource path jndi:/localhost/strutspro/WEB-INF/struts-config.xml
any idea whats the problem.
Donwload commons-logging and place the jar(s) in WEB-INF/lib.
And for the future - google the class name that is not found to see which library it belongs to, download it and put it on the classpath (WEB-INF/lib in this case)
It looks like you've already found your solution, but my solution to the same problem was a little different.
Running Tomcat 4.1.29 inside Eclipse 3.6, I started receiving a very similar error (Servlet /webcustom threw load() exception javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/conf/struts-config-resource.xml,...).
Neither performing an "Eclipse > Project > Clean", nor an "Eclipse > Servers > (Tomcat Server Instance) > Clean Tomcat Work Directory" would resolve the problem for me.
However, after a lot of trial and error, I found the solution to be this...
Eclipse > Servers > (Tomcat Server Instance)...
Add and Remove > (Remove resource from the Tomcat Server Instance)
Clean
Add and Remove > (Add resource back to the Tomcat Server Instance)
Publish
Start
Hopefully this helps someone else.
-jpt