You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sune Kristensen <sh...@visanti.com> on 2004/10/07 10:46:10 UTC

rmic in jdk 1.5.0 and ant fails

Hi

I have a project that works without a problem with Ant and Jdk 1.4.2_05, 
but if I try to compile it with Jdk 1.5.0 it failes with the following 
error:

ant -v output:

Apache Ant version 1.7alpha compiled on October 6 2004
Buildfile: build.xml
Detected Java version: 1.5 in: /pack/jdk1.5.0/jre
Detected OS: Linux
parsing buildfile /home/shk/test/build.xml with URI = 
file:///home/shk/test/build.xml
Project base dir set to: /home/shk/test
Build sequence for target(s) `compile' is [compile]
Complete build sequence is [compile, ]

compile:
    [javac] TestRMI.class skipped - don't know how to handle it
    [javac] TestRMI.java omitted as TestRMI.class is up to date.
    [javac] TestRMIObject.class skipped - don't know how to handle it
    [javac] TestRMIObject.java omitted as TestRMIObject.class is up to date.
    [javac] build.xml skipped - don't know how to handle it
     [rmic] TestRMIObject.class added as TestRMIObject_Stub.class 
doesn't exist.
     [rmic] RMI Compiling 1 class to /home/shk/test
     [rmic] Using SUN rmic compiler
     [rmic] Compilation arguments:
     [rmic] '-d'
     [rmic] '/home/shk/test'
     [rmic] '-classpath'
     [rmic] 
'/home/shk/test:/pack/ant-cvs/lib/ant-launcher.jar:/pack/j2sdkee1.3.1/lib/j2ee.jar:/pack/oracle-suse/product/9.2/jdbc/lib/classes12.jar:/pack/oracle-suse/product/9.2/sqlj/lib/translator.jar:/pack/oracle-suse/product/9.2/sqlj/lib/runtime12.jar:/pack/oracle-suse/product/9.2/sqlj/lib/runtime12ee.jar:/pack/ant-cvs/lib/ant-jai.jar:/pack/ant-cvs/lib/ant-antlr.jar:/pack/ant-cvs/lib/ant-starteam.jar:/pack/ant-cvs/lib/ant-icontract.jar:/pack/ant-cvs/lib/ant-jdepend.jar:/pack/ant-cvs/lib/ant-apache-oro.jar:/pack/ant-cvs/lib/ant-trax.jar:/pack/ant-cvs/lib/ant-apache-regexp.jar:/pack/ant-cvs/lib/ant-jmf.jar:/pack/ant-cvs/lib/ant-jsch.jar:/pack/ant-cvs/lib/ant-apache-bsf.jar:/pack/ant-cvs/lib/ant-netrexx.jar:/pack/ant-cvs/lib/ant-swing.jar:/pack/ant-cvs/lib/xercesImpl.jar:/pack/ant-cvs/lib/ant-apache-bcel.jar:/pack/ant-cvs/lib/ant-stylebook.jar:/pack/ant-cvs/lib/ant-javamail.jar:/pack/ant-cvs/lib/ant-junit.jar:/pack/ant-cvs/lib/ant-xalan1.jar:/pack/ant-cvs/lib/ant-commons-net.jar:/pack/ant-cvs/lib/ant-commons-logging.jar:/pack/ant-cvs/lib/ant-weblogic.jar:/pack/ant-cvs/lib/ant-apache-log4j.jar:/pack/ant-cvs/lib/ant.jar:/pack/ant-cvs/lib/xml-apis.jar:/pack/ant-cvs/lib/ant-vaj.jar:/pack/ant-cvs/lib/ant-xslp.jar:/pack/ant-cvs/lib/ant-nodeps.jar:/pack/ant-cvs/lib/ant-apache-resolver.jar:/pack/jdk1.5.0/lib/tools.jar'
     [rmic]
     [rmic] The ' characters around the executable and arguments are
     [rmic] not part of the command.
     [rmic] File to be compiled:    TestRMIObject
     [rmic] java.lang.NoClassDefFoundError: 
com/sun/corba/se/internal/util/Utility
     [rmic]     at 
sun.rmi.rmic.RMIGenerator.sourceFileForClass(RMIGenerator.java:186)
     [rmic]     at sun.rmi.rmic.RMIGenerator.<init>(RMIGenerator.java:267)
     [rmic]     at sun.rmi.rmic.RMIGenerator.generate(RMIGenerator.java:105)
     [rmic]     at sun.rmi.rmic.Main.doCompile(Main.java:529)
     [rmic]     at sun.rmi.rmic.Main.compile(Main.java:133)
     [rmic]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
     [rmic]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [rmic]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [rmic]     at java.lang.reflect.Method.invoke(Method.java:585)
     [rmic]     at 
org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:73)
     [rmic]     at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:484)
     [rmic]     at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
     [rmic]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
     [rmic]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [rmic]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [rmic]     at java.lang.reflect.Method.invoke(Method.java:585)
     [rmic]     at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:95)
     [rmic]     at org.apache.tools.ant.Task.perform(Task.java:366)
     [rmic]     at org.apache.tools.ant.Target.execute(Target.java:341)
     [rmic]     at org.apache.tools.ant.Target.performTasks(Target.java:369)
     [rmic]     at 
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1243)
     [rmic]     at 
org.apache.tools.ant.Project.executeTarget(Project.java:1213)
     [rmic]     at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:36)
     [rmic]     at 
org.apache.tools.ant.Project.executeTargets(Project.java:1094)
     [rmic]     at org.apache.tools.ant.Main.runBuild(Main.java:673)
     [rmic]     at org.apache.tools.ant.Main.startAnt(Main.java:188)
     [rmic]     at 
org.apache.tools.ant.launch.Launcher.run(Launcher.java:229)
     [rmic]     at 
org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
     [rmic] error: An error has occurred in the compiler; please file a 
bug report (http://java.sun.com/cgi-bin/bugreport.cgi).

     [rmic] 1 error


BUILD FAILED
/home/shk/test/build.xml:12: Rmic failed; see the compiler error output 
for details.
        at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:485)
        at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:95)
        at org.apache.tools.ant.Task.perform(Task.java:366)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at 
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1243)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1213)
        at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:36)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:229)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

If I run rmic by hand with Jdk 1.5.0 it workes fine, so I suspect that 
it is something with Ant.
I have tested it with Ant version 1.6.2 and the cvs version (1.7alpha).
I found out that the class com/sun/corba/se/internal/util/Utility has 
been moved in Jdk 1.5.0 to com/sun/corba/se/impl/util/Utility
I have searched Google, Sun's java forums, and the archives for this 
list, but could not find anything about this error!

I have created a small test project that also failes with Jdk 1.5.0 but 
works with 1.4.2_05, which is included here!

TestRMI.java :
import java.rmi.*;
import java.rmi.server.*;

public interface TestRMI extends Remote {

    String test() throws RemoteException;
}

TestRMIObject.java :
import java.rmi.*;
import java.rmi.server.*;

public class TestRMIObject extends RemoteObject implements TestRMI {

    public String test() throws RemoteException {
        return "QWERTY";
    }
}

build.xml :
<project name="rmitest" default="compile" basedir=".">

  <target name="compile">

    <javac debug="true"
           deprecation="true"
           optimize="off"
           verbose="off"
           srcdir="." destdir="."
           includes="*">
    </javac>
    <rmic classname="TestRMIObject" base="." classpath="."/>
  </target>

</project>


/Sune


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


Re: rmic in jdk 1.5.0 and ant fails - SOLVED

Posted by Sune Kristensen <sh...@visanti.com>.
Stefan Bodewig wrote

>Hmm, then either sun.rmi.rmic.RMIGenerator doesn't know it (unlikely)
>or you are running sun.rmi.rmic.Main from an older JDK.
>
>Is there jar on your CLASSPATH which contains a class like this?
>Candidates are a tools.jar in ANT_HOME/lib and similar strange things.
>
>Stefan
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>
I had a j2ee.jar file on my classpath, that I did not think could have 
anything to do with this, but aparently it has a version of rmic, so 
with that removed everything works fine!

Thanks for the help :-)

/Sune

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


Re: rmic in jdk 1.5.0 and ant fails

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 07 Oct 2004, Sune Kristensen <sh...@visanti.com> wrote:

>     [rmic] java.lang.NoClassDefFoundError:
>     com/sun/corba/se/internal/util/Utility
>     [rmic]     at
>     sun.rmi.rmic.RMIGenerator.sourceFileForClass(RMIGenerator.java:186)
>     [rmic]     at sun.rmi.rmic.RMIGenerator.<init>(RMIGenerator.java:267)
>     [rmic]     at sun.rmi.rmic.RMIGenerator.generate(RMIGenerator.java:105)
>     [rmic]     at sun.rmi.rmic.Main.doCompile(Main.java:529)
>     [rmic]     at sun.rmi.rmic.Main.compile(Main.java:133)
>
...
> I found out that the class com/sun/corba/se/internal/util/Utility
> has been moved in Jdk 1.5.0 to com/sun/corba/se/impl/util/Utility

Hmm, then either sun.rmi.rmic.RMIGenerator doesn't know it (unlikely)
or you are running sun.rmi.rmic.Main from an older JDK.

Is there jar on your CLASSPATH which contains a class like this?
Candidates are a tools.jar in ANT_HOME/lib and similar strange things.

Stefan

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