You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adam Hardy <Ad...@bbc.co.uk> on 2005/02/25 12:41:31 UTC

xerces

Hi again All,

I posted 24 hours ago (included below) about a problem with xerces. 

I probably should have kept it short and sweet to attract a reply, so
I'm going to try that now:

how can I set up and run a task as a goal with a later version of xerces
xml parser?

None of the solutions out in doc/google-land have worked for me, e.g.
forking, defining classpaths etc.


Thanks for any advice,

Adam





-----Original Message-----
From: Adam Hardy 
Sent: 24 February 2005 13:03
To: users@maven.apache.org
Subject: xercesImpl and alternately XmlChars or OutputFormat




I have a problem setting up Sun's JAXB xml binding as an ant task in my
maven.xml.

I have scoured google, the mailing list archives and the maven
documentation, and now after 2 days I think I need some outside help! 

I already found that some people set up a maven plugin for JAXB, which I
tried, but I get the same failure.

In my goal I have declared the JAXB task that I wish to run and have
tried various combinations of classpaths which result in various
NoClassDefFoundError being thrown.

I see there have been problems before with xerces because of maven's
in-built dependence on xerces 2.x. 

For JAXB 1.5 I need to use xercesImpl-2.6.2

>From the mailing list messages on the subject, I think I need maven to
give me a context without any reference to its own version of xerces. 

I tried including fork="true", and referencing classpath declarations
for the ant:taskdef, but I still get the NoClassDefFoundError for the
xercesImpl class:

java.lang.NoClassDefFoundError:
com/sun/org/apache/xml/internal/serialize/OutputFormat

This is my maven.xml:


<goal name="jaxb"> 
  <!--  define an jaxb xjc task to generate schema-based .java files -->

  <ant:taskdef name="xjc" 
    classname="com.sun.tools.xjc.XJCTask" fork="true">
    <ant:classpath>
      <ant:pathelement 
        location="${pom.getDependencyPath('jaxb:jaxb-xjc')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('jaxb:jaxb-libs')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('jaxb:jaxb-impl')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('xsdlib:xsdlib')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('relaxng:relaxngDatatype')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('namespace:jax-qname')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('jaxb:jaxb-api')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('namespace:namespace')}"/>
      <ant:pathelement 
        location="${pom.getDependencyPath('xerces:xercesImpl')}"/>
    </ant:classpath>        
  </ant:taskdef>

[snipped out some variable manipulation................]

  <ant:xjc schema="conf/${jaxb.schema}" 
      target="src" 
      package="${jaxb.destination}" fork="true"> 
    <ant:pathelement 
      location="${pom.getDependencyPath('xerces:xercesImpl')}"/>
  </ant:xjc>          

  </goal>


I don't know how to get a context free from references to maven's xerces
version. My attempts have all failed with various results. 

Firstly if I put the xercesImpl jar on the classpath as a pathelement as
above, or if I leave it out, it makes no difference. 

Then if I tell maven to run java:compile first (advice in a msg on the
mailing list) by setting up a preGoal, I get a different error:


java.lang.NoClassDefFoundError: com/sun/xml/util/XmlChars
        at
com.sun.tools.xjc.reader.internalizer.WhitespaceStripper.processPendingT
ext(WhitespaceStripper.java:91)


However XmlChars is in xsdlib.jar, which I have put on the classpath as
you can see above. This is the most confusing bit because it seems a
simple issue, but I can't see what to do.

If I include the whole dependency classpath like this:


<ant:path refid="maven.dependency.classpath"/>


it makes no difference either.

If anyone can provide any advice, I'd be grateful.

Regards
Adam

http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated. If you have received it in error, please delete it from your
system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.

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


http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.

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


Re: xerces

Posted by Nicolas Chalumeau <ni...@gmail.com>.
A corrupted jar !

java.lang.NoClassDefFoundError:
com/sun/org/apache/xml/internal/serialize/OutputFormat
^^^^^^^^^^^^^^^^^^^^^^^^

This is a strange package path (com.sun and org.apache)!

Nicolas


