EJBHome compilation Error


EJB programming & troubleshooting: EJBHome compilation Error

  1. EJBHome compilation Error (6 messages)

    I had written three files AdderHome.java, Adder.java and AdderBean.java and kept in com.ejb package. which i copied here

    When I compile the AdderHome.java files it shows me follwing error

    "Adder interface: can not resolve symbol"

    Though I had successfully compiled Adder.java and AdderBean.java
    All classpath settings are ok.

    These are the files
    The AdderHome Interface

    package com.ejb;

    import java.rmi.RemoteException;
    import javx.ejb.EJBHome;
    import javax.ejb.CreateExcetpion;

    public interface AdderHome extends EJBHome{
    Adder create() throws RemoteExcetion, CreateException;

    The Adder Interface

    package com.ejb;

    import java.rmi.RemoteException;
    import javx.ejb.EJBObject;

    public interface Adder extends EJBObject{

    public int add(int a, int b) throws RemoteException;

    The AdderBean Class

    package com.ejb;

    import java.rmi.RemoteException;
    import javax.ejb.SessionBean;
    import javax.SessionContext;

    public class AdderBean implements SesssionBean{
    public int add( int a, int b)
    System.out.println("From bean classs");
    public void ejbCreate() {
    public void ejbRemove() {
    public void ejbActivate() {
    public void ejbPassivate() {

    public void setSessionContext (SessionContext sc){

    please tell me where I am wrong.

    Thanks in adv.


    Threaded Messages (6)

  2. EJBHome compilation Error[ Go to top ]

    Hi Chintan,
            Check your classpath. I think your local classpath is not porperly set thats why it giving the "Adder interface: can not resolve symbol".Your classpath should contain both j2ee jar and your local package directory path.

      Suresh Babu
  3. EJBHome compilation Error[ Go to top ]

    i already have put ejb.jar in classpath
    so what else i have to put so that i can remove this error. And one thing is that Adder.java is compiled successfully so if it is prob. of classpath then Both Home and Remote interface should not be compiled

  4. EJBHome compilation Error[ Go to top ]

    Hi Parekh,

    try to add your yourPah/com/ejb/ directory in your CLASSPATH
    try to compile files from the 'yourPath' directory
    parekh$yourPah/com/ejb/> cd ..
    parekh$yourPah/com/> cd ..
    parekh$yourPah/> javac com/ejb/*.java

    Nabil Benmira
  5. EJBHome compilation Error[ Go to top ]

    Setting the CLASSPATH variable or using the -classpath command-line option overrides the default ie. current directory, so if you want to include the current directory in the search path, you must include "." in the new settings.
  6. EJBHome compilation Error[ Go to top ]

    Stil I am not able to compile AdderHome.java But i am able to compile Adder.java and AdderBean.java

    Please Help me


  7. EJBHome compilation Error[ Go to top ]

    Hi Chintan,

    This is happening because AdderHome is not able to find Adder while it is being compiled. Since AdderHome refers to Adder, it looks for this in the classpath but does not find it and hence it gives this error. Please make sure Adder is in the classpath. Set the classpath properly.

    Since Adder and AdderBean do not refer to any files(other than the ones which you have imported), they get compiled successfully.

    I know you might have taken care of this thing, but just mentioning it again:

    Try from the command prompt:

    (Say your files are located in c:\a\b)

    c:\a\b> javac com\ejb\AdderHome.java (Set the classpath so that it begins looking for Adder from the current directory)