I tried to install a standalone axis on jboss 4.0. I copied 'axis' folder to jboss 'deploy' folder, rename from 'axis' to 'axis.war'. Create a new file jboss-web.xml and add a context root '/axis'. Now, start the jboss server, I can view happyaxis.jsp. Everything looks fine except when I try to visit EchoHeaders.jws. The axis failed to compile by not finding javax.servlet.http.HttpServletRequest. If I copied $JBOSS_HOME/server/all/lib/javax.servlet.jar to axis.war/WEB-INF/lib. Everything works. But I don't want my web services depend on jboss and that's not the right way to do it. Is there anyway that I can config to let axis know the classpath to that jar in jboss?
<soapenv:Envelope> − <soapenv:Body> − <soapenv:Fault> <faultcode>ns1:Server.compileError</faultcode> − <faultstring> Error while compiling: D:\server\jboss-4.0.2\server\default\.\deploy\axis.sar\axis.war\WEB-INF\jwsClasses\EchoHeaders.java </faultstring> − <detail> − <Errors> Error compiling D:\server\jboss-4.0.2\server\default\.\deploy\axis.sar\axis.war\WEB-INF\jwsClasses\EchoHeaders.java: Line 0, column 0: could not parse error message: Note: sun.tools.javac.Main has been deprecated. D:\server\jboss-4.0.2\server\default\.\deploy\axis.sar\axis.war\WEB-INF\jwsClasses\EchoHeaders.java:21: Class javax.servlet.http.HttpServletRequest not found in import. import javax.servlet.http.HttpServletRequest; </Errors> </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
This sounds odd. Axis (like any web app) needs to have access to the servlet API interfaces, because it uses those classes internally. So adding the jar file to the Axis lib directory shouldn't make a difference. JBoss may be different, but, e.g., with Tomcat it's not necessary to add the API jar.
Joined: Jul 23, 2003
You are right. Drop axis into Tomcat, everything just works.
The only explaination is that the standalone axis runtime classpath in jboss and the classpath picked by axis classloader to compile .jws are different.
"Java 1.4 changed the rules as to how packages beginning in java.* and javax.* get loaded. Specifically, they only get loaded from endorsed directories."
The instructions talk about jaxrpc.jar and saaj.jar, but the same seems to apply to javax.servlet.jar. Various instructions for copying that jar into jbossweb-tomcat55.sar/ or listing it in JBOSS_CLASSPATH didn't seem to work. I was able to get it working by copying javax.servlet.jar into JBOSS_HOME/lib/endorsed/, and noticed an entry in boot.log that it was picked up. Alternately, I imagine you could muck with the JBOSS_ENDORSED_DIRS variable in run.sh/run.conf.