我的声明中有以下声明ejb-jar.xml
<enterprise-beans>
<entity>
<description>Simple CMP Entity bean example</description>
<ejb-name>CalculatorBean</ejb-name>
<remote>ejb3.stateless.CalculatorRemote</remote>
<ejb-class>ejb3.stateless.CalculatorBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
</entity>
</enterprise-beans>
我试图从我的 servlet 进行如下查找;
CalculatorRemote calculator = (CalculatorRemote)ic.lookup("java/comp/env/:CalculatorBean");
但它说找不到指定的名称。
我为CalculatorRemote
和 也创建了类CalculatorBean
。
这是CalculatorRemote
@Remote
public interface CalculatorRemote {
public float add(float x, float y);
public float subtract(float x, float y);
public float multiply(float x, float y);
public float division(float x, float y);
}
CalculatorBean
是一个实现CalculatorRemote
。ic 是 InitialContext。