ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Holmqvist, IT, Posten" <christian.holmqv...@posten.se>
Subject <java> problem when having xerces in manifest Class-Path. HELP!!
Date Thu, 24 Oct 2002 08:35:39 GMT
Hi

I have mailed about this once before but since there was no reaction I'll
try again.

It looks like the Class-Path line in the manifest file in a jar is somehow
overridden by ANT.

I have the following manifest file.

Manifest-Version: 1.0
Created-by: Nisse (Posten IT)
Main-Class: se.posten.logistik.applications.taxering.customs.DPDCustoms
Class-Path: xerces-1.3.jar common.jar business.jar

And the following target to execute the application.
  <target name="execute_init" depends="build">
    <property name="exec_loc" value="${temp}/bin"/>
    <property name="prop_file" value="${config}/DPDCustoms.properties"/>
    <mkdir dir="${exec_loc}"/>
    <copy file="${common_loc}" todir="${exec_loc}"/>
    <copy file="${business_loc}" todir="${exec_loc}"/>
    <copy file="${xerces13_loc}" todir="${exec_loc}"/>
    <copy file="${jar_file}" todir="${exec_loc}"/>
    <copy file="${prop_file}" todir="${exec_loc}"/>
  </target>

  <target name="execute" depends="execute_init">
    <java jar="${jar_file}" fork="true">
      <arg value="${prop_file}"/>
    </java>
  </target>

As ya'll see all files needed is copied to the bin directory and then the
application is executed with the java command.
As far as I know this should be equal to the java -jar <jar_file> <argument>
command, right?

But when I do and execute everything works fine until the default handler in
xerces is loaded (with reflection i guess), then I get the following
exception:
     [java] java.lang.NoClassDefFoundError:
org/xml/sax/helpers/DefaultHandler
     [java]     at java.lang.ClassLoader.defineClass0(Native Method)
     [java]     at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
     [java]     at
java.security.SecureClassLoader.defineClass(SecureClassLoader
.java:106)
     [java]     at
java.net.URLClassLoader.defineClass(URLClassLoader.java:243)
     [java]     at
java.net.URLClassLoader.access$100(URLClassLoader.java:51)
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
     [java]     at java.security.AccessController.doPrivileged(Native
Method)
     [java]     at
java.net.URLClassLoader.findClass(URLClassLoader.java:183)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
     [java]     at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)

     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
     [java]     at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)

     [java]     at
se.posten.logistik.business.taxering.object.parser.XMLFilePar
ser.parse(XMLFileParser.java:91)

If I do it without ant i.e. from the command line (java -jar <jar_file>
<argument> in the bin folder everything works just fine.

Has anyone else encountered this problem? Is it a bug in Ant or am I just
stupied??

Thanks for all your help!

/Christian Holmqvist

-------------------------

Christian Holmqvist

Posten Sverige AB
Posten IT
105 00 Stockholm

Besöksadress: Ekensbergsvägen 113 ,Solna

Tel: 08 - 781 61 48
Mobil: 070 - 985 00 28

christian.holmqvist@posten.se

http://www.posten.se 

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


Mime
View raw message