You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Aa...@Globus.ch on 2006/10/11 13:32:47 UTC

SAXParser problem with Maven 2.0.4, Xalan 2.8.1, Xerces 2.8.0 and Java 1.5

Hello,

I'm trying to port StatCVS to maven2 and had some success ... well, if I 
invoke
StatCVS as a subprocess.

But I want to invoke StatCVS directly, too. Now, I'm stuck while invoking 
StatCVS
from Java. When I try, I get this error:

saxFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
...
Caused by: javax.xml.parsers.FactoryConfigurationError: Provider 
org.apache.xerc
es.jaxp.SAXParserFactoryImpl could not be instantiated: 
java.lang.NullPointerExc
eption
        at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
        at 
de.berlios.statcvs.xml.output.HTMLRenderer.create(HTMLRenderer.java:98)

The code looks like this:

    SAXParserFactory x = new 
org.apache.xerces.jaxp.SAXParserFactoryImpl();
    System.out.println("saxFactory="+x.getClass().getName());

    x = SAXParserFactory.newInstance(); // <-- This is line 98
    System.out.println("saxFactory="+x.getClass().getName());

So basically, when I instantiate the SAXParserFactoryImpl directly, it 
works
which means that Xerces is in the classpath. When I use
javax.xml.parsers.SAXParserFactory.newInstance() (as I should), I get a 
NPE but
the classname is the same in both cases!

When I run this code within Eclipse, it works. Therefore, I assume that 
maven
somehow breaks this but I have no idea what could cause this.

Any ideas?

Best Regards,

-- 
Aaron Digulla

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


Re: Antwort: SAXParser problem with Maven 2.0.4, Xalan 2.8.1, Xerces 2.8

Posted by Aa...@Globus.ch.
barry <sa...@yahoo.com> schrieb am 24.10.2006 21:53:16:

>  This is a great cvs reporting plug-in you've started for maven2, have 
you
> been succesful and would you be putting it for public use.

Well, somewhat :-) Open issues:

