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

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

JDK 1.4.2, Ant 1.5.4.

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


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

Posted by Steve Loughran <st...@apache.org>.
Karr, David wrote:
>> -----Original Message-----
>> From: Steve Loughran [mailto:stevel@apache.org] 
>> Sent: Friday, November 09, 2007 2:49 AM
>> To: Ant Users List
>> Subject: Re: Xslt when run from other dir from maven gets 
>> "Provider for javax.xml.transform.TransformerFactory cannot be found"
>>
>> Karr, David wrote:
>>> 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.
>> so does <xslt> on java5 with the bundled XSL engine. Try 
>> running Ant with more memory by setting ANT_OPTS to -DXmx256m
> 
> I tried setting ANT_OPTS all the way up to -Dxmx1536m, and it seemed to
> make no difference.  I wonder if this is some sort of infinite loop
> problem with xmltask.  I only saw it do it so far in one test case.  It
> completed for the others.
> 

1. There is this other bit of memory, PermGenHeapSpace, which can also 
lead to OOM exceptions, and it needs to be set up with its own -X 
option, on Sun's JVM.

I've recently switched to using BEA's JRockit JVM ;it doesnt have a 
separate option for that space, and is far less memory hungry in 64-bit 
mode. As these JVMs are free to use, try grabbing it.

2. Try switching away from the java5 XSL engine to xalan proper, by 
grabbing a version of xalan from http://xml.apache.org/ and sticking it 
in ANT_HOME/lib. This will switch most XML tasks under ant to the new 
xsl engine, which is less memory hungry

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Xslt 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: Steve Loughran [mailto:stevel@apache.org] 
> Sent: Friday, November 09, 2007 2:49 AM
> To: Ant Users List
> Subject: Re: Xslt when run from other dir from maven gets 
> "Provider for javax.xml.transform.TransformerFactory cannot be found"
> 
> Karr, David wrote:
> > 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.
> 
> so does <xslt> on java5 with the bundled XSL engine. Try 
> running Ant with more memory by setting ANT_OPTS to -DXmx256m

I tried setting ANT_OPTS all the way up to -Dxmx1536m, and it seemed to
make no difference.  I wonder if this is some sort of infinite loop
problem with xmltask.  I only saw it do it so far in one test case.  It
completed for the others.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


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

Posted by Steve Loughran <st...@apache.org>.
Karr, David wrote:
> JDK 1.4.2, Ant 1.5.4.
> 
> 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?

Probably maven is doing bad things to your classpath. I'd discuss it 
with them :)
> 
> 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.

so does <xslt> on java5 with the bundled XSL engine. Try running Ant 
with more memory by setting ANT_OPTS to -DXmx256m

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Xslt 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: Dominique Devienne [mailto:ddevienne@gmail.com] 
> Sent: Thursday, November 08, 2007 1:27 PM
> To: Ant Users List
> Subject: Re: Xslt when run from other dir from maven gets 
> "Provider for javax.xml.transform.TransformerFactory cannot be found"
> 
> On 11/8/07, Karr, David <da...@wamu.net> wrote:
> > JDK 1.4.2, Ant 1.5.4.
> 
> That's kinda old for Ant, no? I don't recall how Ant 1.5 
> worked that much.

Yeah, well, I wish I had a choice.  I have nightmares that when every
single piece of software I use hits end-of-life, my laptop will implode
:) .

> > 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.
> 
> And how were you declaring <xmltask>? Using a nested classpath?
> Putting xmltask.jar in $ANT_HOME/lib? On the CLASSPATH env. var?

I just used a taskdef with a classpath pointing to the xmltask jar.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


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

Posted by Dominique Devienne <dd...@gmail.com>.
On 11/8/07, Karr, David <da...@wamu.net> wrote:
> JDK 1.4.2, Ant 1.5.4.

That's kinda old for Ant, no? I don't recall how Ant 1.5 worked that much.

> 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".

I thought JDK 1.4 included Xalan already...

> 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?

Who knows what Maven does regarding class loading. It is forking a
separate VM for Ant, or setting up the Ant classpath itself? Since
this works with Ant, and fails with Maven, this may be more of a Maven
question than an Ant one.

> 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.

And how were you declaring <xmltask>? Using a nested classpath?
Putting xmltask.jar in $ANT_HOME/lib? On the CLASSPATH env. var?

Ant has changed quite a bit regarding class loading since 1.5 I
believe... I think the Ant launcher was introduced in 1.6 only (could
be wrong). --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org