java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory - java

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

Related

org.apache.cxf.bus.extension.ExtensionException in WAS9 server

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.

NoClassDefFoundError for com.sun.xml.internal.ws.fault.SOAPFaultBuilder

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/

Where to add the jdbc driver on Netbeans/Glassfish in Windows?

I have an enterprise app created in Netbeans 6.8 which comes packaged with a Glassfish V3 server. I've been receiving the following exception from the server log when I try to deploy and run the EAR project:
SEVERE: jdbc.exc_cnfe_ds
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
From googling, the common solution to this is to copy the jar file (mysql-connector-java-5.1.6-bin.jar) containing that class to
$glassfish-v3-install-root/glassfish/domains/domain1/lib.
and in fact that's where it resides on the Unix server. However, I'm testing this on windows and the "domains/domain1" directories don't exist in the default glassfish install. I added them manually and added the jar, but it made no difference. I also added the jar as a variable to the windows classpath, but that also had no effect.
I then tried adding the jar file $glassfish-v3-install-root/glassfish/lib, and that produced a different error:
SEVERE: RAR5111 : Error casting to javax.sql.Datasource
java.lang.ClassCastException: com.mysql.jdbc.Driver cannot be cast to javax.sql.DataSource
I'm using the same jar file as exists for the server. I'm guessing the jar is misplaced? I don't want to put it in the project because that's not how it's deployed in production. Any help appreciated.
Putting the jar file in $glassfish-v3-install-root/glassfish/lib turned out to be correct.
The
"SEVERE: RAR5111 : Error casting to javax.sql.Datasource java.lang.ClassCastException: com.mysql.jdbc.Driver cannot be cast to javax.sql.DataSource"
error was, I believe, caused by an incorrect setting for the jdbc pooling on the glassfish server. But going to the admin console, available from the Netbeans "server" tab, going to the "JDBC", "Connection Pools", select "java.sql.driver" as the resource type and "com.mysql.jdbc.driver" as the driver classname will get rid of the casting issue.
Click the "Ping" button near the top to make sure you're connecting.

<HTTP> <BEA-101163> <Could not load user defined listener:

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

Error is loading the jars

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.

Categories

Resources