1. I can't run the plugin "inline", ie. because of the SAXParser issues, I 
have to spawn a new process :-(

2. I didn't manage to get StatCVS-XML to work, so my plugin depends on 
StatCVS itself.

If you can live with that, I'm game to put the code online, now. Note that 
I can't access CVS from here. Subversion works, though. How should I 
proceed?

Regards,

-- 
Aaron Digulla


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


Re: Antwort: SAXParser problem with Maven 2.0.4, Xalan 2.8.1, Xerces 2.8

Posted by barry <sa...@yahoo.com>.
Aaron,
 This is a great cvs reporting plug-in you've started for maven2, have you
been succesful and would you be putting it for public use.

thanks,
-barry

Aaron.Digulla wrote:
> 
> Hello,
> 
> I made some further progress.
> 
> Apparently, the problem is in Sun's SAXParserFactory which stores a 
> classloader internally. This classloader is from the Pleistocene (when the 
> current VM was still fresh and didn't know about Maven).
> 
> So when my plugin comes into play, the classloader used by SAX simply 
> doesn't know about any classes loaded by the maven classloader.
> 
> *expletive deleted*
> 
> Is it possible to create a plugin which uses Xalan 2.8.1 despite the fact 
> that maven has its own Xalan in lib/endorsed and with Java 1.5?
> 
> Regards,
> 
> -- 
> Aaron Digulla
> 
> Aaron.Digulla@Globus.ch schrieb am 11.10.2006 13:32:47:
> 
>> Hello,
>> 
>> I'm trying to port StatCVS to maven2 and had some success ... well, if I 
> 
>> invoke
>> StatCVS as a subprocess.
>> 
>> But I want to invoke StatCVS directly, too. Now, I'm stuck while 
> invoking 
>> StatCVS
>> from Java. When I try, I get this error:
>> 
>> saxFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
>> java.lang.reflect.InvocationTargetException
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> ...
>> Caused by: javax.xml.parsers.FactoryConfigurationError: Provider 
>> org.apache.xerc
>> es.jaxp.SAXParserFactoryImpl could not be instantiated: 
>> java.lang.NullPointerExc
>> eption
>>         at javax.xml.parsers.SAXParserFactory.newInstance(Unknown 
> Source)
>>         at 
>> de.berlios.statcvs.xml.output.HTMLRenderer.create(HTMLRenderer.java:98)
>> 
>> The code looks like this:
>> 
>>     SAXParserFactory x = new 
>> org.apache.xerces.jaxp.SAXParserFactoryImpl();
>>     System.out.println("saxFactory="+x.getClass().getName());
>> 
>>     x = SAXParserFactory.newInstance(); // <-- This is line 98
>>     System.out.println("saxFactory="+x.getClass().getName());
>> 
>> So basically, when I instantiate the SAXParserFactoryImpl directly, it 
>> works
>> which means that Xerces is in the classpath. When I use
>> javax.xml.parsers.SAXParserFactory.newInstance() (as I should), I get a 
>> NPE but
>> the classname is the same in both cases!
>> 
>> When I run this code within Eclipse, it works. Therefore, I assume that 
>> maven
>> somehow breaks this but I have no idea what could cause this.
>> 
>> Any ideas?
>> 
>> Best Regards,
>> 
>> -- 
>> Aaron Digulla
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/SAXParser-problem-with-Maven-2.0.4%2C-Xalan-2.8.1%2C-Xerces-2.8.0-and-Java-1.5-tf2422831.html#a6980249
Sent from the Maven Developers mailing list archive at Nabble.com.


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


Antwort: SAXParser problem with Maven 2.0.4, Xalan 2.8.1, Xerces 2.8.0 and Java 1.5

Posted by Aa...@Globus.ch.
Hello,

I made some further progress.

Apparently, the problem is in Sun's SAXParserFactory which stores a 
classloader internally. This classloader is from the Pleistocene (when the 
current VM was still fresh and didn't know about Maven).

So when my plugin comes into play, the classloader used by SAX simply 
doesn't know about any classes loaded by the maven classloader.

*expletive deleted*

Is it possible to create a plugin which uses Xalan 2.8.1 despite the fact 
that maven has its own Xalan in lib/endorsed and with Java 1.5?

Regards,

-- 
Aaron Digulla

Aaron.Digulla@Globus.ch schrieb am 11.10.2006 13:32:47:

> Hello,
> 
> I'm trying to port StatCVS to maven2 and had some success ... well, if I 

> invoke
> StatCVS as a subprocess.
> 
> But I want to invoke StatCVS directly, too. Now, I'm stuck while 
invoking 
> StatCVS
> from Java. When I try, I get this error:
> 
> saxFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> ...
> Caused by: javax.xml.parsers.FactoryConfigurationError: Provider 
> org.apache.xerc
> es.jaxp.SAXParserFactoryImpl could not be instantiated: 
> java.lang.NullPointerExc
> eption
>         at javax.xml.parsers.SAXParserFactory.newInstance(Unknown 
Source)
>         at 
> de.berlios.statcvs.xml.output.HTMLRenderer.create(HTMLRenderer.java:98)
> 
> The code looks like this:
> 
>     SAXParserFactory x = new 
> org.apache.xerces.jaxp.SAXParserFactoryImpl();
>     System.out.println("saxFactory="+x.getClass().getName());
> 
>     x = SAXParserFactory.newInstance(); // <-- This is line 98
>     System.out.println("saxFactory="+x.getClass().getName());
> 
> So basically, when I instantiate the SAXParserFactoryImpl directly, it 
> works
> which means that Xerces is in the classpath. When I use
> javax.xml.parsers.SAXParserFactory.newInstance() (as I should), I get a 
> NPE but
> the classname is the same in both cases!
> 
> When I run this code within Eclipse, it works. Therefore, I assume that 
> maven
> somehow breaks this but I have no idea what could cause this.
> 
> Any ideas?
> 
> Best Regards,
> 
> -- 
> Aaron Digulla
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


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