You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Karr, David" <da...@wamu.net> on 2007/11/08 23:42:52 UTC

Xslt in build.xml when run from other dir from maven gets "Provider for javax.xml.transform.TransformerFactory cannot be found"

JDK 1.4.2, Ant 1.5, Maven 1.0.2.

I developed an Ant script that uses an xslt task.  I tested it in the
directory where I put it, and it works fine.

I then went to another directory tree managed by maven, and executed
some code in my "maven.xml" in a subproject that calls "ant:ant" and
calls my build script from the other directory.  When I do this, I get:

	Provider for javax.xml.transform.TransformerFactory cannot be
found

I read some notes that indicated that I need to copy "xalan.jar" to
$ANT_HOME/lib.  I don't have it there already, but I do have
"xml-apis.jar" and "weblogic.jar".

In any case, why does it work directly from the command line in the main
directory, but fail with that exception when called from maven in the
other directory?

Before I implemented the reference to the "xslt" task, the build script
previously used the "xmltask" library to do the same thing, and that
worked well enough, both directly in the build script directory and
remotely using maven.  I'm trying to get it to work with XSLT because
the xmltask solution gets OutOfMemory exceptions for some of the larger
test cases.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Xslt in build.xml when run from other dir from maven gets "Provider for javax.xml.transform.TransformerFactory cannot be found"

Posted by Lukas Theussl <lt...@apache.org>.
The property is set with system scope, you should only have to set it once.

The other possibility is the lib/endorsed dir.

Or you can define your own tag library with a tag to do the xslt 
transformation, see eg [1]. In m1  this is the cleanest way to define 
blocks of repeatable code.

In any case, setting it in the ant script won't work.

-Lukas

[1] http://osdir.com/ml/jakarta.turbine.maven.user/2003-01/msg00651.html


Karr, David wrote:
>>-----Original Message-----
>>From: Lukas Theussl [mailto:ltheussl@apache.org] 
>>Sent: Thursday, November 08, 2007 7:38 PM
>>To: Maven Users List
>>Subject: Re: Xslt in build.xml when run from other dir from 
>>maven gets "Provider for 
>>javax.xml.transform.TransformerFactory cannot be found"
>>
>>As far as I can tell from your description, this has nothing 
>>to do with different directories. Just calling ant from maven 
>>is not the same as running ant directly, - classpaths are 
>>different. One solution is to put xalan into 
>>$MAVEN_HOME/lib/endorsed, for the other (prefered), see this FAQ [1].
> 
> 
> Ok, setting that system property works, the way it's described in the
> FAQ.  Is it possible to put that setting into the Ant script, and not
> the Maven script?  That Ant target will have to be called from several
> Maven subprojects, and I'd like to reduce the required boilerplate code.
> I tried using "sysproperty" in the Ant script, but it didn't have any
> effect.
> 
> 
>>Btw, any reason for not using maven 1.1? It's mostly backward 
>>compatible with m1.0.2 [2] and much improved in terms of performance.
> 
> 
> Good to hear.  I don't control our upgrade paths, but I'll mention those
> two points.
> 
> 
>>Karr, David wrote:
>>
>>>JDK 1.4.2, Ant 1.5, Maven 1.0.2.
>>>
>>>I developed an Ant script that uses an xslt task.  I tested 
>>
>>it in the 
>>
>>>directory where I put it, and it works fine.
>>>
>>>I then went to another directory tree managed by maven, and 
>>
>>executed 
>>
>>>some code in my "maven.xml" in a subproject that calls 
>>
>>"ant:ant" and 
>>
>>>calls my build script from the other directory.  When I do 
>>
>>this, I get:
>>
>>>	Provider for javax.xml.transform.TransformerFactory 
>>
>>cannot be found
>>
>>>I read some notes that indicated that I need to copy "xalan.jar" to 
>>>$ANT_HOME/lib.  I don't have it there already, but I do have 
>>>"xml-apis.jar" and "weblogic.jar".
>>>
>>>In any case, why does it work directly from the command line in the 
>>>main directory, but fail with that exception when called 
>>
>>from maven in 
>>
>>>the other directory?
>>>
>>>Before I implemented the reference to the "xslt" task, the build 
>>>script previously used the "xmltask" library to do the same 
>>
>>thing, and 
>>
>>>that worked well enough, both directly in the build script 
>>
>>directory 
>>
>>>and remotely using maven.  I'm trying to get it to work with XSLT 
>>>because the xmltask solution gets OutOfMemory exceptions 
>>
>>for some of 
>>
>>>the larger test cases.
>>>
>>>
>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Xslt in build.xml when run from other dir from maven gets "Provider for javax.xml.transform.TransformerFactory cannot be found"

