You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Wout Neirynck <wo...@ictportal.com> on 2002/03/20 15:44:54 UTC
IllegalAccessException when using Java in XSLT
Hi all,
I've written a servlet that generates HTML using XML/XSLT. The XSL pages
are using extra parameters that are passed on by the servlet (the http
request, the http response and the session). But when I want to access
these objects from within the XSL file using the Java extension stuff
provided by Xalan, Tomcat always gives me an "IllegalAccessException".
The whole web-app works perfecly fine using the commercial web-container
JRun, so I don't think the problem lies with the Java code. It can't be a
problem of the classes or their members not being public, since they're
standard servlet classes, and they're perfectly accessible from within the
servlet itself.
Some version numbers:
- Java JDK 1.3.1
- Tomcat 3.3a
- Xalan 2.1.0
- Windows NT 4.0
Here's a sample of the XSLT I'm using to access the session:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java">
<xsl:output method="html" omit-xml-declaration="yes"/>
<!-- The session, passed on by the servlet -->
<xsl:param name="session"/>
<xsl:template match="/">
<!-- Set the "userId" attribute in the session -->
<xsl:value-of select="java:setAttribute($session,'userId','some value')"/>
</xsl:template>
</xsl:stylesheet>
And a piece of the stack trace:
java.lang.IllegalAccessException
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:375)
at
org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:253)
at
org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:141)
at org.apache.xpath.XPath.execute(XPath.java:260)
at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:251)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2251)
at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2134)
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1246)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:504)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1174)
Once again, the whole app works perfectly using JRun (same Java, same
Xalan, etc...), so I don't think it's got to do with the XSLT or my
servlet. If anyone knows how to solve this problem, I'd appreciate it if
they'd help me out!
Thanks in advance,
Wout Neirynck
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>