当前位置: 技术问答>java相关
各位好,我在用weblogic 写ejb的时候,出现一下问题。
来源: 互联网 发布时间:2017-04-07
本文导语: 报错内容: HelloHome.java:3: cannot resolve symbol symbol : class CreateException location: package ejb import javax.ejb.CreateException; ^ HelloHome.java:4: cannot resolve symbol symbol : class EJBHome location: package ejb ...
报错内容:
HelloHome.java:3: cannot resolve symbol
symbol : class CreateException
location: package ejb
import javax.ejb.CreateException;
^
HelloHome.java:4: cannot resolve symbol
symbol : class EJBHome
location: package ejb
import javax.ejb.EJBHome;
^
HelloHome.java:7: cannot resolve symbol
symbol : class EJBHome
location: interface HelloHome
public interface HelloHome extends EJBHome {
^
HelloHome.java:9: cannot resolve symbol
symbol : class CreateException
location: interface HelloHome
Hello create() throws CreateException, RemoteException;
*******************************
源代码如下:
//本接口需要引入的类或接口
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
//定义主接口,必须继承EJBHome
public interface HelloHome extends EJBHome {
//定义EJB创建方法
Hello create() throws CreateException, RemoteException;
}
为什么呢? 是不是ejb的环境没有配好,提示是没有ejb.jar,请问怎么处理呢?
HelloHome.java:3: cannot resolve symbol
symbol : class CreateException
location: package ejb
import javax.ejb.CreateException;
^
HelloHome.java:4: cannot resolve symbol
symbol : class EJBHome
location: package ejb
import javax.ejb.EJBHome;
^
HelloHome.java:7: cannot resolve symbol
symbol : class EJBHome
location: interface HelloHome
public interface HelloHome extends EJBHome {
^
HelloHome.java:9: cannot resolve symbol
symbol : class CreateException
location: interface HelloHome
Hello create() throws CreateException, RemoteException;
*******************************
源代码如下:
//本接口需要引入的类或接口
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
//定义主接口,必须继承EJBHome
public interface HelloHome extends EJBHome {
//定义EJB创建方法
Hello create() throws CreateException, RemoteException;
}
为什么呢? 是不是ejb的环境没有配好,提示是没有ejb.jar,请问怎么处理呢?
|
不是没有ejb.jar,看看是不是你在创建文件的时候,没有把weblogic.jar这个包给放进去,要是没有放进去的话,就会报错的,weblogic中,把ejb.jar包,放在了weblogic.jar里面了,所以,一定要有这个包!
|
应当是设置环境变量时weblogic.jar的路径设置的不对,你查找weblogic.jar,然后解压,看看里面是否有ejb就ok了,