You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ben Starr <b....@qut.edu.au> on 2002/06/07 04:43:57 UTC

Tomcat 3.2.3, WEB-INF/lib, JAXP 1.2 and JAXM 1.0.1

Is it possible to get a web app in Tomcat 3.2.3 to work with JAXP 1.2 and/or
JAXM 1.0.1 without having to place the JARs in the $TOMCAT_HOME/lib
directory? (ie: by placing them in the WEB-INF/lib directory) It works fine
on Tomcat 4.0.1 but I can only get it to work with Tomcat 3.2.3 by placing
the JARs in the $TOMCAT_HOME/lib directory. Otherwise I run into the
following error:


Error: 500

Location: /proprietary/news-event.jsp
Internal Servlet Error:

javax.servlet.ServletException: Provider
org.apache.xalan.processor.TransformerFactoryImpl not found
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:508)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
    at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
    at 
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at 
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:496)

Root cause: 

javax.xml.transform.TransformerFactoryConfigurationError: Provider
org.apache.xalan.processor.TransformerFactoryImpl not found
    at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
    at au.edu.qut.news.tag.QUTNewsEvent.doStartTag(QUTNewsEvent.java:42)
    at 
_0002fnews_0002devent_0002ejspnews_0002devent_jsp_22._jspService(_0002fnews_
0002devent_0002ejspnews_0002devent_jsp_22.java:64)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
va:130)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:282)
    at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
    at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
    at 
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at 
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:496)


The classes seem to work fine until a factory method is required such as
TransformerFactory.newInstance() or MessageFactory.newInstance(). It seems
to be a problem with the class loader the factory method is trying to use.
Looking at the source it gets the current thread's context class loader to
find the implementation to load:

Thread.currentThread().getContextClassLoader()

Although I'm sure it is not recommended I've found that if I replace the
current thread's class loader (Servlet or JSP page) with the class loader
for the JSP/Servlet I am running the code in the factory method is then able
to find the implementation:

Thread.currentThread().setContextClassLoader(getClass().getClassLoader())

I'm not sure which class loader this would be (or how to access the
different Tomcat class loaders). Perhaps Tomcat is not assigning the
thread's context class loader correctly? However, after setting the context
class loader as above I then run into the error:


Error: 500

Location: /proprietary/news-event.jsp
Internal Servlet Error:

javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException processing
news:news-event tag: javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException: org.xml.sax.SAXException:
Namespace not supported by SAXParser
    at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
    at 
_0002fnews_0002devent_0002ejspnews_0002devent_jsp_25._jspService(_0002fnews_
0002devent_0002ejspnews_0002devent_jsp_25.java:94)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
va:130)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:282)
    at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
    at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
    at 
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at 
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:496)

Root cause: 

javax.servlet.jsp.JspTagException:
javax.xml.transform.TransformerConfigurationException processing
news:news-event tag: javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException: org.xml.sax.SAXException:
Namespace not supported by SAXParser
    at au.edu.qut.news.tag.QUTNewsEvent.doStartTag(QUTNewsEvent.java:50)
    at 
_0002fnews_0002devent_0002ejspnews_0002devent_jsp_25._jspService(_0002fnews_
0002devent_0002ejspnews_0002devent_jsp_25.java:72)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
va:130)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:282)
    at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
    at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
    at 
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at 
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:496)


And that is as far as I have got with looking into it. Are the
Xalan/JAXP/JAXM factories not compatible with Tomcat 3.2.3 or is there a
workaround to this problem which does not require putting the JARs in the
$TOMCAT_HOME/lib? I must admit that I do not know a lot about the way the
class loaders work in Tomcat except that there are about three different
ones. (I've read the pages in the Tomcat user guide.)

The reason I am asking is because I want to deploy on a server where I would
rather not mess with the global Tomcat settings and where I do not have
control over the version of Tomcat. It would be much nicer to keep my
deployment separate from the Tomcat server and other web apps.

Thanks,

Ben Starr


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>