访问 TomEE 上的 OpenEJB 示例 Web 服务时出现查找错误
我正在尝试使用 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
我发现了一个类似的帖子查找错误:
但问题是使用名称查找方法。在示例代码中没有显式查找。
谁能说出这个问题的根源是什么?
I'm trying to write a simple webservice using OpenEJB. I started with an example code (webapps/ejb-webservice) from TomEE project:
http://www.apache.org/dyn/closer.cgi/openejb/4.0.0-beta-1/examples-4.0.0-beta-1-src.tar.gz
The service class uses annotations:
@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;
}
}
Everything builds just fine. No problem with deploying the war to the server either (I'm using TomEE 1.0.0-beta-1-webprofile), but trying to access this webservice triggers a series of NameNotFoundException from an internal OpenEJB method:
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
I found a post with similar lookup error:
but the problem there was the use of name lookup method. In the example code there are not explicit lookups.
Can anyone tell what might be the source of this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其移至答案,因为它可能会帮助其他人看到它在 stackoverflow 搜索中列为已解决。
解决方案是使用 TomEE Plus,它除了支持 JAX-WS 和 JAX-RS 和 JMS 等其他技术外,还支持 JAX-WS。
Moving this to an answer as it might help others to see it listed as solved in the stackoverflow search.
Solution is to use TomEE Plus which supports JAX-WS in addition to some other technologies like JAX-RS and JMS.