I copied the xmlj, xerces, and xalan from WebSphere to my local IDE
development environment, and I was able to compile my Servlet using the WAS
xerces and xalan jar files. My code is listed below. All I want my servlet
to do right now is ti simply take two URL's parse them and give me my HTML
content to the client/browser. I get an error when I move it up to the WAS
App Server and I have listed that error message down below.
//*** These are the imports I thought we should use ... they came from the
SimpleTransform.
import org.xml.sax.SAXException;
import org.apache.xalan.xslt.XSLTProcessorFactory;
import org.apache.xalan.xslt.XSLTInputSource;
import org.apache.xalan.xslt.XSLTResultTarget;
import org.apache.xalan.xslt.XSLTProcessor;
/**Process the HTTP Get request*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
//*** URL source of my XML file
String sXMLPath = http://www.mywebsite.net/myfile.xml
//** URL source of my XSL file
String XSLPath = http://www.mywebsite.net/myfile.xsl
try
{
//*** Have the XSLTProcessorFactory obtain a interface to a new
XSLTProcessor object.
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
// Have the XSLTProcessor processor object transform "foo.xml" to
// System.out, using the XSLT instructions found in "foo.xsl".
processor.process(new XSLTInputSource(sXMLPath),new
XSLTInputSource(sXSLPath),new XSLTResultTarget(out));
}
catch(org.xml.sax.SAXException saxe)
{ System.out.println("org.xml.sax.SAXException: " + saxe.getMessage() ); }
}
This is the error message I am getting. Why would I be getting an
java.lang.NoClassDefFoundError: org/apache/xerces/parsers/DOMParser
message when I tested out this code directly against the same
xalan/xerces/xmlj files?
Any help would be much appreciated. Thanks.
<HR width="100%">
<B>Root Error-1</B>: org/apache/xerces/parsers/DOMParser<BR><XMP>
java.lang.NoClassDefFoundError: org/apache/xerces/parsers/DOMParser
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Compiled Code)
at java.lang.Class.forName(Compiled Code)
at org.apache.xalan.xslt.XSLTEngineImpl.<init>(XSLTEngineImpl.java:360)
at
org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(XSLTProcessorFactory
.java:79)
at com.tmfi.medeview.servlets.DrugList.doGet(DrugList.java:43)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(Compiled
Code)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(Compiled
Code)
at com.ibm.servlet.engine.webapp.IdleServletState.service(Compiled Code)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(Compiled
Code)
at com.ibm.servlet.engine.webapp.ServletInstance.service(Compiled Code)
at
com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(Compiled
Code)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(Compiled
Code)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(C
ompiled Code)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(Compiled
Code)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(Compiled
Code)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(Compiled
Code)
at
com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(Compiled
Code)
at
com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(Co
mpiled Code)
at
com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(Com
piled Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRu
nnable.notifyService(Compiled Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRu
nnable.run(Compiled Code)
at
com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run
(Compiled Code)
at java.lang.Thread.run(Compiled Code)
</XMP><BR>
<HR width="100%">
<B>Wrapped Error-2</B>: org/apache/xerces/parsers/DOMParser<BR><XMP>
javax.servlet.ServletException: org/apache/xerces/parsers/DOMParser
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at javax.servlet.ServletException.<init>(Compiled Code)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(Compiled
Code)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(Compiled
Code)
at com.ibm.servlet.engine.webapp.IdleServletState.service(Compiled Code)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(Compiled
Code)
at com.ibm.servlet.engine.webapp.ServletInstance.service(Compiled Code)
at
com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(Compiled
Code)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(Compiled
Code)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(C
ompiled Code)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(Compiled
Code)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(Compiled
Code)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(Compiled
Code)
at
com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(Compiled
Code)
at
com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(Co
mpiled Code)
at
com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(Com
piled Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRu
nnable.notifyService(Compiled Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRu
nnable.run(Compiled Code)
at
com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run
(Compiled Code)
at java.lang.Thread.run(Compiled Code)
</XMP><BR>
<HR width="100%">
<B>Wrapped Error-3</B>: Server caught unhandled exception from servlet
[DrugList]: org/apache/xerces/parsers/DOMParser<BR><XMP>
com.ibm.servlet.engine.webapp.UncaughtServletException: Server caught
unhandled exception from servlet [DrugList]:
org/apache/xerces/parsers/DOMParser
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at javax.servlet.ServletException.<init>(ServletException.java:132)
at
com.ibm.websphere.servlet.error.ServletErrorReport.<init>(ServletErrorReport
.java:43)
at
com.ibm.servlet.engine.webapp.WebAppErrorReport.<init>(WebAppErrorReport.jav
a:32)
at
com.ibm.servlet.engine.webapp.UncaughtServletException.<init>(UncaughtServle
tException.java:11)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(C
ompiled Code)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(Compiled
Code)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(Compiled
Code)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(Compiled
Code)
at
com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(Compiled
Code)
at
com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(Co
mpiled Code)
at
com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(Compiled
Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(Com
piled Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRu
nnable.notifyService(Compiled Code)
at
com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRu
nnable.run(Compiled Code)
at
com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run
(Compiled Code)
at java.lang.Thread.run(Compiled Code)
</XMP><BR>
"Tom Holmes Jr." wrote:
>
> > did you put those jars in the admin server classpath ?
>
> No, the ancient version of Xerces, Xalan, and XMLJ that came with WebSphere
> are in the /lib directory of WebSphere.
> Because this Servlet is going to be deployed at a customer site eventually,
> I have no idea of what other XML translations are going on. Certainly
> WebSphere itself uses it's versions of Xalan and Xerces to do it's own work,
> so I am hesitant about upgrading the XML parser for this customer.
>
> Please let me know if you need any more information. Thanks.
>
> Tom
>
> "Paul Ilechko" <paul.i...@bms.com> wrote in message
> news:3AFAD3CE...@bms.com...
No, the ancient version of Xerces, Xalan, and XMLJ that came with WebSphere
are in the /lib directory of WebSphere.
Because this Servlet is going to be deployed at a customer site eventually,
I have no idea of what other XML translations are going on. Certainly
WebSphere itself uses it's versions of Xalan and Xerces to do it's own work,
so I am hesitant about upgrading the XML parser for this customer.
Please let me know if you need any more information. Thanks.
Tom
"Paul Ilechko" <paul.i...@bms.com> wrote in message
news:3AFAD3CE...@bms.com...
However, I do have some new information. It turns out the "web-app" that
was created has a classpath to the Orion directory. I suspect that maybe
this web-app is using these Xerces and Xalan from Orion than from WebSphere,
but I can't be sure until I try an experiement.
My next step is to replace the xalan and xerces under the Orion directory
(which the web-app is using as a classpath) with the new xalan and xerces
jar from xml.apache.org. Then I am going to put back my original servlet
and see what develops.
Thanks.
Tom
"Paul Ilechko" <paul.i...@bms.com> wrote in message
news:3AFAE3E6...@bms.com...