XSLTProcessorFactory.getProcessor() - no exception but no error

Hi,

I have a web application that is trying to create a HTML using an XML and XSLT. I have it deployed on WebLogic 8.1 sp5, jdk 1.4.2

Here is a piece of the code:

..............

//XSL Processors

import org.apache.xalan.xslt.XSLTProcessorFactory;

import org.xml.sax.SAXException;

public class SrvltStaticMaintenanceFilter extends HttpServlet {

public final void doPost(HttpServletRequest request, HttpServletResponse response){

try{

................

XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

System.out.println("test 5");

System.out.println("processor = " + processor );

System.out.println("test 6");

} catch(SAXException e){

System.out.println("SAXException = " + e);

} catch(Exception e){

System.out.println("ERROR = " + e.getMessage());

}

}

The code is not working, but funny enough there is no error displayed. The html page generated is empty

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>

<BODY></BODY></HTML>

"test 5" is displayed, "test 6" is not.

xalan.jar is in the classpath

Any ideas? Thanks

[1357 byte] By [dragosionela] at [2007-11-27 2:39:30]
# 1

I would start by putting the code in a plain old Java application and making it work. Once it was working I would go back and put the working code into my servlet.

I would also leave out the hard-coded references to Xalan and use the JAXP classes built into Java, unless I had a strong reason why I had to use Xalan. Your servlet container will already have an XSLT processor built in, and it's easy to get classloader mixups if you try to use a different one.

DrClapa at 2007-7-12 3:01:33 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

I did that. I created a simple class:

...

try{

XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

} catch(SAXException se){

System.out.println(se);

}

....

and it works find on Windows. When I run it on AIX server, I am getting:

Exception in thread "main" java.lang.VerifyError: (class: org/apache/xalan/xpath/xdom/XercesLiaison, method: parse signature: (Lorg/xml/sax/InputSource;)V) Incompatible object argument for method call

at java.lang.Class.forName1(Native Method)

at java.lang.Class.forName(Class.java:180)

at org.apache.xalan.xslt.XSLTEngineImpl.<init>(XSLTEngineImpl.java:360)

at org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(XSLTProcessorFactory.java:79)

at Test.main(Test.java:14)

How can I remove the hardcoded reference to Xalan?

Thanks

dragosionela at 2007-7-12 3:01:33 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
> How can I remove the hardcoded reference to Xalan?I'm not sure. What's an XSLTProcessor? I would toss that out and write code that (as I said) uses standard JAXP classes. Like TransformerFactor, Transformer, and so on.
DrClapa at 2007-7-12 3:01:33 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

I found the cause.

xalan.jar contains the class org.xml.sax.InputSource

xml.jar (that comes with jdk 1.4 for AIX) has also this class and because it it loaded first, when I run the code:

XSLTProcessorFactory.getProcessor()

it is trying to use it.

I tried to remove xml.jar and even to remove the InputSource from the jar but then the WebLogic server is complaining when using this class from the xalan.jar

Unfortunately, using the old version of xalan.jar is a requirement :(

dragosionela at 2007-7-12 3:01:33 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...