I am having problems with classpath, when trying to compile an EJB.  I am obviously missing the obvious :--), but I have gone over the classpath setting a number of times and am not able to see the error.  Should I copy the ejb.jar to WEB-INF/lib ?  I did try copying the package to the WEB-INF/classes dir to no avail.
 
I must be missing the obvious....
 
Any suggestions welcome
 
The directory structure is
 
com
|
----- aptsi
        |
        -----applications
                |
                ------ tsm
                        |
                        ------ ejb
                        |
                        ------ web
    etc.
 
The EJB is in ejb and the code is a straight forward:
/*
 * Generated by XDoclet - Do not edit!
 */
package com.aptsi.applications.tsm.ejb;
 
/**
 * Remote interface for HelloWorld.
 * @created December 10, 2005
 */
public interface HelloWorld
   extends javax.ejb.EJBObject
{
   /**
    * Your Logic.
    */
   public java.lang.String helloWorld(  )
      throws java.rmi.RemoteException;
 
}
 
The servlet is also very simple and shown below:
/*
 * Created on Dec 12, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.aptsi.applications.tsm.web.servlets.frontcontroller;
 
 
 
import javax.ejb.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
import com.aptsi.applications.tsm.ejb.HelloWorld;
 

/**
 * @author atsidev
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class RegLogout extends HttpServlet {
 
 public static final int REGISTER = 0;
 public static final int LOGOUT = 1;
 
  public void doProcess (HttpServletRequest request,
    HttpServletResponse response)
  {
       int actionIndex=-99;
   
       String actionJsp[] = {"/register.jsp","/logout.jsp"};
        
           String submitButton = "test";
   submitButton = request.getParameter("submitButton");
 
           if ((submitButton != null) && (submitButton.equals("register")))
          {
           actionIndex = REGISTER;
           } else if ((submitButton != null) && (submitButton.equals("logout")))
           {
           actionIndex = LOGOUT;
           }
           
   //  this is only for testing:
   //  Get the HelloWorld Ejb here and print out a HelloWorld.
   //   
 
   //  Get the context
   Context ctx = new InitialContext();
   ctx = (Context)ctx.lookup("java:comp/env");
   Object o = ctx.lookup("HelloWorld");
   HelloWorldHome home = (HelloWorldHome) PortableRemoteObject.narrow(o, HelloWorldHome.class);
 
   // get the bean remote instance
   //
   HelloWorld h = home.create();
   System.out.println(h.helloWorld());
 
      try
      {
             this.getServletContext().getRequestDispatcher(actionJsp
            [actionIndex]).include(request, response);
      }
    catch(ServletException e)
      {
           System.out.println(e.getMessage());
      }
      catch (IOException ie)
      {
           System.out.println(ie.getMessage());
      } 
  }
  public void doGet (HttpServletRequest request,
                        HttpServletResponse response) 
         
   {
        doProcess(request,response);
    }
 
public void doPost (HttpServletRequest request,
                        HttpServletResponse response)          
     {
        doProcess(request,response);
     }
}
 
The ant build code properties:
dir.src="">dir.lib=src/java/lib
dir.buildroot=./build
dir.build=${dir.buildroot}/classes
dir.build.common=${dir.build}/common
dir.build.ejb=${dir.build}/ejb
 
dir.assemble=${dir.buildroot}/assemble
earDir=${dir.assemble}/ear
warDir=${dir.assemble}/war
ejbDir=${dir.assemble}/ejb
jarDir=${dir.assemble}/jars
earAppDDDir=${earDir}/META-INF/
dir.assemble.warclass=${warDir}/WEB-INF/classes
 
dir.dist=dist
dir.deploydir=C:/aptsi_home/jboss/jboss-3.2.3/server/default/deploy
 
applicationName=tsm
application.dir=${dir.src}applications/${applicationName}
dirs.base=${basedir}
java.dir=${basedir}/aptsi
 
warclassdir=${application.dir}/web/WEB-INF/classes
libdir=${application.dir}/web/WEB-INF/lib
appDDDir=${application.dir}/META-INF/
warDD=${application.dir}/web/WEB-INF
web.dir=${application.dir}/web
app-src.dir=com/aptsi/applications/${applicationName}
ejb.dir=${application.dir}/ejb
common.dir=${application.dir}/common
 
warFile=${applicationName}.war
earFile=${applicationName}.ear
jarFile=${applicationName}.jar
 

dir.base.src="">
 
 
 
The ant build code classpath:
 
     
      <!-- The compile classpath -->
      <path id="compile.classpath">
  <fileset dir="${dir.base.src}">
   <include name="lib/**/*.jar"/>
  </fileset>
  <fileset dir="${dir.base.src}">
   <include name="com/aptsi/applications/**/*.class"/>
   <include name="com/aptsi/applications/tsm/ejb/**/*.class"/>
  </fileset>
      </path>      
 
 
 
The ant buildfile code javac:
      <target name="buildwar" depends="prepare">
       <javac srcdir="${web.dir}" destdir="${dir.assemble.warclass}" debug="on" deprecation="on" optimize="off"
        classpathref="compile.classpath">
       </javac>      
    </target> <!-- truncated for this email, there were a number of copyto elements. -->
 
 
The error message:
    [javac] File to be compiled:
    [javac]     C:\ATSI\Clients\ApTSi\TestingService\demo\testapp\Dev\dev\src\java\com\aptsi\applications\tsm\web\servle
ts\frontcontroller\RegLogout.java
    [javac] C:\ATSI\Clients\ApTSi\TestingService\demo\testapp\Dev\dev\src\java\com\aptsi\applications\tsm\web\servlets\f
rontcontroller\RegLogout.java:16: package com.aptsi.applications.tsm.ejb does not exist
    [javac] import com.aptsi.applications.tsm.ejb.HelloWorld;
    [javac]                                       ^
    [javac] 1 error
 
BUILD FAILED
file:C:/ATSI/Clients/ApTSi/TestingService/demo/testapp/Dev/dev/build.xml:274: Compile failed; see the compiler error out
put for details.
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:844)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to