You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Jukka Zitting <ju...@zitting.name> on 2005/01/09 16:52:22 UTC

Problem with JDK 1.5 and XSLT (Was: Build fails)

Hi all,

<summary>
Place xalan.jar in $MAVEN_HOME/lib/endorsed to build the latest (since 
2004-12-22) Jackrabbit sources with JDK 1.5.
</summary>

Below is a description of the details of the problem. I hope someone 
finds this useful.

I ran into the same problem as Oliver Kiessler after updating my source 
tree. I'd like to keep using JDK 1.5, so I first traced the problem to 
the following lines in maven.xml (line breaks added for clarity):

<!-- The following is a hack to get xslt work with maven
      (See: http://maven.apache.org/faq.html#BadXSLT ) -->
${systemScope.setProperty(
      'javax.xml.transform.TransformerFactory',
      'org.apache.xalan.processor.TransformerFactoryImpl')}

The JavaCC grammar in src/grammar/xpath makes heavy use of XSLT, and the 
following ant:xslt entries in maven.xml handle the transformations:

       <ant:xslt style="src/grammar/xpath/strip.xsl"
              in="src/grammar/xpath/xpath-grammar.xml"
              out="src/grammar/xpath/stripped-xpath-grammar.xml"
              force="yes">
       </ant:xslt>
       <ant:xslt style="src/grammar/xpath/jjtree-jackrabbit.xsl"
              in="src/grammar/xpath/stripped-xpath-grammar.xml"
              out="src/grammar/xpath/XPath.jjt"
              force="yes">
       </ant:xslt>

The systemScope.setProperty() hack is needed to make the ant:xslt task 
work properly with Maven (see [1]). However, as mentioned in the 
comments of the associated bug entry [2], this hack doesn't work with 
JDK 1.5 that uses the new Xalan XSLTC compiler at 
com.sum.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.

Unfortunately the problem could not be solved by simply changing the 
systemScope.setProperty() line because the XSLTC version bundled with 
JDK 1.5 has problems with named templates (probably bug [3]). Instead of 
the "provider not found" errors from ant:xslt, I now received 
NoSuchMethodError exceptions from XSLTC.

As an alternative solution, I then downloaded the normal Xalan binaries 
and placed xalan.jar in $MAVEN_HOME/lib/endorsed. I was then able to run 
maven jar without problems. Note that the library needs to be placed in 
lib/endorsed instead of just lib to make the Xalan classes visible for 
the ant:xslt task.

Although this solution is a bit of a hack, I don't think a better one is 
possible until either the Maven problem gets solved or the JDK XSLTC 
gets fixed.

BR,

Jukka Zitting

[1] http://maven.apache.org/faq.html#BadXSLT
[2] http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-156
[3] http://issues.apache.org/jira/browse/XALANJ-1994

Oliver Kiessler wrote:
> you are right, it's a jdk issue. with 1.4.2 it builds fine.
> thanks, oliver
> 
> On Tue, 4 Jan 2005 13:44:16 +0100, Tobias Strasser
> <to...@gmail.com> wrote:
> 
>>just a wild guess: try with a jdk 1.4.2
>>cheers, tobi
>>
>>
>>On Tue, 4 Jan 2005 12:59:09 +0100, Oliver Kiessler
>><ol...@gmail.com> wrote:
>>
>>>hi everybody,
>>>I just updated jackrabbit (with svn up) and tried to build a jar with
>>>"maven clean jar" and got the following error:
>>>
>>>[okr@localhost jackrabbit]$ maven clean jar
>>> __  __
>>>|  \/  |__ _Apache__ ___
>>>| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
>>>|_|  |_\__,_|\_/\___|_||_|  v. 1.0
>>>
>>>Attempting to download javacc-3.2.jar.
>>>369K downloaded
>>>Attempting to download cqfs-jackrabbit-3.5.6.jar.
>>>9K downloaded
>>>Attempting to download cqfs-3.5.6.jar.
>>>75K downloaded
>>>Attempting to download commons-logging-1.0.jar.
>>>21K downloaded
>>>Plugin 'maven-deploy-plugin' in project 'Jackrabbit' is not available
>>>build:start:
>>>
>>>clean:clean:
>>>    [delete] Deleting directory /home/okr/src/jackrabbit/target
>>>
>>>clean:
>>>test:clean:
>>>    [delete] Deleting directory
>>>/home/okr/src/jackrabbit/applications/test/repository
>>>    [delete] Deleting directory /home/okr/src/jackrabbit/applications/test/tx
>>>    [delete] Deleting directory
>>>/home/okr/src/jackrabbit/applications/test/workspaces
>>>
>>>java:prepare-filesystem:
>>>    [mkdir] Created dir: /home/okr/src/jackrabbit/target/classes
>>>jackrabbit:generate-parsers:
>>>    [java] Java Compiler Compiler Version 3.2 (Tree Builder)
>>>    [java] (type "jjtree" with no arguments for help)
>>>    [java] Reading from file src/grammar/sql/JCRSQL.jjt . . .
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/Node.java" does not
>>>exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/SimpleNode.java" does
>>>not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTQuery.java" does
>>>not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTSelectList.java"
>>>does not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTFromClause.java"
>>>does not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTWhereClause.java"
>>>does not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTOrExpression.java"
>>>does not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTAndExpression.java"
>>>does not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTNotExpression.java"
>>>does not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTBracketExpression.java"
>>>does not exist.  Will create one.
>>>    [java] File
>>>"src/java/org/apache/jackrabbit/core/search/sql/ASTOrderByClause.java"
>>>does not exist.  Will create one.
>>>    [java] Annotated grammar generated successfully in
>>>src/java/org/apache/jackrabbit/core/search/sql/JCRSQL.jj
>>>    [java] Java Compiler Compiler Version 3.2 (Parser Generator)
>>>    [java] (type "javacc" with no arguments for help)
>>>    [java] Reading from file
>>>src/java/org/apache/jackrabbit/core/search/sql/JCRSQL.jj . . .
>>>    [java] Note: UNICODE_INPUT option is specified. Please make sure
>>>you create the parser/lexer usig a Reader with the correct character
>>>encoding.
>>>    [java] File "TokenMgrError.java" does not exist.  Will create one.
>>>    [java] File "ParseException.java" does not exist.  Will create one.
>>>    [java] File "Token.java" does not exist.  Will create one.
>>>    [java] File "SimpleCharStream.java" does not exist.  Will create one.
>>>    [java] Parser generated successfully.
>>>
>>>          [xslt] Processing
>>>/home/okr/src/jackrabbit/src/grammar/xpath/xpath-grammar.xml to
>>>/home/okr/src/jackrabbit/src/grammar/xpath/stripped-xpath-grammar.xml
>>>    [xslt] Loading stylesheet
>>>/home/okr/src/jackrabbit/src/grammar/xpath/strip.xsl
>>>
>>>BUILD FAILED
>>>File...... /home/okr/src/jackrabbit/maven.xml
>>>Element... ant:xslt
>>>Line...... 97
>>>Column.... 26
>>>Provider org.apache.xalan.processor.TransformerFactoryImpl not found
>>>Total time: 15 seconds
>>>Finished at: Tue Jan 04 12:55:37 CET 2005
>>>
>>>My platform is Fedora Core 3, Linux localhost.localdomain
>>>2.6.9-1.724_FC3 #1 Sun Jan 2 15:43:49 EST 2005 i686 i686 i386
>>>GNU/Linux, my java version: java version "1.5.0_01"
>>>Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
>>>Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)
>>>
>>>thanks,
>>>oliver
>>>
>>
>>
>>--
>>------------------------------------------< tobias.strasser@day.com >---
>>Tobias Strasser, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
>>T +41 61 226 98 98, F +41 61 226 98 97
>>-----------------------------------------------< http://www.day.com >---
>>


