aspose file tools*
The moose likes Web Services and the fly likes Installing Axis 1.4 jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Installing Axis 1.4 jar files" Watch "Installing Axis 1.4 jar files" New topic
Author

Installing Axis 1.4 jar files

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Hello.

I am trying to install Axis 1.4 the right way.

I have Apache Tomcat/6.0.32 running with several applications. The applications are installed like this:
tomcat/webapps/CONTEXT_PATH/App1/WEB-INF/lib
tomcat/webapps/CONTEXT_PATH/App2/WEB-INF/lib
tomcat/webapps/CONTEXT_PATH/App3/WEB-INF/lib

Solution 1:
First I installed Axis by putting all jar files into the Tomcat common / shared lib:
tomcat/lib/

- actually this works fine just until I restart one of the applications using Tomcat manager. Then the error occours:

Dec 6, 2011 4:00:34 AM org.apache.catalina.loader.WebappClassLoader findResourceInternal
INFO: Illegal access: this web application instance has been stopped already. Could not load META-INF/services/javax.xml.parsers.DocumentBuilderFactory. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
Dec 6, 2011 4:00:34 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:88)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:195)
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:98)

- and,

INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at com.sun.org.apache.xerces.internal.impl.dv.ObjectFactory.findProviderClass(ObjectFactory.java:403)
at com.sun.org.apache.xerces.internal.impl.dv.ObjectFactory.newInstance(ObjectFactory.java:354)
at com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory.getInstance(DTDDVFactory.java:98)
at com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory.getInstance(DTDDVFactory.java:83)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.<init>(XML11Configuration.java:565)
at com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration.<init>(XIncludeParserConfiguration.java:145)
at com.sun.org.apache.xerces.internal.parsers.XIncludeParserConfiguration.<init>(XIncludeParserConfiguration.java:106)
at com.sun.org.apache.xerces.internal.parsers.JAXPConfiguration.<init>(JAXPConfiguration.java:30)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.<init>(DocumentBuilderImpl.java:112)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:101)

- and

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1584)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:848)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:877)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1089)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1116)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1100)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)

Solution 2:
Then I tried to delete the Axis jar files from Tomcat common / shared lib and moved all Axis jar files into each application WEB-INF/lib. Then the error occours:
faultString: java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl


AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
at org.apache.axis.Message.setup(Message.java:352)
at org.apache.axis.Message.<init>(Message.java:246)
at org.apache.axis.client.Call.invoke(Call.java:2425)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at module.oioxml.dk.oes.navisionstat.MessageBroker.SendnavisionBrokerSoapStub.submitTrackedMessage(SendnavisionBrokerSoapStub.java:140)

I have been searching for a long time to solve solution 2, which I guess is the right way to put the Axis jar files, but I didn't find any help. I am currently using solution 1 which isn't working well if I have to restart an application from time to time.

Any help would be appreciated, please?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

Is this the same error you talked about here?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
My first question would be: why use a SOAP toolkit that's been obsolete for years? What's wrong with a current version of Axis-2?


Ping & DNS - my free Android networking tools app
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Vijitha Kumara wrote:Is this the same error you talked about here?


Yes, exactly the same error.
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Ulf Dittmer wrote:My first question would be: why use a SOAP toolkit that's been obsolete for years? What's wrong with a current version of Axis-2?


I will take a look at Axis-2 right away. I am not sure if I am just able to replace the jar files from Axis-2 or I actualy have to make changes in the code. I guess I need to change the code.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
Oh, I see, the WS exists already. In that case I'd proceed cautiously in upgrading (or maybe not at all for the time being). I thought this was a new WS. The issue you're seeing is probably not related to the particular Axis version you're using, so upgrading likely won't help with that.

And yes, all the Axis jar files should be WEB-INF/lib, not in any of Tomcat's directories. If several web apps share code, then you can't easily stop and restart one of them; all the libraries would have to be written for that or it can cause problems like the one you're seeing. If you shut down Tomcat completely, and remove all Axis jar files from Tomcat's (and the JRE's) various directories, it should work fine.
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Please see the error in solution 1:
INFO: Illegal access: this web application instance has been stopped already. Could not load META-INF/services/javax.xml.parsers.DocumentBuilderFactory.

- It seems that if we restart one application in Tomcat manager, it closes down the instance of DocumentBuilderFactory. And we do share this instance (or the jar files) across several applications. So I am wondering if we could either:

1) Do not close the instance when one application is restarted, or even better
2) If DocumentBuilderFactory has already been stopped / closed, then how can we create a new instance?

Today we create a new instance like this, but if the instance has been stopped already, an error occours here:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

Here is the code we use:


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
That's a side effect of sharing some of the jar files. As I said, not all libraries are built for that, so you're better off not sharing them.

As an aside, be aware that even if nothing is shared, reloading individual web apps in a Tomcat will usually lead to memory problems eventually (PermGenSpace problem, to be exact). The reload process is not always able to get rid of a web app entirely, so some memory is leaked. The solution for that is to restart Tomcat in its entirety, maybe not at every web app reload, but every so often.
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Ok, as you see in solution 2, I moved all Axis 1.4 jar files to each application /WEB-INF/lib, but then I got this error:
faultString: java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl


Why is that? Do I need to compile the stubs again or what does "ClassCastException: org.apache.axis.attachments.AttachmentsImpl" means?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
Generally it means that this class is loaded by more than one classloader, and that those two classloaders conflict with one another. Are you absolutely certain that there are no leftover classes or jar files anywhere in Tomcat's or the JVM's directories that contain any Axis classes?
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
What I did was, that I deleted those files from tomcat/lib/:
axis.jar
commons-discovery-0.4.jar
commons-logging-1.1.1.jar
jaxrpc.jar
saaj.jar
wsdl4j-1.5.1.jar
xercesImpl.jar

- I then copied the files to each web app in "/webapps/app1/WEB-INF/lib" and "/webapps/app2/WEB-INF/lib" etc.

And I did remember to restart tomcat.

I still have plenty other jar files located in tomcat/lib/. Maybe some of these files are conflicting with the Axis jar files?

I just realized that I had an old version of commons-discovery-0.2.jar and commons-logging.jar located in tomcat/lib/. Could those to files be the reason for the conflict?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
No, those two jar files are not related. The crucial class is org.apache.axis.attachments.AttachmentsImpl; make sure that no Axis classes are in Tomcat's directories, those with "org.apache.axis" classes in them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Installing Axis 1.4 jar files