I have a question about ejb,I want to call a class named 'IdentityDAO.java' from a 
ejb named 'CheckPasswordEJB.java'.I put my files in follow directory:
  F:\login\ejb\loginEJB\CheckPassword.java
  F:\login\ejb\loginEJB\CheckPasswordHome.java
  F:\login\ejb\loginEJB\CheckPasswordEJB.java
  F:\login\ejb\loginEJB\IdentityDAO.java

the file "CheckPasswordEJB.java" likes:

package loginEJB;
import javax.ejb.SessionContext;
public class CheckPasswordEJB implements javax.ejb.SessionBean
{
 public void ejbCreate()
 {  }
  ...
  public String logininformation(String username,String password)
 {
  boolean valid;
  IdentityDAO ss=new IdentityDAO();
  valid=ss.verify(username,password);
  System.out.println("ID="+username+",Password="+password);
  System.out.println();
  System.out.println(valid);
  return "OK";
 }
}

The file "CheckPassword.java" likes:

package loginEJB;
public interface CheckPassword extends javax.ejb.EJBObject
{
 String logininformation(String username,String password)
   throws java.rmi.RemoteException;
}

The file "IdentityDAO.java" likes:

class IdentityDAO
{
  public boolean verify(String userName,String userPassword)
 {
    System.out.println("name="+userName+" password="+userPassword);
    return "ok";
  }
}

Then I compile these files,like follows:
F:\login\ejb>javac -classpath .;f:\j2sdkee1.3.1\lib\j2ee.jar loginEJB\*.java

It raise many errors:

.\loginEJB\IdentityDAO.java:13: duplicate class: IdentityDAO
class IdentityDAO
^
loginEJB\CheckPasswordEJB.java:32: cannot resolve symbol
symbol  : constructor IdentityDAO  ()
location: class loginEJB.IdentityDAO
                IdentityDAO ss=new IdentityDAO();
                               ^
loginEJB\CheckPasswordEJB.java:33: cannot resolve symbol
symbol  : method verify  (java.lang.String,java.lang.String)
location: class loginEJB.IdentityDAO
                valid=ss.verify(username,password);
                        ^
3 errors

I don't know why create so many errors,then I add a package in IdentityDAO.java,it 
likes:

package mypackage;
class IdentityDAO
{
  public boolean verify(String userName,String userPassword)
 {
    System.out.println("name="+userName+" password="+userPassword);
    return "ok";
  }
}

Then I put mypackage into EJB files,like that:

the file "CheckPasswordEJB.java" likes:

package loginEJB;
import mypackage.*;
...

and CheckPassword.java and CheckPasswordHome.java is added this statement "import 
mypackage.*;"

Then I recompile files,it like follows:
F:\login\ejb>javac -classpath .;f:\j2sdkee1.3.1\lib\j2ee.jar loginEJB\*.java

compile files successfully. I want to know the reason why the file "IdentityDAO.java" 
must be created a package!The four file in the same directory!!! Why?
Any idea will be appreciated!
Edward

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to