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/
Related
While my application is being deployed to websphere 9 i get this error
Caused by: java.lang.NoSuchMethodError:
org/jboss/logging/Logger.debugf(Ljava/lang/String;I)V (loaded from
file:/C:/server/IBM/WebSphere90/AppServer/plugins/com.ibm.ws.cdi.logging.jar
It seems that the above jar is being loaded before jboss-logging-3.3.0.Final.jar used by hibernate.
At the same time i have a different machine on which this issue is not present.
com.ibm.ws.cdi.logging.jar is missing from the path and the error no longer occurs.
How to fix the error and why in one installation the cdi.logging.jar is present and in the not?
You could add jboss-logging-3.3.0.Final.jar as an isolated shared library and associate it with your application. That will cause it to be preferred over anything provided by the application server.
Since you have com.ibm.ws.cdi.logging.jar you must be on Websphere 9.0.0.0, I would suggest upgrading to Websphere 9.0.0.5 or later, your issue should be resolved by PI79787.
Best regards.
I've deployed an application(EAR) on IBM WebSphere succesffully. When I hit the URL - "https://WAS-External-IP:PORT/ProjectName/OtherInfo/ServletName, I get the error:
Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet [ServletName]: Could not find required class - class ServletName : javax.servlet.ServletException: Project's Exception: com.sun.crypto.provider.SealedObjectForKeyProtector
From the post - identify whether is code running on app engine runtime (Java)
I figure that GAE runtime 1.9.23 has the fix for runtime whitelisting, which omitted one or more classes needed to load the JCEKS key store. However, I can't figure out where can I find the GAE runtime version in my WebSphere.
When the same code is run when Application is installed on a Windows box, I don't get this error.
When I looked at the trace logs, I get the error:
Caused by: java.lang.IllegalStateException: No implementation could be
SystemErr R at jarName.classname.methodName(className.java:LineNumber)
From debugging, I see the class-name string is not loaded in the classpath. However, when I checked the jars available in the path mentioned in the classpath, I can see the JAR is present there. The JAR is also present in the pom file of the project.
I'm not able to set debug points at static blocks of missing class to see what is going wrong.
Windows and Linux often return list of files in different order, which can lead to jars being added to the classpath in a different order. How can I make Linux read the missing JAR in the classpath the way Windows does?
I've got into a scenario where I have to get an Axis2 based ws consumer working within WebMethods as a java service. I've implemented the ws consumer first in netbeans just to see if it works and thus i found that the minimal amount of jars I'll require are the following:
[ xmlschema-1.4.7.jar, apache-mime4j-core-0.7.2.jar,
axiom-api-1.2.13.jar, axiom-impl-1.2.13.jar, axis2-adb-1.6.2.jar,
axis2-kernel-1.6.2.jar, axis2-transport-http-1.6.2.jar,
axis2-transport-local-1.6.2.jar, commons-codec-1.3.jar,
commons-httpclient-3.1.jar, commons-logging-1.1.1.jar,
httpcore-4.0.jar, mail-1.4.jar, neethi-3.0.2.jar, wsdl4j-1.6.2.jar ]
I've uploaded these jar files under the IS/packages/{package_name}/code/jars folder. Whenever I try to execute the java service that would send the request and process the response I get the following exception:
java.lang.reflect.InvocationTargetException:
org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
From the IS error log file I found that the actual error message is as follows:
org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
Caused by: java.lang.reflect.InvocationTargetException: null Caused
by:
java.lang.NoSuchMethodError:org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
The platform is WebMethods 8.2 under Linux environment. The JDK version is 1.6.0_32 and the application server under WebMethods is Jetty.
Actually the solve of this problem was a bit more tricky. First of all I manually had to configure the manifest file of the package on the IS server to use the jars provided in the package abnd thus it wouldn't get in conflict with the Axis used by the IS itself. On the other hand I had to manually add the ClassLoader because WebMethods can't use META-INF based information from jar files as it seems. To solve this problem simply use:
System.setProperty("org.apache.axiom.om.OMMetaFactory", "org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory");
That solves all the problems.
I am trying to add metrics library to existing webservice on WAS 7. I am getting below error
Error 404: javax.servlet.UnavailableException: SRVE0203E: Servlet [AdminServlet]: com.yammer.metrics.reporting.AdminServlet was found, but is missing another required class. SRVE0206E: This error typically implies that the servlet was originally compiled with classes which cannot be located by the server. SRVE0187E: Check your class path to ensure that all classes required by the servlet are present.SRVE0210I: This problem can be debugged by recompiling the servlet using only the classes in the application's runtime class path SRVE0234I
What are the other run-time dependencies required for metrics-servlet-2.2.0?
I have metrics-core-2.2.0.jar and metrics-servlet-2.2.0.jar in my WEB-INF\lib folder.
Threads, ping and healthcheck servlets work fine.
I think your missing some more required jars, are you not using maven or gradle for dependency management
Please refer here to know all required jars that metrics-servlet-2.2.0.jar depends on. http://mvnrepository.com/artifact/com.yammer.metrics/metrics-servlets/3.0.0-BETA1
My suggestion is, it is always difficult to maintain dependencies without Maven/Gradle or any other build tools :).
I've tried to deploy a Netbeans WAR webservice into Glassfish several times, but it returns this error:
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException:
javax.servlet.ServletException:
com.sun.xml.ws.transport.http.servlet.WSServletException:
WSSERVLET11: failed to parse
runtime descriptor: java.lang.RuntimeException: MASM0015: Class [
com.sun.xml.ws.tx.runtime.TxTubeFactory ] does not implement [
com.sun.xml.ws.assembler.dev.TubeFactory ] interface.
Please see server.log for more details.
Whatever WAR I generate in Eclipse works in Glassfish, but I tried importing from Netbeans this project, and it didn't work. Glassfish also returns this same error. The log doesn't extend the information of the possible problem.
By the way, in the embedded Glassfish for Netbeans, the webservice works like a charm, but importing this, results in an error in the Glassfish server (which is another computer)
Any suggestions? Is there any configuration I need to change in the Glassfish server?
Thank you all for your ideas and solutions.
Cristina
Extract from Server .LOG
[#|2012-05-31T10:16:59.951-
0430|INFO|glassfish3.1|com.sun.xml.ws.wstx|_ThreadID=40;_ThreadName=Thread-1;|[failed
to localize] HOST_AND_PORT_LOOKUP_FAILURE_2015(https://192.168.2.43:8080)
java.lang.ClassNotFoundException: com.sun.enterprise.webservice.WsTxUtils
[#|2012-05-31T10:16:59.990-
0430|SEVERE|glassfish3.1|com.sun.xml.ws.wspolicy.jaxws.PolicyWSDLParserExtension|_ThreadID= 40;_ThreadName=Thread-1;|WSP1007: Policy exception occured when finishing WSDL parsing.
com.sun.xml.ws.policy.PolicyException: [failed to localize]
WSP_0071_ERROR_MULTIPLE_ASSERTION_CREATORS_FOR_NAMESPACE(http://schemas.xmlsoap.org/ws/2004/08/addressing, com.sun.xml.ws.security.addressing.impl.policy.AddressingPolicyAssertionCreator, com.sun.xml.ws.addressing.impl.policy.AddressingPolicyAssertionCreator)
Caused by: com.sun.xml.ws.policy.PolicyException: [failed to localize] WSP_0071_ERROR_MULTIPLE_ASSERTION_CREATORS_FOR_NAMESPACE(http://schemas.xmlsoap.org/ws/2004 /08/addressing, com.sun.xml.ws.security.addressing.impl.policy.AddressingPolicyAssertionCreator, com.sun.xml.ws.addressing.impl.policy.AddressingPolicyAssertionCreator)
[#|2012-05-31T10:16:59.990- 0430|FINE|glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_Thre adID=143;_ThreadName=Thread- 1;ClassName=org.glassfish.web.loader.WebappClassLoader;MethodName=clearReferences;|Could not set field tm to null in class com.sun.xml.ws.tx.at.ATCoordinator
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.ws.tx.at.ATCoordinator
[#|2012-05-31T10:16:59.990- 0430|FINE|glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_Thre adID=143;_ThreadName=Thread- 1;ClassName=org.glassfish.web.loader.WebappClassLoader;MethodName=clearReferences;|Could not set field wsatCoordinatorService to null in class com.sun.xml.ws.tx.at.ATCoordinator
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.ws.tx.at.ATCoordinator
[#|2012-05-31T10:16:59.990- 0430|FINE|glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_Thre adID=143;_ThreadName=Thread- 1;ClassName=org.glassfish.web.loader.WebappClassLoader;MethodName=clearReferences;|Could not set field wsatCoordinatorService to null in class com.sun.xml.ws.tx.at.ATCoordinator
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.ws.tx.at.ATCoordinator
Something similar happened to me recently. What happened was that initially I was going to deploy the application to Tomcat7, so Netbeans included some Metro jars in my library section. I then decided to deploy to Glassfish instead, however those Metro jars are what are apparently causing the problem you are seeing. I just deleted the Metro jars from my libraries section in Netbeans, redeployed, and everything was ok.
Here is a link that talks a little bit more about what is happening: https://java.net/jira/browse/WSIT-1636.