You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Marc Eilens <Ma...@impress.com> on 2001/01/09 19:05:44 UTC

Problem with a java task

Hi everybody,

I hope I'm not in the wrong list.

I'm quite new to Ant but like it a lot and just wrote a taskdef to call a
java program generating implementation classes for the JOnAS open source EJB
server. The tool that is used for this task is called GenIC.
I had a look on the ejb-taskdefs for Weblogic and adapted them to my needs.
The problem now obviously lies in the classpath.
What I do in my task (genic) is creating a Java task with the necessary
classpath set calling a helper class which actually calls the JOnAS GenIC
tool.
I thought that setting the classpath for the Java task should do, but
obviously it doesn't.
Any ideas why? Help would be very appreciated.

Following some pieces of code:

first, some stuff of my GenIC task:

	//get the system's class path
        systemClassPath = System.getProperty("java.class.path");
        
		//set the class path for the execution
		execClassPath = project.translatePath(
			systemClassPath + ":" + classpath + ":" +
destinationDirectory);
			
		//System.out.println("execClassPath: " + execClassPath +
"\n");
        
		//create the task
        helperTask = (Java)project.createTask("java");
        helperTask.setFork(true);
 
helperTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.jonas.Ge
nICHelper");
        
        //the descriptor
        {
	helperTask.createArg().setValue(descriptor.getPath());
        }
        //...		
        helperTask.setClasspath(new Path(project, execClassPath));
        
        if(helperTask.executeJava() != 0) 
        {                         
            throw new BuildException("Execution of GenIC helper failed");
        }


When I run the task I get something like follows. I also pass the classpath
yet again to the GenIC tool itself via -cp but even this does not work.
Any ideas???

W:\java>ant -verbose -buildfile make\genicbuild.xml run
Ant version 1.2 compiled on October 24 2000

Buildfile: make\genicbuild.xml
Detected Java Version: 1.3
Detected OS: Windows NT
Project base dir set to: W:\java
Build sequence for target `run' is [prepare, compile, run]
Complete build sequence is [prepare, compile, run, rmTmpJars, mkTmpJars,
unzipAntJar, unzipGenicJar, dist, clean, all, antJar]
    [mkdir] Created dir: W:\java\build\classes
    [javac] Compiling 2 source files to W:\java\build\classes
    [javac] Using modern compiler
    [javac] Compilation args: -d W:\java\build\classes -classpath
W:\java\build\classes;C:\jonas20_jdk1.2\lib\RMI_jonas.jar;C:\orant\orb\class
es\yoj.jar;C:\orant\orb\classes\share.zip;W:\java;C:\java\
jakarta-ant\lib\ant.jar;C:\java\jakarta-ant\lib\ant.orig.jar;C:\java\jakarta
-ant\lib\jaxp.jar;C:\java\jakarta-ant\lib\parser.jar;C:\jdk1.3\lib\tools.jar
-sourcepath W:\java\src
    [javac] Files to be compiled:
    W:\java\src\org\apache\tools\ant\taskdefs\optional\ejb\jonas\GenIC.java
 
W:\java\src\org\apache\tools\ant\taskdefs\optional\ejb\jonas\GenICHelper.jav
a

     [java] Forking java -classpath
C:\orant\orb\classes\yoj.jar;C:\orant\orb\classes\share.zip;W:\java;C:\java\
jakarta-ant\lib\ant.jar;C:\java\jakarta-ant\lib\ant.orig.jar;C:\java\jakarta
-ant\lib\jax
p.jar;C:\java\jakarta-ant\lib\parser.jar;C:\jdk1.3\lib\tools.jar;W:\ois31\oi
s.jar;W:\ois31\clbo.jar;W:\java\sessionbean.jar;C:\jonas20_jdk1.2\lib\RMI_jo
nas.jar;C:\jonas20_jdk1.2\lib\ejb.jar org.apache
.tools.ant.taskdefs.optional.ejb.jonas.GenICHelper sessionbean.jar w:\java
     [java] Running GenIC for sessionbean.jar
     [java] arg[0] == -Dinstall.root=c:\jonas20_jdk1.2
     [java]
     [java] arg[1] == -d w:\java
     [java]
     [java] arg[2] == -cp
.;C:\orant\orb\classes\yoj.jar;C:\orant\orb\classes\share.zip;W:\java;C:\jav
a\jakarta-ant\lib\ant.jar;C:\java\jakarta-ant\lib\ant.orig.jar;C:\java\jakar
ta-ant\lib\jaxp.jar;C:
\java\jakarta-ant\lib\parser.jar;C:\jdk1.3\lib\tools.jar;W:\ois31\ois.jar;W:
\ois31\clbo.jar;W:\java\sessionbean.jar;C:\jonas20_jdk1.2\lib\RMI_jonas.jar;
C:\jonas20_jdk1.2\lib\ejb.jar
     [java]
     [java] arg[3] == sessionbean.jar
     [java]
     [java] JOnASOISSessionEJBOISSession.java:12: cannot resolve symbol
     [java] symbol  : class EnterpriseBean
     [java] location: package ejb
     [java] import javax.ejb.EnterpriseBean;
     [java]                  ^
     [java] JOnASOISSessionEJBOISSession.java:13: cannot resolve symbol
     [java] symbol  : class RemoveException
     [java] location: package ejb
     [java] import javax.ejb.RemoveException;


__________
Marc Eilens 
Research & Product Development

IMPRESS SOFTWARE AG             Fon: +49 (0)511 - 610 71 - 415     
Rotenburger Strasse 21          Fax: +49 (0)511 - 610 71 - 299
30659 Hannover / Germany        mailto:marc.eilens@impress.com
                                http://www.impress.com
 <<Marc Eilens.vcf>>