在EJB 3.1中调用远程EJB [英] Calling Remote EJB in EJB 3.1

查看:115
本文介绍了在EJB 3.1中调用远程EJB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用相同的glassfish(最终版本3.1)从另一个Web应用程序调用远程无状态EJB,这将返回Entity Bean(JPA 2/Eclipselink).我通过依赖注入在Web应用程序中获取ejb引用>(@EJB),但实体变为空.我在Google上对其进行了搜索,发现它可能是可序列化的问题.我在某个地方找到了

I need to call Remote stateless EJB from another Web application with in same glassfish( 3.1 final version) which return Entity Bean( JPA 2/Eclipselink).Iam getting ejb referance in web application through Dependancy Injection ( @EJB ) but entity becoming null.I google it and found that it is might be Serializable issue. Somewhere I found this

TopLink修改实体类 (编织"它们)负载或替代 运行时的集合访问权限为 能够检测懒惰访问或 修改的关系(没有 没有这个就可以支持延迟加载的方法 或子类化或在以下位置使用代理 运行).这给我们带来了一个非常 要点:您不应该使用 反映访问实体,但是 仅通过其业务方法 编织的实体在 服务器并在客户端反序列化 没有对应的 编织的实体,serialVersionUIDs 将不匹配,因为 值包括类字段和 方法.

TopLink either modifies entity classes ("weaves" them) on load or substitutes collection access at runtime to be able to detect lazily accessed or modified relationships (there is no way to support lazy load without this or subclassing or using a proxy at runtime). Which brings us to a very important point: you shouldn't use reflection to access an entity, but only via its business methods.When a weaved entity is serialized on the server and deserialized on the client that doesn't have its corresponding entity weaved, the serialVersionUIDs won't match as the calculation of the value includes class fields and methods.

那么我需要在应用程序上进行DTO转换吗?

So do I need DTO convertion on my application ???

推荐答案

也许您正受到 Glassfish错误16164 .

建议的解决方法是将此属性添加到persistence.xml:

The suggested workaround is to add this property to persistence.xml:

<property name="eclipselink.weaving" value="false"/>

这解决了我的问题.

这篇关于在EJB 3.1中调用远程EJB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