Re: Problem with JDK 1.5 and XSLT (Was: Build fails)

Posted by Stefan Guggisberg <st...@gmail.com>.
hi jukka,

On Sun, 09 Jan 2005 17:52:22 +0200, Jukka Zitting <ju...@zitting.name> wrote:
> Hi all,
> 
> <summary>
> Place xalan.jar in $MAVEN_HOME/lib/endorsed to build the latest (since
> 2004-12-22) Jackrabbit sources with JDK 1.5.
> </summary>
> 
> Below is a description of the details of the problem. I hope someone
> finds this useful.

thanks, this information is indeed very usefull and appreciated!

cheers
stefan

> 
> I ran into the same problem as Oliver Kiessler after updating my source
> tree. I'd like to keep using JDK 1.5, so I first traced the problem to
> the following lines in maven.xml (line breaks added for clarity):
> 
> <!-- The following is a hack to get xslt work with maven
>       (See: http://maven.apache.org/faq.html#BadXSLT ) -->
> ${systemScope.setProperty(
>       'javax.xml.transform.TransformerFactory',
>       'org.apache.xalan.processor.TransformerFactoryImpl')}
> 
> The JavaCC grammar in src/grammar/xpath makes heavy use of XSLT, and the
> following ant:xslt entries in maven.xml handle the transformations:
> 
>        <ant:xslt style="src/grammar/xpath/strip.xsl"
>               in="src/grammar/xpath/xpath-grammar.xml"
>               out="src/grammar/xpath/stripped-xpath-grammar.xml"
>               force="yes">
>        </ant:xslt>
>        <ant:xslt style="src/grammar/xpath/jjtree-jackrabbit.xsl"
>               in="src/grammar/xpath/stripped-xpath-grammar.xml"
>               out="src/grammar/xpath/XPath.jjt"
>               force="yes">
>        </ant:xslt>
> 
> The systemScope.setProperty() hack is needed to make the ant:xslt task
> work properly with Maven (see [1]). However, as mentioned in the
> comments of the associated bug entry [2], this hack doesn't work with
> JDK 1.5 that uses the new Xalan XSLTC compiler at
> com.sum.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.
> 
> Unfortunately the problem could not be solved by simply changing the
> systemScope.setProperty() line because the XSLTC version bundled with
> JDK 1.5 has problems with named templates (probably bug [3]). Instead of
> the "provider not found" errors from ant:xslt, I now received
> NoSuchMethodError exceptions from XSLTC.
> 
> As an alternative solution, I then downloaded the normal Xalan binaries
> and placed xalan.jar in $MAVEN_HOME/lib/endorsed. I was then able to run
> maven jar without problems. Note that the library needs to be placed in
> lib/endorsed instead of just lib to make the Xalan classes visible for
> the ant:xslt task.
> 
> Although this solution is a bit of a hack, I don't think a better one is
> possible until either the Maven problem gets solved or the JDK XSLTC
> gets fixed.
> 
> BR,
> 
> Jukka Zitting
> 
> [1] http://maven.apache.org/faq.html#BadXSLT
> [2] http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-156
> [3] http://issues.apache.org/jira/browse/XALANJ-1994
> 
> Oliver Kiessler wrote:
> > you are right, it's a jdk issue. with 1.4.2 it builds fine.
> > thanks, oliver
> >
> > On Tue, 4 Jan 2005 13:44:16 +0100, Tobias Strasser
> > <to...@gmail.com> wrote:
> >
> >>just a wild guess: try with a jdk 1.4.2
> >>cheers, tobi
> >>
> >>
> >>On Tue, 4 Jan 2005 12:59:09 +0100, Oliver Kiessler
> >><ol...@gmail.com> wrote:
> >>
> >>>hi everybody,
> >>>I just updated jackrabbit (with svn up) and tried to build a jar with
> >>>"maven clean jar" and got the following error:
> >>>
> >>>[okr@localhost jackrabbit]$ maven clean jar
> >>> __  __
> >>>|  \/  |__ _Apache__ ___
> >>>| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> >>>|_|  |_\__,_|\_/\___|_||_|  v. 1.0
> >>>
> >>>Attempting to download javacc-3.2.jar.
> >>>369K downloaded
> >>>Attempting to download cqfs-jackrabbit-3.5.6.jar.
> >>>9K downloaded
> >>>Attempting to download cqfs-3.5.6.jar.
> >>>75K downloaded
> >>>Attempting to download commons-logging-1.0.jar.
> >>>21K downloaded
> >>>Plugin 'maven-deploy-plugin' in project 'Jackrabbit' is not available
> >>>build:start:
> >>>
> >>>clean:clean:
> >>>    [delete] Deleting directory /home/okr/src/jackrabbit/target
> >>>
> >>>clean:
> >>>test:clean:
> >>>    [delete] Deleting directory
> >>>/home/okr/src/jackrabbit/applications/test/repository
> >>>    [delete] Deleting directory /home/okr/src/jackrabbit/applications/test/tx
> >>>    [delete] Deleting directory
> >>>/home/okr/src/jackrabbit/applications/test/workspaces
> >>>
> >>>java:prepare-filesystem:
> >>>    [mkdir] Created dir: /home/okr/src/jackrabbit/target/classes
> >>>jackrabbit:generate-parsers:
> >>>    [java] Java Compiler Compiler Version 3.2 (Tree Builder)
> >>>    [java] (type "jjtree" with no arguments for help)
> >>>    [java] Reading from file src/grammar/sql/JCRSQL.jjt . . .
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/Node.java" does not
> >>>exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/SimpleNode.java" does
> >>>not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTQuery.java" does
> >>>not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTSelectList.java"
> >>>does not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTFromClause.java"
> >>>does not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTWhereClause.java"
> >>>does not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTOrExpression.java"
> >>>does not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTAndExpression.java"
> >>>does not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTNotExpression.java"
> >>>does not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTBracketExpression.java"
> >>>does not exist.  Will create one.
> >>>    [java] File
> >>>"src/java/org/apache/jackrabbit/core/search/sql/ASTOrderByClause.java"
> >>>does not exist.  Will create one.
> >>>    [java] Annotated grammar generated successfully in
> >>>src/java/org/apache/jackrabbit/core/search/sql/JCRSQL.jj
> >>>    [java] Java Compiler Compiler Version 3.2 (Parser Generator)
> >>>    [java] (type "javacc" with no arguments for help)
> >>>    [java] Reading from file
> >>>src/java/org/apache/jackrabbit/core/search/sql/JCRSQL.jj . . .
> >>>    [java] Note: UNICODE_INPUT option is specified. Please make sure
> >>>you create the parser/lexer usig a Reader with the correct character
> >>>encoding.
> >>>    [java] File "TokenMgrError.java" does not exist.  Will create one.
> >>>    [java] File "ParseException.java" does not exist.  Will create one.
> >>>    [java] File "Token.java" does not exist.  Will create one.
> >>>    [java] File "SimpleCharStream.java" does not exist.  Will create one.
> >>>    [java] Parser generated successfully.
> >>>
> >>>          [xslt] Processing
> >>>/home/okr/src/jackrabbit/src/grammar/xpath/xpath-grammar.xml to
> >>>/home/okr/src/jackrabbit/src/grammar/xpath/stripped-xpath-grammar.xml
> >>>    [xslt] Loading stylesheet
> >>>/home/okr/src/jackrabbit/src/grammar/xpath/strip.xsl
> >>>
> >>>BUILD FAILED
> >>>File...... /home/okr/src/jackrabbit/maven.xml
> >>>Element... ant:xslt
> >>>Line...... 97
> >>>Column.... 26
> >>>Provider org.apache.xalan.processor.TransformerFactoryImpl not found
> >>>Total time: 15 seconds
> >>>Finished at: Tue Jan 04 12:55:37 CET 2005
> >>>
> >>>My platform is Fedora Core 3, Linux localhost.localdomain
> >>>2.6.9-1.724_FC3 #1 Sun Jan 2 15:43:49 EST 2005 i686 i686 i386
> >>>GNU/Linux, my java version: java version "1.5.0_01"
> >>>Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
> >>>Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)
> >>>
> >>>thanks,
> >>>oliver
> >>>
> >>
> >>
> >>--
> >>------------------------------------------< tobias.strasser@day.com >---
> >>Tobias Strasser, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> >>T +41 61 226 98 98, F +41 61 226 98 97
> >>-----------------------------------------------< http://www.day.com >---
> >>
> 
>