On Fri, 25 Feb 2005 11:41:31 -0000, Adam Hardy <Ad...@bbc.co.uk> wrote:
> Hi again All,
> 
> I posted 24 hours ago (included below) about a problem with xerces.
> 
> I probably should have kept it short and sweet to attract a reply, so
> I'm going to try that now:
> 
> how can I set up and run a task as a goal with a later version of xerces
> xml parser?
> 
> None of the solutions out in doc/google-land have worked for me, e.g.
> forking, defining classpaths etc.
> 
> Thanks for any advice,
> 
> Adam
> 
> -----Original Message-----
> From: Adam Hardy
> Sent: 24 February 2005 13:03
> To: users@maven.apache.org
> Subject: xercesImpl and alternately XmlChars or OutputFormat
> 
> I have a problem setting up Sun's JAXB xml binding as an ant task in my
> maven.xml.
> 
> I have scoured google, the mailing list archives and the maven
> documentation, and now after 2 days I think I need some outside help!
> 
> I already found that some people set up a maven plugin for JAXB, which I
> tried, but I get the same failure.
> 
> In my goal I have declared the JAXB task that I wish to run and have
> tried various combinations of classpaths which result in various
> NoClassDefFoundError being thrown.
> 
> I see there have been problems before with xerces because of maven's
> in-built dependence on xerces 2.x.
> 
> For JAXB 1.5 I need to use xercesImpl-2.6.2
> 
> From the mailing list messages on the subject, I think I need maven to
> give me a context without any reference to its own version of xerces.
> 
> I tried including fork="true", and referencing classpath declarations
> for the ant:taskdef, but I still get the NoClassDefFoundError for the
> xercesImpl class:
> 
> java.lang.NoClassDefFoundError:
> com/sun/org/apache/xml/internal/serialize/OutputFormat
> 
> This is my maven.xml:
> 
> <goal name="jaxb">
>   <!--  define an jaxb xjc task to generate schema-based .java files -->
> 
>   <ant:taskdef name="xjc"
>     classname="com.sun.tools.xjc.XJCTask" fork="true">
>     <ant:classpath>
>       <ant:pathelement
>         location="${pom.getDependencyPath('jaxb:jaxb-xjc')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('jaxb:jaxb-libs')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('jaxb:jaxb-impl')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('xsdlib:xsdlib')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('relaxng:relaxngDatatype')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('namespace:jax-qname')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('jaxb:jaxb-api')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('namespace:namespace')}"/>
>       <ant:pathelement
>         location="${pom.getDependencyPath('xerces:xercesImpl')}"/>
>     </ant:classpath>
>   </ant:taskdef>
> 
> [snipped out some variable manipulation................]
> 
>   <ant:xjc schema="conf/${jaxb.schema}"
>       target="src"
>       package="${jaxb.destination}" fork="true">
>     <ant:pathelement
>       location="${pom.getDependencyPath('xerces:xercesImpl')}"/>
>   </ant:xjc>
> 
>   </goal>
> 
> I don't know how to get a context free from references to maven's xerces
> version. My attempts have all failed with various results.
> 
> Firstly if I put the xercesImpl jar on the classpath as a pathelement as
> above, or if I leave it out, it makes no difference.
> 
> Then if I tell maven to run java:compile first (advice in a msg on the
> mailing list) by setting up a preGoal, I get a different error:
> 
> java.lang.NoClassDefFoundError: com/sun/xml/util/XmlChars
>         at
> com.sun.tools.xjc.reader.internalizer.WhitespaceStripper.processPendingT
> ext(WhitespaceStripper.java:91)
> 
> However XmlChars is in xsdlib.jar, which I have put on the classpath as
> you can see above. This is the most confusing bit because it seems a
> simple issue, but I can't see what to do.
> 
> If I include the whole dependency classpath like this:
> 
> <ant:path refid="maven.dependency.classpath"/>
> 
> it makes no difference either.
> 
> If anyone can provide any advice, I'd be grateful.
> 
> Regards
> Adam
> 
> http://www.bbc.co.uk/
> 
> This e-mail (and any attachments) is confidential and may contain
> personal views which are not the views of the BBC unless specifically
> stated. If you have received it in error, please delete it from your
> system.
> Do not use, copy or disclose the information in any way nor act in
> reliance on it and notify the sender immediately. Please note that the
> BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> http://www.bbc.co.uk/
> 
> This e-mail (and any attachments) is confidential and may contain
> personal views which are not the views of the BBC unless specifically
> stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in
> reliance on it and notify the sender immediately. Please note that the
> BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
> 
> ---------------------------------------------------------------------
> 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