@Local注释和@Remote注释不能一起使用

来源:互联网 发布:热血传奇装备数据库 编辑:程序博客网 时间:2024/05/10 12:05

EJB @Local注释和@Remote注释不能一起使用 :Remote和Local方式写在同一个类上,在部署到jboss4.0可以,jboss5.0报错

在4.X版本上就可以同时写在一个类上,代码如下:

5.0版本就不行,报错如下:
Caused by: java.io.InvalidClassException: org.jboss.ejb3.remoting.IsLocalInterceptor; local class incompatible:stream classdesc serialVersionUID = -3758782076801249473, local classserialVersionUID = 337700910587744646
DEPLOYMENTS IN ERROR:
Deployment"vfsfile:/E:/javaprogram/jboss-5.0.1.GA/server/default/deploy/ejb_03.jar/"is in error due to the following reason(s):javax.ejb.EJBException: Cannot designateboth javax.ejb.Local and javax.ejb.Remote annotations without 'value' attributeon UserManagerBean. [EJBTHREE-1025]
问题具体描述及解决:
http://topic.csdn.net/u/20090202/20/b888766f-5fd4-40a3-b886-bd1e04c6f758.html
jboss4.x版本可以一个接口定义为remote和local两种方式,jboss5.0版本的则需要定义两个接口,并明确写明(当然具体实现的方式有多种):代码如下:

[java] view plaincopyprint?
  1. public interface UserManager {
  2. public void save(UserTest user);
  3. }
  4. public interface UserManagerLocal {
  5. public void save(UserTest user);
  6. }
  7. @Stateless
  8. @Remote({UserManager.class})
  9. @Local({UserManagerLocal.class})
  10. public class UserManagerBeanimplements UserManager, UserManagerLocal{
  11. public void save(UserTest user) {
  12. System.out.println("User[username=" + user.getUsername() +"]已保存" );
  13. user.setId(1);
  14. }
  15. }

 

原创粉丝点击