xsl-list
[Top] [All Lists]

Re: [xsl] Issues with Classpath : Linux debian

2007-03-11 10:20:17
On 3/9/07, Joshua Perrymon <josh(_at_)packetfocus(_dot_)com> wrote:
CLASSPATH=/projects/nmap-XSL/xerces-2_9_0/resolver.jar:/projects/nmap-XSL/xe
rces-2_9_0/xercesImpl.jar:/projects/nmap-XSL/xerces-2_9_0/xercesSamples.jar:
/projects/nmap-XSL/xerces-2_9_0/xml-apis.jar:/projects/nmap-XSL/xerces-2_9_0
/serializer.jar

I tried running this command:  /usr/local/jdk1.6.0/bin/java
org.apache.xalan.xslt.Process and got the error below?

hacker(_at_)mothership:/projects/nmap-XSL/xerces-2_9_0$
/usr/local/jdk1.6.0/bin/java org.apache.xalan.xslt.Process Exception in
thread "main" java.lang.NoClassDefFoundError: org/apache/xalan/xslt/Process

From the error message, it seems the class
org.apache.xalan.xslt.Process is not found in the system classpath.

Are you trying to run Xalan, which is bundled with JDK 1.6.0? If yes,
then the entry point to JDK Xalan has changed (JDK 1.6.0 docs say,
this changed since J2SE 1.4). The path to Process class in JDK 1.6.0
is com.sun.org.apache.xalan.internal.xslt.Process. But IIRC, there is
a bug in JDK (since V 1.4) related to Xalan which is bundled in it.

Here is how, you can quickly check this.

Try to run Xalan, which is bundled with JDK 1.6.0 as following:
java com.sun.org.apache.xalan.internal.xslt.Process

The message displayed is:
Exception in thread "main" java.lang.NoSuchMethodError: main

This means, the Process class is found by the JVM. But there is no
"main" method in it.

Now run this command:

javap com.sun.org.apache.xalan.internal.xslt.Process

The output produced is:

Compiled from "Process.java"
public class com.sun.org.apache.xalan.internal.xslt.Process extends java.lang.Ob
ject{
   public com.sun.org.apache.xalan.internal.xslt.Process();
   protected static void printArgOptions(java.util.ResourceBundle);
   public static void _main(java.lang.String[]);
   static void doExit(java.lang.String);
}

This is the signature of Process class. It shows that the "main"
method is actually designed as,
_main

This is actually a bug. The last time I checked the JDK bug database,
Sun had marked this bug as, "won't fix".

So what is the workaround to this problem?

I think, it is not a good idea to use the Xalan bundled with JDK.
Inspite of the above problem with "main" method, you can easily write
a wrapper class to invoke Process class's _main method (if you want to
use JDK's Xalan from command line).

Also, as of today, the Apache team has made many enhancements and bug
fixes in Xalan, which are not present in JDK's Xalan. So it's a good
idea that you download latest Xalan build from
http://xml.apache.org/xalan-j/, and put the Xalan JAR in the
classpath.

Hope this has helped.

--
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [xsl] Issues with Classpath : Linux debian, Mukul Gandhi <=