Greetings!

Maven: 1.0-rc1
Java2: 1.4.2_01
Host: Redhat Linux 7.2

I'm trying to create a simple rmic goal for generating stub classes for rmi
(remote EJB)purposes. My maven.xml looks like this (for now):

<project
 xmlns:ant="jelly:ant"
 xmlns:j="jelly:core">
 <goal name="rmic" prereqs="java:compile">
  <ant:mkdir dir="target/stub-classes"/>
  <ant:mkdir dir="target/stub-src"/>
  <ant:rmic base="target/classes" sourcebase="target/stub-src" iiop="true"
includes="**/TestRemote.class">
   <ant:classpath>
    <ant:pathelement path="target/classes"/>
   </ant:classpath>
   <ant:compilerarg line="-verbose -g -always"/>
  </ant:rmic>
 </goal>
</project>

Just for testing this goal I created a simple Remote interface called
TestRemote (as included above in ant:rmic task):

package test.mavenrmic;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface TestRemote extends Remote {
    public void doStuff() throws RemoteException;
}


If I run this same goal as an Ant task (ofcourse without the ant: prefixes)
everything works just fine and no errors are produced.

But when I run the goal under Maven I get following:
    [rmic] [loaded target/classes/test/mavenrmic/TestRemote.class in 1 ms]
java.lang.NullPointerException
        at sun.rmi.rmic.iiop.CompoundType.loadClass(CompoundType.java:328)
        at sun.rmi.rmic.iiop.Type.initClass(Type.java:961)
        at sun.rmi.rmic.iiop.Type.setRepositoryID(Type.java:978)
        at sun.rmi.rmic.iiop.CompoundType.initialize(CompoundType.java:774)
        at
sun.rmi.rmic.iiop.SpecialInterfaceType.initialize(SpecialInterfaceType.java:
216)
        at
sun.rmi.rmic.iiop.SpecialInterfaceType.forSpecial(SpecialInterfaceType.java:
86)
        at
sun.rmi.rmic.iiop.CompoundType.addRemoteInterfaces(CompoundType.java:1412)
        at
sun.rmi.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:201
)
        at sun.rmi.rmic.iiop.RemoteType.initialize(RemoteType.java:162)
        at sun.rmi.rmic.iiop.RemoteType.forRemote(RemoteType.java:81)
        at
sun.rmi.rmic.iiop.StubGenerator.getTopType(StubGenerator.java:118)
        at sun.rmi.rmic.iiop.Generator.generate(Generator.java:259)
        at sun.rmi.rmic.Main.doCompile(Main.java:526)
        at sun.rmi.rmic.Main.compile(Main.java:130)
        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:324)
        at
org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:96)
        at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:520)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)
        ...

I forked the Ant distribution that Maven uses in $MAVEN_HOME/lib which is
ant-1.5.3-1.jar in Maven rc1. I added printing the arguments Ant is trying
to give rmic in org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(..) and
it prints them like this before throwing the exception discribed above:

arg[0]=-d
arg[1]=/home/test/projects/java/maven-rmic/target/classes
arg[2]=-classpath
arg[3]=/home/test/projects/java/maven-rmic/target/classes:/usr/java/maven-1.
0-rc1/lib/forehead-1.0-beta-5.jar
arg[4]=-keepgenerated
arg[5]=-iiop
arg[6]=-verbose
arg[7]=-g
arg[8]=-always
arg[9]=test.mavenrmic.TestRemote

If I run rmic from command line with these parameters everything goes fine -
just as when running the goal as Ant task. But in Maven I cannot get it to
work.
I even created a simple class simulating the Ant's SunRmic class that gets
parameters from command line and calls rmic through reflection. It works.
But Maven does not. I'm lost here.

Any help on this would be very much appreciated!


Sincerely,
Teemu Hiltunen


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to