You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/02/17 18:30:11 UTC

DO NOT REPLY [Bug 38695] New: - ant classloader conflicts with JDK 1.5

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38695>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38695

           Summary: ant classloader conflicts with JDK 1.5
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Keywords: JDK1.5
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jay_yan@yahoo.com


I have such a simple class, which uses a class included in JVM:
 
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
public class Test {
  public static void main (String[] args) {
    SAXParserFactoryImpl x = new SAXParserFactoryImpl();
    System.out.println(" x is " + x);
  }  
}
 
In a Windows console: (also reproducible on a Unix system)
>echo %JAVA_HOME%
D:\jdk1.5.0_05
 
>java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)
 
It works when executed directly:
>java Test
 x is com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl@82ba41
 
But has problem with ant:
I have such an xml file:
<?xml version="1.0"?>
<project default="test" basedir=".">
  <target name="init">
    <path id="lib.path">
      <dirset dir="."/>
    </path>
  </target>
  
  <target name="test" depends="init">
   <java classname="Test" classpathref="lib.path" fork="false">
    </java>
  </target>   
</project>
 
When run the test target, I got:
 
Buildfile: test.xml
 
init:
 
test:
     [java] java.lang.NoClassDefFoundError:
com/sun/org/apache/xerces/internal/jaxp/SAXParserFactory
Impl
     [java]     at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:172)
     [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:705)
     [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:177)
     [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:83)
     [java]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
     [java]     at org.apache.tools.ant.Task.perform(Task.java:364)
     [java]     at org.apache.tools.ant.Target.execute(Target.java:341)
     [java]     at org.apache.tools.ant.Target.performTasks(Target.java:369)
     [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
     [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
     [java]     at org.apache.tools.ant.Main.runBuild(Main.java:680)
     [java]     at org.apache.tools.ant.Main.startAnt(Main.java:191)
     [java]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
     [java]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
     [java] Caused by: java.lang.NoClassDefFoundError:
com/sun/org/apache/xerces/internal/jaxp/SAXPa
rserFactoryImpl
     [java]     at Test.main(Test.java:5)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at
org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:193)
     [java]     at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:130)
     [java]     ... 13 more
     [java] --- Nested Exception ---
     [java] java.lang.NoClassDefFoundError:
com/sun/org/apache/xerces/internal/jaxp/SAXParserFactory
Impl
     [java]     at Test.main(Test.java:5)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at
org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:193)
     [java]     at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:130)
     [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:705)
     [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:177)
     [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:83)
     [java]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
     [java]     at org.apache.tools.ant.Task.perform(Task.java:364)
     [java]     at org.apache.tools.ant.Target.execute(Target.java:341)
     [java]     at org.apache.tools.ant.Target.performTasks(Target.java:369)
     [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
     [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
     [java]     at org.apache.tools.ant.Main.runBuild(Main.java:680)
     [java]     at org.apache.tools.ant.Main.startAnt(Main.java:191)
     [java]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
     [java]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
 
BUILD SUCCESSFUL
Total time: 1 second
 
And the actual command issued by ant is
"java.exe" -Xms32m -Xmx512m -Dfile.encoding=UTF-8 -classpath
"lib\ant-launcher.jar" "-Dant.home=E:\niku\main\build\tools\bin\\.."
org.apache.tools.ant.launch.Launcher  -f test.xml
 
by executing which I can get the same exception as above.

But if I specify fork="true", it works. I.e. the JVM in which ant Launcher is
running the JVM class SAXParserFactoryImpl is screwed up. A new JVM does not
have the issue.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38695] - ant classloader conflicts with JDK 1.5

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38695>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38695


Darin_Swanson@us.ibm.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Darin_Swanson@us.ibm.com




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 38695] - ant classloader conflicts with JDK 1.5

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38695>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38695


stevel@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From stevel@apache.org  2006-02-18 22:57 -------
This is fixed in Ant1.7; added an extra passthrough for Java1.5. For now, just
fork if you can.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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