服務器:JBoss的7.1.1 EJB 3.0 的Eclipse朱諾EJB Web服務的ClassNotFoundException
我使用EJB 3.0通過我的第一個Web服務項目工作,正在到我的客戶端上的問題。對於我的客戶,我組建了一個servlet。問題是當我嘗試時:
CalculatorOps calculator = (CalculatorOps)context.lookup("java:global/EJBCalculatorWS/CalculatorImp!math.CalculatorOps");
我在查找時出現ClassNotFoundException。我得到這個JNDI從我的JBoss的server.log
[org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named CalculatorImp in deployment unit deployment "EJBCalculatorWS.war" are as follows:
java:global/EJBCalculatorWS/CalculatorImp!math.CalculatorOps
java:app/EJBCalculatorWS/CalculatorImp!math.CalculatorOps
java:module/CalculatorImp!math.CalculatorOps
我有2個網絡項目,WS和客戶端,都添加到服務器和WS是在客戶端的構建路徑。
------------- ------------ CODE
接口
package math;
@Local
public interface CalculatorOps {
public int add(int a, int b);
public int subtract(int a, int b);
}
類
package math;
@Stateless(mappedName="TheCalc")
@WebService
public class CalculatorImp implements CalculatorOps{
@Override
public int add(int a, int b) {
return a+b;
}
@Override
public int subtract(int a, int b) {
return a-b;
}
}
Servlet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
CalculatorOps calculator = (CalculatorOps)context.lookup("java:global/EJBCalculatorWS/CalculatorImp!math.CalculatorOps");
}
現在面臨同樣的issue.Were以能找到原因?謝謝 – RVP