Axis2 Weblogic 10 jar conflict - java

I am trying to deploy a axis2 webservice client on Weblogic 10 server. However i get the below error :
java.lang.ClassCastException:
com.ctc.wstx.stax.WstxInputFactory at
javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
at
weblogic.servlet.internal.WebAppHelper$IOHelperImpl.parseXML(WebAppHelper.java:247)
at
weblogic.descriptor.DescriptorCache.parseXML(DescriptorCache.java:350)
at
weblogic.servlet.internal.WebAppHelper.parseTagLibraries(WebAppHelper.java:142)
at
weblogic.servlet.internal.WebAppHelper.(WebAppHelper.java:60)
at
weblogic.servlet.internal.WebAppServletContext.(WebAppServletContext.java:402)
at
weblogic.servlet.internal.WebAppServletContext.(WebAppServletContext.java:452)
at
weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:410)
at
weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:582)
at
weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:298)
at
weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at
weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at
weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:56)
at
weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:46)
at
weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at
weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147)
at
weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:189)
at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:87)
at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at
weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:719)
at
weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1186)
at
weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
at
weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:157)
at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
at
weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:464)
at
weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at
weblogic.work.ExecuteThread.run(ExecuteThread.java:172)cuteThread.run(ExecuteThread.java:172)
My weblogic-application.xml is as follows:
<wls:prefer-application-packages>
<wls:package-name>com.ctc.wstx.*</wls:package-name>
<wls:package-name>javax.xml.*</wls:package-name>
<wls:package-name>org.apache.*</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>
All help would be appreciated!

Fixed the issue:
The weblogic-application.xml should be:
<wls:prefer-application-packages>
<wls:package-name>org.apache.*</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>
So that it picks up the weblogic stax-api implementation jar. Also there is no direct way to get weblogic stax parser to work with Axis2 1.5.2. So you need to have woodstock parser in the class path.

The issue is same with CXF. I tried all these approaches and ended up putting huge package list. Finally gave up as we decided to use Tomcat.
The above list given is only apache classes, you may have to add more packages for dependencies and beyond.
Refer: http://cxf.apache.org/docs/application-server-specific-configuration-guide.html#ApplicationServerSpecificConfigurationGuide-WebLogic

Related

Spring Boot REST service deploy on Weblogic12c

I'm deploy my application on oracle weblogic 12c.
My application use Spring Boot, Spring REST service and Jackson
All lib for jackson:
jackson-annotations.2.6.1.jar
jackson-core.2.6.1.jar
jackson-databind.2.6.1.jar
jackson-datatype-hibernate4.2.6.1.jar
jackson-datatype-hppc.2.6.1.jar
jackson-datatype-json-org.2.6.1.jar
jackson-datatype-jsr310.2.6.1.jar
I get this error:
java.lang.IllegalAccessError: tried to access method com.fasterxml.jackson.databind.ser.std.StdSerializer.(Ljava/lang/Class;)V from class com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
I think jackson-datatype-jsr310 confict in weblogic lib.
Please help me!
it worked for me to add this to the weblogic.xml :
<wls:prefer-application-packages>
<wls:package-name>com.fasterxml.jackson.*</wls:package-name>
</wls:prefer-application-packages>

spring jar conflicts with Axis2 jars

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

NoSuchMethodError - Calling Class/Method from Class in Same Package

