You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Vl...@mapinfo.com on 2002/05/06 19:47:10 UTC
java extensions
Hi all,
Probably you can help me in the following question...
I used a java extensions in xsl stylesheet. The declaration of extension is
a very standard:
<xsl:stylesheet ... xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java">
...
<xsl:variable name="debug" select="java:<my class>.printDebugInfo()"/>
...
<xsl:value-of select="$debug"/>
On trying to call this method (it's a static) I get ClassNotFoundException.
java.lang.ClassNotFoundException: <my class>
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at
org.apache.xalan.extensions.ExtensionHandler.getClassForName(ExtensionHandler.java:137)
at
org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:327)
at
org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:257)
I used servlet that prepares xml and calls transformation. <my class> is in
the same packadge as a servlet.
However it works fine on Windows but it doesn't on Unix...
Any ideas?
Thanks in advance.
Best regards,
Vladimir Vinogradov
RE: java extensions
Posted by Gary L Peskin <ga...@firstech.com>.
Xalan could not find your class. The class loader used to load
extensions is the current thread's ContextClassLoader. It is highly
possible that your Unix servlet container is not properly setting the
thread's ContextClassLoader. It looks from your stack trace like the
default Sun class loader is being invoked in this case. Try adding the
class' location to your CLASSPATH environment variable and see if that
fixes it.
If so, this is the problem. I suggest you look into the servlet
container's documentation which should reveal its classloading strategy.
What servlet container are you using on Windows, Unix?
Gary
> -----Original Message-----
> From: Vladimir_Vinogradov@mapinfo.com
> [mailto:Vladimir_Vinogradov@mapinfo.com]
> Sent: Monday, May 06, 2002 10:47 AM
> To: xalan-j-users@xml.apache.org
> Subject: java extensions
>
>
> Hi all,
>
> Probably you can help me in the following question...
> I used a java extensions in xsl stylesheet. The declaration
> of extension is a very standard:
>
> <xsl:stylesheet ... xmlns:java="http://xml.apache.org/xslt/java"
> exclude-result-prefixes="java">
> ...
> <xsl:variable name="debug" select="java:<my
> class>.printDebugInfo()"/> ... <xsl:value-of select="$debug"/>
>
> On trying to call this method (it's a static) I get
> ClassNotFoundException.
>
> java.lang.ClassNotFoundException: <my class>
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:120)
> at
> org.apache.xalan.extensions.ExtensionHandler.getClassForName(E
> xtensionHandler.java:137)
> at
> org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFu
> nction(ExtensionHandlerJavaPackage.java:327)
> at
> org.apache.xalan.extensions.ExtensionsTable.extFunction(Extens
> ionsTable.java:257)
>
> I used servlet that prepares xml and calls transformation.
> <my class> is in the same packadge as a servlet. However it
> works fine on Windows but it doesn't on Unix...
>
> Any ideas?
>
> Thanks in advance.
>
> Best regards,
> Vladimir Vinogradov
>
>