Resolving axis2 and OC4J library conflicts - java

I'm trying to deploy an Axis2 web service to an OC4J 10.1.3 app server.
I was using axis 1.4 before and had just created my own shared library with all of the files. There was an issue with 1.4 that was patched with 1.5 so now I'm using that but it does not include all of the libraries. This time I deployed the axis2.war to the OC4J server and I'm using the axis2 admin page to attempt to deploy my web service.
If I deploy a web service through axis2 then I'll get a java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z but I cannot find the conflicting library. Axis2 has the new jax-ws libraries in it but I think it's an issue on the OC4J app server. I excluded xml.jar (since it has old JAXB 1.0 libs) and this resolves the issue on my local machine but not on the linux box.
I tried editing the deployment plan to search local folders first and this allows me to deploy the service, but when I try to access it, or the WSDL, then I get an error regarding a class cast exception and JXDocumentBuilderFactory (I don't have the exact error at this moment).
I compared the shared libraries on the linux box with the ones on my local machine and I used the same ones on each (I didn't verify the versions of each jar, though). If axis2 is deployed to OC4J and I deploy my service to axis2 then wouldn't I inherit the axis2 libraries (jax-ws, etc)?

Try removing the inherited library in conflict by adding this to your orion-application.xml:
<orion-application>
<imported-shared-libraries>
<remove-inherited name="PUT_HERE_THE_NAME_OF_THE_LIBRARY"/>
</imported-shared-libraries>
</orion-application>
More here: Removing and/or Replacing an Oracle Shared Library Imported by Default
Edit:
I searched the shared libraries and found that is not there, jws-api.jar is loaded at boot time and can't be removed easily:
Replace the OC4J JAX-WS Libraries
OC4J has preliminary support for JAX-WS, unfortunately this means that during OC4J boot it loads outdated JAX-WS APIs and implementation by Oracle. This occurs even before shared libraries comes into action, at a very early stage of OC4J boot.
Boot-time OC4J libraries are configured in boot.xml file in $ORACLE_HOME/j2ee/home/oc4j.jar bootstrap jar. To get rid of this:
1-Copy the jar file to ${oracle.home}/webservices/lib/jaxws
2-Unpack the OC4J.jar file
3-Locate META-INF/boot.xml
4-Replace path in this line with your jar:
<code-source
path="${oracle.home}/webservices/lib/jws-api.jar"
if="java.specification.version == /1\.[5-6]/"
/>
5-Repackage oc4j.jar (don't forget about MANIFEST.MF - use jar -m META-INF/MANIFEST.MF)
Original article: OC4J Configuration for Web Services

Related

What version of AXIS2 shipped with Websphere 8.5.5.2?

I just want to know the inputs for below questions.
what version of AXIS2 will come with Websphere 8.5.5.2?
Where can i see the version details of AXIS2 jars shipped with WAS 8.5.5.2?
My code actually compiled with AXIS2 1.6.1 and deployed the same in WAS 8.5.5.2. I am getting below classcast exceptions. What could your suggestions to resolve this issue. I thought there is problem with different versions of axis2 while compiling and deploying. I am not able to know what version of axis2 shipped with websphere 8.5.5.2.
Approaches I have used.
1) Part of code which uses Axis was compiled against AXIS2 1.6.1 version and generated war was deployed in WAS 8.5.5.2 with no libraires in WAR. Got classNotFoundException for org.apache.axiom.util.stax.XMLStreamWriterUtils. Added org.apache.axis2.jar located in plugins in shared libraries and attached to my server war module level. Then class cast exception came.
2) Part of code which uses Axis was compiled against AXIS2 1.6.1 and generated war was deployed in WAS 8.5.5.2 with org.apache.axis2.jar under WEB-INF/libraires in WAR. Then class cast exception came.
Calling getRendererRef(): renderer Type=[OutInRenderer]
WSRenderer I Start:
WSRenderer E Unable to perform rendering due to exception (java.lang.ClassCastException: org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter incompatible with org.apache.axiom.ext.stax.datahandler.DataHandlerWriter)
WSRenderer E stacktrace=org.apache.axiom.util.stax.XMLStreamWriterUtils.internalGetDataHandlerWriter(XMLStreamWriterUtils.java:71)
org.apache.axiom.util.stax.XMLStreamWriterUtils.writeDataHandler(XMLStreamWriterUtils.java:134)
3) Kept Parent_LAST option in WAS 8.5.5.2 for server war which results plenty of errors related to parsers and other. Application stopped working because of many classcast and incompatible issues.
Any inputs are appreciable...
The code in the WebSphere runtime is not based on an official release of Apache Axis2, but on a fork created from a development version. Your only option to use Axis2 on WebSphere is to configure your application with parent last class loading. To make this work you need to remove from your application all the JARs containing APIs that must be loaded from the server runtime, such as the servlet API and various XML APIs.

Java ee: Can't create ear project in eclipse using Tomee

I am using Tomee plus as a server for my java ee project in eclipse. I am unable to create an ear project in eclipse as the option for target runtime does not have apache tomcat for option. The only runtime environments I see are:
Basic - which has J2ee runtime library
Jboss
Object Web
Just to clarify, I am able to create a dynamic web project with tomee runtime. The problem is creating an EAR project with tomee runtime. Any help would be appreciated.
I believe you need to install the JST Server Adapters Extensions. I believe this was only added recently (Mars?).

Multiple applications with different grails versions on Tomcat

I am developing a new web application to be deployed on a tomcat server. There is another application running on that server with an older grails version (2.2.4). I don't want to upgrade it. Is there any issues to take into account while developing / deploying the new application (with grails version 2.4.4). They will run side by side.
Thanks for any help.
It depends where you have your grails libraries. If they are part of another application WAR file you will not have issues as you can pack your own libraries in your application WAR. Each application will use it's own copy of grail libraries.
But if you have your grial libraries as a part of system libraries of tomcat (eg. tomcat/lib ) you can have issues as those libraries are added in classpath for all applications.

Where to put property file in JBOSS 7 or Glassflish? (Best practice)

I have developed applications for JBOSS EAP 5 with eclipse. I placed property files under server-conf/conf/...
I am now developing in Netbeans (7.2). The bundled glassfish server is used for easier development. The target environment is JBOSS EAP 6. What is the best place to place property files? A common place for both environments would be great.
If you want to have them external to the application you'll probably have to write a custom module. This isn't as bad as it sounds, check out HowToPutAnExternalFileInTheClasspath.
See also migration-issues-to-jboss-7-1
The most practical solution is creating a custom folder outside both JBOSS and Glassfish (i.e C:\PropertiesFolder) then add this folder to the classpath of each server.
Please read my postfor more details about classpath in JBoss

How do I load jar resources into META-INF\resources in a derivative project?

I have a core Web-Base.jar file that has shared components that I use in my web applications.
I'm using Wicket 1.5. While trying to Solve a problem I was browsing the javadoc and found MetaInfStaticResourceReference which I think could improve my applications efficiency, and simplicity.
How can I set up Web-Base so that my Web Applications that list Web-Base as a dependency have the necessary resources added to
META-INF/resources/* in the final .war file?
NOTE: I'm using
wicket 1.5.5
Maven
Tomcat 6 (just started looking into upgrading to Tomcat 7.)
This will work only on Tomcat 7 because this is supported only in Servlet3 specification.
Put the resources in $PROJECT/src/main/resources/META-INF/resources/ folder.

Categories