You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bsf-dev@jakarta.apache.org by "Rony G. Flatscher" <Ro...@wu-wien.ac.at> on 2006/09/12 17:14:30 UTC
Ad xslt-sample (not working on Java 1.5 & 1.6) ...
Hi there,
running the xslt sample under Java 1.3 (using Xalan) and Java 1.4 (out
of the box) works flawlessly.
Yet, if running it with 1.5 (and 1.6beta for tha tmatter) yields the
following exception:
--------------- cut here -----------------
F:\work\svn\bsf\samples\xsl>java TableFiller style1.xsl table-data.xml
ERROR: 'The first argument to the non-static Java function 'add' is not a valid object reference.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Transfor
merFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Transf
ormerFactoryImpl.java:619)
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:132)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
Sep 12, 2006 5:07:00 PM org.apache.bsf.BSFManager exec
SEVERE: Exception :
java.security.PrivilegedActionException: org.apache.bsf.BSFException: Exception from Xerces XSLT: ja
vax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
Caused by: org.apache.bsf.BSFException: Exception from Xerces XSLT: javax.xml.transform.TransformerC
onfigurationException: Could not compile stylesheet
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:135)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
... 3 more
Exception in thread "main" org.apache.bsf.BSFException: Exception from Xerces XSLT: javax.xml.transf
orm.TransformerConfigurationException: Could not compile stylesheet
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:135)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
--------------- cut here -----------------
Would anyone have an idea what the error might be ?
Here is the stylesheet "style1.xsl":
--------------- cut here -----------------
<?xml version='1.0'?>
<!-- This stylesheet fills in the data by sorting on the first name. -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
version="1.0">
<!-- get access to the panel -->
<xsl:param name="panel"/>
<xsl:template match="data">
<xsl:apply-templates select="person">
<xsl:sort select="@first"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="person">
<xsl:variable name="junk1" select="java:add ($panel, java:java.awt.Label.new (string(@first)))"/>
<xsl:variable name="junk2" select="java:add ($panel, java:java.awt.Label.new (string(@last)))"/>
</xsl:template>
</xsl:stylesheet>
--------------- cut here -----------------
Here is the datafile "table-data.xml":
--------------- cut here -----------------
<?xml version="1.0"?>
<data>
<person first="Sanjiva" last="Weerawarana"/>
<person first="Matt" last="Duftler"/>
<person first="Paco" last="Curbera"/>
<person first="Sam" last="Ruby"/>
<person first="Stephen" last="Boies"/>
</data>
--------------- cut here -----------------
Running it with:
java TableFiller style1.xsl table-data.xml
yields the exception above; again only under 1.5 and 1.6.
Any hints appreciated!
Regards,
---rony
Re: Ad xslt-sample (not working on Java 1.5 & 1.6) ...
Posted by "Rony G. Flatscher" <Ro...@wu-wien.ac.at>.
Hi there,
just a short follow-up.
Rony G. Flatscher wrote:
> Anthony Elder wrote:
>
>> fwiw, i also get this on Sun JDK 1.5 but it works fine on IBMs JDK 1.5.
>> Also, having Xalan 2.7 in the Sun JDK 1.5 endorsed directory fixes the
>> problem.
>>
>>
> thank you very much for this hint!
>
> In the meantime I managed to get a hold of Xalan 2.7 (at the moment 2.8
> is the latest version). Created the "endorsed" directory in
> "...\jre\lib\endorsed" and copied the Xalan 2.7 files into it. The
> sample works again!
>
> Also, after experimenting with Xalan 2.8 (jars from
> 'Xerces-J-bin.2.8.1.zip') it did not work initially, but after
> extracting "xalan.jar" from 'Xerces-J-tools.2.8.1.zip' and copying it
> into the 'endorsed' directory solves the problem of not finding
> 'org.apache.xalan.processor.TransformerFactoryImpl'.
>
> Kudos to you (works on Java 1.5 and 1.6 again)!
>
got a chance to test this further: it seems that on Sun's Java 1.5 and
1.6 distribution the classes of "xalan.jar" are missing. Just copying
that jar from the Xalan distribution to the "endorsed" directories of
Java 1.5, 1.6, resolves the issue.
Regards,
---rony
Re: Ad xslt-sample (not working on Java 1.5 & 1.6) ...
Posted by "Rony G. Flatscher" <Ro...@wu-wien.ac.at>.
Hi Anthony,
Anthony Elder wrote:
> fwiw, i also get this on Sun JDK 1.5 but it works fine on IBMs JDK 1.5.
> Also, having Xalan 2.7 in the Sun JDK 1.5 endorsed directory fixes the
> problem.
>
thank you very much for this hint!
In the meantime I managed to get a hold of Xalan 2.7 (at the moment 2.8
is the latest version). Created the "endorsed" directory in
"...\jre\lib\endorsed" and copied the Xalan 2.7 files into it. The
sample works again!
Also, after experimenting with Xalan 2.8 (jars from
'Xerces-J-bin.2.8.1.zip') it did not work initially, but after
extracting "xalan.jar" from 'Xerces-J-tools.2.8.1.zip' and copying it
into the 'endorsed' directory solves the problem of not finding
'org.apache.xalan.processor.TransformerFactoryImpl'.
Kudos to you (works on Java 1.5 and 1.6 again)!
Regards,
---rony
---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org
Re: Ad xslt-sample (not working on Java 1.5 & 1.6) ...
Posted by Anthony Elder <an...@uk.ibm.com>.
fwiw, i also get this on Sun JDK 1.5 but it works fine on IBMs JDK 1.5.
Also, having Xalan 2.7 in the Sun JDK 1.5 endorsed directory fixes the
problem.
...ant
"Rony G. Flatscher" <Ro...@wu-wien.ac.at> on 12/09/2006 16:14:30
Please respond to "Bean Scripting Framework developers"
<bs...@jakarta.apache.org>
To: Bean Scripting Framework developers <bs...@jakarta.apache.org>
cc:
Subject: Ad xslt-sample (not working on Java 1.5 & 1.6) ...
Hi there,
running the xslt sample under Java 1.3 (using Xalan) and Java 1.4 (out
of the box) works flawlessly.
Yet, if running it with 1.5 (and 1.6beta for tha tmatter) yields the
following exception:
--------------- cut here -----------------
F:\work\svn\bsf\samples\xsl>java TableFiller style1.xsl table-data.xml
ERROR: 'The first argument to the non-static Java function 'add' is not a
valid object reference.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile
stylesheet
at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Transfor
merFactoryImpl.java:824)
at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Transf
ormerFactoryImpl.java:619)
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:132)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
Sep 12, 2006 5:07:00 PM org.apache.bsf.BSFManager exec
SEVERE: Exception :
java.security.PrivilegedActionException: org.apache.bsf.BSFException:
Exception from Xerces XSLT: ja
vax.xml.transform.TransformerConfigurationException: Could not compile
stylesheet
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
Caused by: org.apache.bsf.BSFException: Exception from Xerces XSLT:
javax.xml.transform.TransformerC
onfigurationException: Could not compile stylesheet
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:135)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
... 3 more
Exception in thread "main" org.apache.bsf.BSFException: Exception from
Xerces XSLT: javax.xml.transf
orm.TransformerConfigurationException: Could not compile stylesheet
at org.apache.bsf.engines.xslt.XSLTEngine.eval(XSLTEngine.java:135)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:177)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:518)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.bsf.BSFManager.exec(BSFManager.java:516)
at TableFiller.main(TableFiller.java:48)
--------------- cut here -----------------
Would anyone have an idea what the error might be ?
Here is the stylesheet "style1.xsl":
--------------- cut here -----------------
<?xml version='1.0'?>
<!-- This stylesheet fills in the data by sorting on the first name. -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
version="1.0">
<!-- get access to the panel -->
<xsl:param name="panel"/>
<xsl:template match="data">
<xsl:apply-templates select="person">
<xsl:sort select="@first"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="person">
<xsl:variable name="junk1" select="java:add ($panel,
java:java.awt.Label.new (string(@first)))"/>
<xsl:variable name="junk2" select="java:add ($panel,
java:java.awt.Label.new (string(@last)))"/>
</xsl:template>
</xsl:stylesheet>
--------------- cut here -----------------
Here is the datafile "table-data.xml":
--------------- cut here -----------------
<?xml version="1.0"?>
<data>
<person first="Sanjiva" last="Weerawarana"/>
<person first="Matt" last="Duftler"/>
<person first="Paco" last="Curbera"/>
<person first="Sam" last="Ruby"/>
<person first="Stephen" last="Boies"/>
</data>
--------------- cut here -----------------
Running it with:
java TableFiller style1.xsl table-data.xml
yields the exception above; again only under 1.5 and 1.6.
Any hints appreciated!
Regards,
---rony
---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org