Posted by "Karr, David" <da...@wamu.net>.
> -----Original Message-----
> From: Lukas Theussl [mailto:ltheussl@apache.org] 
> Sent: Thursday, November 08, 2007 7:38 PM
> To: Maven Users List
> Subject: Re: Xslt in build.xml when run from other dir from 
> maven gets "Provider for 
> javax.xml.transform.TransformerFactory cannot be found"
> 
> As far as I can tell from your description, this has nothing 
> to do with different directories. Just calling ant from maven 
> is not the same as running ant directly, - classpaths are 
> different. One solution is to put xalan into 
> $MAVEN_HOME/lib/endorsed, for the other (prefered), see this FAQ [1].

Ok, setting that system property works, the way it's described in the
FAQ.  Is it possible to put that setting into the Ant script, and not
the Maven script?  That Ant target will have to be called from several
Maven subprojects, and I'd like to reduce the required boilerplate code.
I tried using "sysproperty" in the Ant script, but it didn't have any
effect.

> Btw, any reason for not using maven 1.1? It's mostly backward 
> compatible with m1.0.2 [2] and much improved in terms of performance.

Good to hear.  I don't control our upgrade paths, but I'll mention those
two points.

> Karr, David wrote:
> > JDK 1.4.2, Ant 1.5, Maven 1.0.2.
> > 
> > I developed an Ant script that uses an xslt task.  I tested 
> it in the 
> > directory where I put it, and it works fine.
> > 
> > I then went to another directory tree managed by maven, and 
> executed 
> > some code in my "maven.xml" in a subproject that calls 
> "ant:ant" and 
> > calls my build script from the other directory.  When I do 
> this, I get:
> > 
> > 	Provider for javax.xml.transform.TransformerFactory 
> cannot be found
> > 
> > I read some notes that indicated that I need to copy "xalan.jar" to 
> > $ANT_HOME/lib.  I don't have it there already, but I do have 
> > "xml-apis.jar" and "weblogic.jar".
> > 
> > In any case, why does it work directly from the command line in the 
> > main directory, but fail with that exception when called 
> from maven in 
> > the other directory?
> > 
> > Before I implemented the reference to the "xslt" task, the build 
> > script previously used the "xmltask" library to do the same 
> thing, and 
> > that worked well enough, both directly in the build script 
> directory 
> > and remotely using maven.  I'm trying to get it to work with XSLT 
> > because the xmltask solution gets OutOfMemory exceptions 
> for some of 
> > the larger test cases.
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Xslt in build.xml when run from other dir from maven gets "Provider for javax.xml.transform.TransformerFactory cannot be found"

Posted by Lukas Theussl <lt...@apache.org>.
As far as I can tell from your description, this has nothing to do with 
different directories. Just calling ant from maven is not the same as 
running ant directly, - classpaths are different. One solution is to put 
xalan into $MAVEN_HOME/lib/endorsed, for the other (prefered), see this 
FAQ [1].

Btw, any reason for not using maven 1.1? It's mostly backward compatible 
with m1.0.2 [2] and much improved in terms of performance.

HTH,
-Lukas

[1] http://maven.apache.org/maven-1.x/faq.html#BadXSLT
[2] http://maven.apache.org/maven-1.x/reference/backwards-compatibility.html


Karr, David wrote:
> JDK 1.4.2, Ant 1.5, Maven 1.0.2.
> 
> I developed an Ant script that uses an xslt task.  I tested it in the
> directory where I put it, and it works fine.
> 
> I then went to another directory tree managed by maven, and executed
> some code in my "maven.xml" in a subproject that calls "ant:ant" and
> calls my build script from the other directory.  When I do this, I get:
> 
> 	Provider for javax.xml.transform.TransformerFactory cannot be
> found
> 
> I read some notes that indicated that I need to copy "xalan.jar" to
> $ANT_HOME/lib.  I don't have it there already, but I do have
> "xml-apis.jar" and "weblogic.jar".
> 
> In any case, why does it work directly from the command line in the main
> directory, but fail with that exception when called from maven in the
> other directory?
> 
> Before I implemented the reference to the "xslt" task, the build script
> previously used the "xmltask" library to do the same thing, and that
> worked well enough, both directly in the build script directory and
> remotely using maven.  I'm trying to get it to work with XSLT because
> the xmltask solution gets OutOfMemory exceptions for some of the larger
> test cases.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org