You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Elizabeth Barham <so...@yahoo.com> on 2002/06/16 21:34:06 UTC

Exception reading component ... ???

Hi,

I am new to ant. I am trying to run a java application that is housed
in a jar file in a local directory, ${lib}.

    <java
	  classname="org.txt2xml.cli.Batch"
	  classpathref="txt2xml.cp">
      <arg file="${listing.dsc}" />
      <arg file="${listing.txt}" />
    </java>

txt2xml.cp:

  <path id="txt2xml.cp">
    <pathelement location="${lib}/txt2xml.jar"/>
    <pathelement location="${lib}/jdom.jar"/>
    <pathelement location="${lib}/commons-collections.jar"/>
    <pathelement location="${lib}/commons-logging.jar"/>
    <pathelement location="${lib}/junit.jar"/>
    <pathelement location="${lib}/scope-bin.jar"/>
    <pathelement location="${lib}/xml-apis.jar"/>
    <pathelement location="${lib}/xercesImpl.jar"/>
   </path>

I have unset my CLASSPATH. The error that occurs is:

  java.lang.NoClassDefFoundError: org/xml/sax/Parser

Which is defined in xml-apis.jar:

  559  02-06-02 10:49   org/xml/sax/Parser.class

Prior to this error, though, there is mention in the "-debug" output
of:

  Finding class org.xml.sax.Parser
  Exception reading component  ${lib}/xml-apis.jar

In my normal, day-to-day CLASSPATH, I have many .jar files that
implement the same classes. To the best of my knowledge, this is
perfectly acceptable as the JVM just uses the first one it finds and
ignores the rest. Apparently, though, this causes problems with ant as
I believe that xml-apis.jar is trying to define classes that have
already been defined in another previously loaded .jar file.

Is there a simple work-around or am I not doing something right?

Thank you, Elizabeth

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception reading component ... ???

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Elizabeth Barham" <so...@yahoo.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Sunday, June 16, 2002 19:05
Subject: Re: Exception reading component ... ???


> "Erik Hatcher" <ja...@ehatchersolutions.com> writes:
> > Looks to me like ${lib} is not set.  No?
>
> Hi Erik,
>
> Thanks for your response but, yes, ${lib} was set. I'm not sure why
> either was calling an error but the current work-a-round is to call
> java with fork="yes" as it works from the command line:
>
>     <java
>   classname="org.txt2xml.cli.Batch"
>   fork="Yes"
>   classpath="${env.CLASSPATH}">
>       <arg file="${en.units.dsc}" />
>       <arg file="${en.units.txt}" />
>     </java>
>
> For any future references:
>
> The first error ("Exception reading component") was produced with Ant
> 1.4 and j2sdk1.4.0_01-i586.
>
> The second
> (java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl)
> was with Ant 1.5Beta2 and, again, with j2sdk1.4.0_01-i586.
>

ant1.4 would have the same bug. the classloader in ant filters out all
parent classes but java.* and javax.*; this was valid for pre-1.4. I am
planning to fix it, I have the fix, just not the tests yet.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception reading component ... ???

Posted by Elizabeth Barham <so...@yahoo.com>.
"Erik Hatcher" <ja...@ehatchersolutions.com> writes:
> Looks to me like ${lib} is not set.  No?

Hi Erik,

Thanks for your response but, yes, ${lib} was set. I'm not sure why
either was calling an error but the current work-a-round is to call
java with fork="yes" as it works from the command line:

    <java
	  classname="org.txt2xml.cli.Batch"
	  fork="Yes"
	  classpath="${env.CLASSPATH}">
      <arg file="${en.units.dsc}" />
      <arg file="${en.units.txt}" />
    </java>

For any future references:

The first error ("Exception reading component") was produced with Ant
1.4 and j2sdk1.4.0_01-i586.

The second
(java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl)
was with Ant 1.5Beta2 and, again, with j2sdk1.4.0_01-i586.

Regards, Elizabeth

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception reading component ... ???

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message ----- 
From: "Elizabeth Barham" <so...@yahoo.com>
> Which is defined in xml-apis.jar:
> 
>   559  02-06-02 10:49   org/xml/sax/Parser.class
> 
> Prior to this error, though, there is mention in the "-debug" output
> of:
> 
>   Finding class org.xml.sax.Parser
>   Exception reading component  ${lib}/xml-apis.jar

