我正在尝试使用 OpenEJB 编写一个简单的 web 服务。我从 TomEE 项目的示例代码(webapps/ejb-webservice)开始:
http://www.apache.org/dyn/closer.cgi/openejb/4.0.0-beta-1/examples-4.0.0-beta-1-src.tar.gz
服务类使用注解:
@Stateless
@WebService(portName = "CalculatorPort",
serviceName = "CalculatorWebService",
targetNamespace = "http://superbiz.org/wsdl")
public class Calculator {
public int sum(int add1, int add2) {
return add1 + add2;
}
public int multiply(int mul1, int mul2) {
return mul1 * mul2;
}
}
一切都很好。将战争部署到服务器也没有问题(我使用的是 TomEE 1.0.0-beta-1-webprofile),但尝试访问此 Web 服务会从内部 OpenEJB 方法触发一系列 NameNotFoundException:
2011-10-27 21:54:32,029 - ERROR - Error in safeBind method
javax.naming.NameNotFoundException: Name openejb is not bound in this Context
...
2011-10-27 21:54:32,031 - ERROR - Error in safeBind method
javax.naming.NameNotFoundException: Name TransactionManager is not bound in this Context
...
2011-10-27 21:54:32,033 - ERROR - Error in safeBind method
javax.naming.NameNotFoundException: Name TransactionSynchronizationRegistry is not bound in this Context
...
2011-10-27 21:54:32,034 - ERROR - Error in safeBind method
javax.naming.NameNotFoundException: Name ORB is not bound in this Context
...
2011-10-27 21:54:32,036 - ERROR - Error in safeBind method
javax.naming.NameNotFoundException: Name HandleDelegate is not bound in this Context
我发现了一个类似查找错误的帖子:
但问题在于名称查找方法的使用。在示例代码中没有明确的查找。
谁能告诉这个问题的根源是什么?