We are integrating an internal framework into our weblogic application and we are running into deployment problems.
Technologies Used
Weblogic 10.3.6 application
Spring 3.0
Maven 2
Eclipse J2EE
The Problem
On startup of the weblogic application, we receive the following NoSuchMethodError while initializing one of the beans. This error is occuring when calling classes in the org.joda.time (2.0) jar.
Caused By: java.lang.NoSuchMethodError: org.joda.time.DateTimeZone.convertLocalToUTC(JZ)J
at org.joda.time.LocalDate.toDateTimeAtStartOfDay(LocalDate.java:715)
at org.joda.time.LocalDate.toDateTimeAtStartOfDay(LocalDate.java:690)
. . . excluded . . .
Things We Have Tried
After Googling "NoSuchMethodError spring", many of the problems seem to be incompatible Spring versions. After printing the dependency tree, the only Spring version in use is 3.0.
Googling "NoSuchMethodError" usually gave JAR hell solutions.
Multiple versions of the same dependency. After doing some maven dependency management, the only joda-time jar in use is 2.0. Additionally, the local repository was purged of any unnecessary jars.
.war / runtime may not have the correct jars included in the lib directory. After looking into the WEB_INF/lib directory, the only joda-time jar is version 2.0, which contains all of the appropriate class files
One mysterious thing is that the DateTimeZone.convertLocalToUTC(JZ)J has been a part of the org.joda.time project since 1.0, so even if we have incompatible versions, the method should still be found, especially if the class and package are able to be found.
Finally there are no other DateTimeZone classes in the project (ctrl+shift+T search in eclipse) so I'm confused as to which class is being loaded if the org.joda.DateTimeZone class is not being loaded.
Questions:
Can anyone explain why the method could not be found?
Are there more places to check for existing or conflicting jars?
Is there a way to check the DateTimeZone class that the LocalDate class is using during runtime via Eclipse debug?
Here's some interesting reading:
prefer-web-inf-classes Element
The weblogic.xml Web application deployment descriptor contains a
element (a sub-element of the
element). By default, this element is set to
False. Setting this element to True subverts the classloader
delegation model so that class definitions from the Web application
are loaded in preference to class definitions in higher-level
classloaders. This allows a Web application to use its own version of
a third-party class, which might also be part of WebLogic Server. See
“weblogic.xml Deployment Descriptor Elements.”
taken from: http://docs.oracle.com/cd/E15051_01/wls/docs103/programming/classloading.html
Other troubleshooting tips:
You can try: -verbose:class and check your managed server's logs to check if the class is being loaded properly.
An efficient way to confirm which intrusive jar might be getting loaded is by running a whereis.jsp within the same webcontext (i.e., JVM instance) of this app.
--whereis.jsp --
<%# page import="java.security.*" %>
<%# page import="java.net.URL" %>
<%
Class cls = org.joda.time.DateTimeZone.class;
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc = cSource.getLocation();
out.println(loc);
// it should print something like "c:/jars/MyJar.jar"
%>
You can also try jarscan on your $WEBLOGIC_HOME folder to see if you can find the jar that contains this class: https://java.net/projects/jarscan/pages/Tutorial
A NoSuchMethodError is almost always due to conflicting library versions. In this case I'm guessing there are multiple versions of joda libraries in the two projects.
Weblogic is pulling the org.joda jar.
Tryu adding this in your weblogic.xml to exclude the jar that weblogic is pulling, and instead use your appllication jar.
The below is from my application, you can have a look what all we have to removed for our application.
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>antlr.*</wls:package-name>
<wls:package-name>org.slf4j.*</wls:package-name>
<wls:package-name>org.slf4j.helpers.*</wls:package-name>
<wls:package-name>org.slf4j.impl.*</wls:package-name>
<wls:package-name>org.slf4j.spi.*</wls:package-name>
<wls:package-name>org.hibernate.*</wls:package-name>
<wls:package-name>org.springframework.*</wls:package-name>
<wls:package-name>javax.persistence.*</wls:package-name>
<wls:package-name>org.apache.commons.*</wls:package-name>
<wls:package-name>org.apache.xmlbeans.*</wls:package-name>
<wls:package-name>javassist.*</wls:package-name>
<wls:package-name>org.joda.*</wls:package-name>
<wls:package-name>javax.xml.bind.*</wls:package-name>
<wls:package-name>com.sun.xml.bind.*</wls:package-name>
<wls:package-name>org.eclipse.persistence.*</wls:package-name>
</wls:prefer-application-packages>
<wls:show-archived-real-path-enabled>true</wls:show-archived-real-path-enabled>
</wls:container-descriptor>

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.

Hibernate/JPA inheritance issue on weblogic

Im getting a weird error when running my spring2.5.6,jpa(hibernate3.4) webapp in weblogic 10.3
[ERROR] Javassist Enhancement failed: com.xxx.domain.model.Scheme
java.lang.NoSuchMethodError: pcGetManagedFieldCount
at com.xxx.domain.model.Fund.<clinit>(Fund.java)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAc
cessorFactory.java:25)
The com.xxx.domain.model.Scheme class is a mapped subclass entity of the abstract fund entity on a single_table inheritance hierarchy, and I'm getting this error for all entities on the hierarchy. I'm using both annotated classes and xml metadata to define the mappings for my persistence classes.
I only get this error when the app is deployed to weblogic, so everything runs fine using junit. I have tried upgrading to the latest version on javaassit.jar.
Problem Looks to me like an issue with classloading order, but I cant figure it out.
PS. As suggested by bea I have added the following to the weblogic.xml
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
Anyone got any ideas, other config tips, or directions I should take my investigation?
I had the same problem.
My entities extended a class (#MappedSuperClass) which lived inside a jar dependency. I had to move that class from the jar into my project. Only then it would work and deployed fine.
Also another way to solve this is to specify your entities explicitly in the persistence.xml
I'm sorry, I only have WebLogic 10.0 on my machine, and it doesn't have any javassist JARs in the distro. Looks like javassist was only added in 10.3 for AOP byte code generation.
It might be worth a try to remove the javassist JAR from your WebLogic deployment and use the version that it supports. Take the "prefer-web-inf-classes" tag out of your web.xml and see if it can work with the version that WebLogic prefers.
Can you post the code for the entity class and, if you're not using annotations, the segment of your hbm mapping file?
Your classpath hunch may be right on. In your weblogic-application.xml, try this
<prefer-application-packages>
<package-name>antlr.*</package-name>
<package-name>org.antlr.*</package-name>
</prefer-application-packages>
If you have any more log output, please post that as well.
I just lost a couple of days on this myself. The problem for me was that I 2 separate data-services modules in my app. I'm thinking 10.3 has some trouble with that. I'm not sure of the solution, but a work around for me was to combine both of my data-services modules into just one.
BEA seems to be aware of this issue. Hopefully the URL below will help. Reference CR370788.
http://edocs.bea.com/wls/docs103/issues/known_resolved.html

Categories

Resources