Looks to me like ${lib} is not set.  No?


    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception reading component ... ???

Posted by Steve Loughran <st...@iseran.com>.
act on eriks comments, then set failonerror=true, fork=true

java1.4 has this special notio of where endorsed apis can be implemented,
and ant doesnt :)

----- Original Message -----
From: "Elizabeth Barham" <so...@yahoo.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Sunday, June 16, 2002 15:16
Subject: Re: Exception reading component ... ???


> "Steve Loughran" <st...@iseran.com> writes:
> > should all work. You using java1.4 by any chance?
>
> Yes, Steve, I am.
>
> In the interim of writing the previous email, I downloaded the new
> ant, 1.5Beta2 but am now receiving a different error:
>
> Finding class sun.reflect.MethodAccessorImpl
>      [java] java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl
>
> which is in $JAVA_HOME/jre/lib/rt.jar .
>
> Also, the package I'm using for transforming text files to XML files
> is txt2xml, which requires 1.4 to work.
>
> Any ideas?
>
> Thank you for your help.
>
> Regards, Elizabeth
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception reading component ... ???

Posted by Elizabeth Barham <so...@yahoo.com>.
"Steve Loughran" <st...@iseran.com> writes:
> should all work. You using java1.4 by any chance?

Yes, Steve, I am.

In the interim of writing the previous email, I downloaded the new
ant, 1.5Beta2 but am now receiving a different error:

Finding class sun.reflect.MethodAccessorImpl
     [java] java.lang.NoClassDefFoundError: sun/reflect/MethodAccessorImpl

which is in $JAVA_HOME/jre/lib/rt.jar .

Also, the package I'm using for transforming text files to XML files
is txt2xml, which requires 1.4 to work.

Any ideas?

Thank you for your help. 

Regards, Elizabeth

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception reading component ... ???

Posted by Steve Loughran <st...@iseran.com>.
should all work. You using java1.4 by any chance?

----- Original Message -----
From: "Elizabeth Barham" <so...@yahoo.com>
To: <an...@jakarta.apache.org>
Sent: Sunday, June 16, 2002 12:34
Subject: Exception reading component ... ???


> Hi,
>
> I am new to ant. I am trying to run a java application that is housed
> in a jar file in a local directory, ${lib}.
>
>     <java
>   classname="org.txt2xml.cli.Batch"
>   classpathref="txt2xml.cp">
>       <arg file="${listing.dsc}" />
>       <arg file="${listing.txt}" />
>     </java>
>
> txt2xml.cp:
>
>   <path id="txt2xml.cp">
>     <pathelement location="${lib}/txt2xml.jar"/>
>     <pathelement location="${lib}/jdom.jar"/>
>     <pathelement location="${lib}/commons-collections.jar"/>
>     <pathelement location="${lib}/commons-logging.jar"/>
>     <pathelement location="${lib}/junit.jar"/>
>     <pathelement location="${lib}/scope-bin.jar"/>
>     <pathelement location="${lib}/xml-apis.jar"/>
>     <pathelement location="${lib}/xercesImpl.jar"/>
>    </path>
>
> I have unset my CLASSPATH. The error that occurs is:
>
>   java.lang.NoClassDefFoundError: org/xml/sax/Parser
>
> Which is defined in xml-apis.jar:
>
>   559  02-06-02 10:49   org/xml/sax/Parser.class
>
> Prior to this error, though, there is mention in the "-debug" output
> of:
>
>   Finding class org.xml.sax.Parser
>   Exception reading component  ${lib}/xml-apis.jar
>
> In my normal, day-to-day CLASSPATH, I have many .jar files that
> implement the same classes. To the best of my knowledge, this is
> perfectly acceptable as the JVM just uses the first one it finds and
> ignores the rest. Apparently, though, this causes problems with ant as
> I believe that xml-apis.jar is trying to define classes that have
> already been defined in another previously loaded .jar file.
>
> Is there a simple work-around or am I not doing something right?
>
> Thank you, Elizabeth
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>