X
xbl
Unregistered / Unconfirmed
GUEST, unregistred user!
代码:
//Home interface for Enterprise Bean: Hello
package hello.ejb;
public interface HelloHome extends javax.ejb.EJBHome
{
//Creates a default instance of Session Bean: Hello
public Hello create() throws
javax.ejb.CreateException,
java.rmi.RemoteException;
}
编译时报错:
C:/JbossAndTomcat/server/default/deploy/hello.war/hello/ejb/HelloHome.java:8: cannot resolve symbol
symbol : class Hello
location: interface hello.ejb.HelloHome
public Hello create() throws
在写这段代码前,我先成功编译了另外2个java 文件:
//1 Remote interface for Enterprise Bean: Hello
package hello.ejb;
public interface Hello extends javax.ejb.EJBObject
{
public String hello() throws java.rmi.RemoteException;
}
//2 Bean implementation class for Enterprise Bean: Hello
package hello.ejb;
public class HelloBean implements javax.ejb.SessionBean {
private javax.ejb.SessionContext mySessionCtx;
//getSessionContext
public javax.ejb.SessionContext getSessionContext() {
return mySessionCtx;
}
//setSessionContext
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
}
//ejbActivate
public void ejbActivate() {
}
//ejbCreate
public void ejbCreate() throws javax.ejb.CreateException {
}
//ejbPassivate
public void ejbPassivate() {
}
//ejbRemove
public void ejbRemove() {
}
// Remote interface
public String hello() {
return "hello , i am a ejb Bean ! time "
+new java.util.Date();
}
}
//Home interface for Enterprise Bean: Hello
package hello.ejb;
public interface HelloHome extends javax.ejb.EJBHome
{
//Creates a default instance of Session Bean: Hello
public Hello create() throws
javax.ejb.CreateException,
java.rmi.RemoteException;
}
编译时报错:
C:/JbossAndTomcat/server/default/deploy/hello.war/hello/ejb/HelloHome.java:8: cannot resolve symbol
symbol : class Hello
location: interface hello.ejb.HelloHome
public Hello create() throws
在写这段代码前,我先成功编译了另外2个java 文件:
//1 Remote interface for Enterprise Bean: Hello
package hello.ejb;
public interface Hello extends javax.ejb.EJBObject
{
public String hello() throws java.rmi.RemoteException;
}
//2 Bean implementation class for Enterprise Bean: Hello
package hello.ejb;
public class HelloBean implements javax.ejb.SessionBean {
private javax.ejb.SessionContext mySessionCtx;
//getSessionContext
public javax.ejb.SessionContext getSessionContext() {
return mySessionCtx;
}
//setSessionContext
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
}
//ejbActivate
public void ejbActivate() {
}
//ejbCreate
public void ejbCreate() throws javax.ejb.CreateException {
}
//ejbPassivate
public void ejbPassivate() {
}
//ejbRemove
public void ejbRemove() {
}
// Remote interface
public String hello() {
return "hello , i am a ejb Bean ! time "
+new java.util.Date();
}
}