spring jar conflicts with Axis2 jars - java

I'm getting below error where spring-ws jar is available but still I'm getting below error.( Spring 4.1.0, Axis 1.6.2)
failed spring-ws
java.lang.NoSuchMethodError: org/springframework/util/ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategies(DefaultStrategiesHelper.java:114)
at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategy(DefaultStrategiesHelper.java:200)
at org.springframework.ws.transport.http.MessageDispatcherServlet.initWebServiceMessageFactory(MessageDispatcherServlet.java:326)
at org.springframework.ws.transport.http.MessageDispatcherServlet.initMessageReceiverHandlerAdapter(MessageDispatcherServlet.java:311)
at org.springframework.ws.transport.http.MessageDispatcherServlet.initFrameworkServlet(MessageDispatcherServlet.java:234)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:485)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:215)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:431)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)

Most probably a version mismatch for your libraries. Check whether they are in correct versions. As per your question title please look at the below links.
Spring webservicetemplate jar conflict issue with Axis2
https://axis.apache.org/axis2/java/core/docs/app_server.html

Related

java.lang.ClassNotFoundException: com.sun.mail.util.MessageRemovedIOException

While upgrading application from jdk6 to jdk8, we are getting following error on Message msg = new MimeMessage(session);
SEVERE: Servlet.service() for servlet [default] in context with path [] threw exception [java.lang.reflect.InvocationTargetException] with root cause
java.lang.ClassNotFoundException: com.sun.mail.util.MessageRemovedIOException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
Has anyone faced the same or related issue while upgrading their java app ?
EDIT: the same code is working with java6.
You've got a mix of JavaMail classes from different versions of JavaMail in your classpath. What application server are you using and what's in the lib directory of your web application?
i used this and it worked:
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.5</version>
</dependency>
I had a similar problem. I am using Maven dependencies to
configure external libraries.
The problem was resolved by switching from the new maven repository
for the Java Mail Api, to the old Maven repository
New Repository(raises the exception):
javax.mail
javax.mail-api
1.5.5
Old repository(works fine):
javax.mail
mail
1.4
I have no idea why using the old repository works, and using the new one doesn't. It would be great if someone was to clarify this.

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/

NullPointerException while generating web service with Apache CXF

I want to create a web service and using Apache CXF 2.7.12. My jdk version is 1.8.0_20. While generating WSDL file in eclipse got this exception.
java.lang.NullPointerException
at org.apache.cxf.common.util.Compiler.useJava6Compiler(Compiler.java:187)
at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:141)
at org.apache.cxf.tools.java2wsdl.generator.wsdl11.BeanGenerator.generateAndCompile(BeanGenerator.java:91)
at org.apache.cxf.tools.java2wsdl.generator.wsdl11.BeanGenerator.generate(BeanGenerator.java:58)
at org.apache.cxf.tools.java2wsdl.generator.wsdl11.BeanGenerator.generate(BeanGenerator.java:35)
at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.generate(JavaToWSDLProcessor.java:156)
at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(JavaToWSDLProcessor.java:118)
at org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSContainer.java:110)
at org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:75)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:58)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:40)
at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:77)
at org.apache.cxf.tools.java2ws.JavaToWS.main(JavaToWS.java:45)
I have no idea about the problem related with Java6Compiler.
I solved problem after selecting JavaSE-1.8 execution environment in eclipse. It shows compatible jars
jre1.8.0_20[perfect match]

websphere 8.5.5 jaxws-rt: java.lang.NoClassDefFoundError: com.sun.xml.ws.spi.ProviderImpl

i have to migrate my ear project from JBoss to WebSphere 8.5.5.
My webService (I use jax-ws) is correctly deployed and I can invoke it with no error, but, when I try to invoke an external webService, i get the following error
java.lang.NoClassDefFoundError: com.sun.xml.ws.spi.ProviderImpl (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:176)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1564)
at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
at javax.xml.ws.spi.Provider.provider(Provider.java:82)
at javax.xml.ws.Service.<init>(Service.java:56)
jaxws-rt is in WEB-INF/lib directory, and I can use other classes from that library. I tried with a simple:
Class.forName("com.sun.xml.ws.Closeable").getProtectionDomain().getCodeSource().getLocation().getPath()
Wich returns the expected path:
/opt/IBM/WAS8.5_1/AppServer/profiles/AppSrv01_1/installedApps/svr04Cell02_1/MyEar.ear/MyWebService.war/WEB-INF/lib/jaxws-rt-2.1.4.jar
This means that jaxws-rt is in my classpath. So, why can't I see ProviderImpl class?
Thanks in advance

Weblogic 9.2: java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z

I'm getting this error when I'm trying to consume one Web Service:
java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z
at org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.isOperation(JaxWsServiceConfiguration.java:155)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.isValidMethod(ReflectionServiceFactoryBean.java:1853)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:623)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:289)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:392)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:499)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)
at javax.xml.ws.Service.getPort(Service.java:40)
at prova.wsclient.hello.HelloWorldImplService.getHelloWorldImplPort(HelloWorldImplService.java:78)
at prova.helloWorldProxy(Tasca.java:1380)
at prova.run(Tasca.java:126)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
In my project I've got CXF and JSR181 jars and seems to appear this method.
At the weblogic.xml appears:
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
Also, at the weblogic-application.xml:
<prefer-application-packages>
<package-name>javax.jws.*</package-name>
</prefer-application-packages>
My version of Weblogic Server is 9.2. What I'm doing wrong? I would appreciate any help.
Thanks!
I have faced this kind of issues with Weblogic 9.2 and resolved by prepending the jars to the server jvm classpath (you can do it through the weblogic console). It is not the right solution, but it has worked at times.

Categories

Resources