EclipseLink在远程EJB调用上反序列化一个空的实体对象 [英] EclipseLink deserializes an empty entity object on remote EJB call

查看:108
本文介绍了EclipseLink在远程EJB调用上反序列化一个空的实体对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用包含EclipseLink 2.5.2版的GlassFish 4.1的当前版本。
在此GlassFish中,我部署了一个企业应用程序和一个Web应用程序。
如果返回一个加载的实体的EJB是从GlassFish外部调用的(如外部JavaFX应用程序),那么该实体会被正确返回。



但是,如果从Web应用程序调用相同的EJB,由于此错误,实体未正确返回 GLASSFISH- 17432



我已经在这里找到的解决方法在EJB 3.1中调用远程EJB 并不是真的解决了这个问题,因为如果我在EclipseLink中禁用织入,以下功能将无法正常工作:

@ManyToOne(fetch = FetchType.LAZY)
public Foo getFoo(){
return foo ;


@ManyToOne(fetch = FetchType.EAGER)
public Bar getBar(){
return bar;


解决方案

您可以尝试静态编织作为另一种解决方法。


字节码编织是一种用于更改
编译的Java类的字节码的技术。您可以配置字节码编织来启用
数量的EclipseLink JPA性能优化,其中包括支持
用于一对一和多对一关系的延迟加载,
attribute-级别更改跟踪和提取组。

编织可以在实体类加载
时动态地执行,也可以静态地作为构建过程的一部分执行。 p>

来源



GLASSFISH-16164 你可以试试 eclipselink-staticweave-maven-plugin 。有关静态编织和插件使用的详细说明(或者您可以使用ant)可以在 EclipseLink Wiki



然后,您必须在持久性中设置此属性.xml

 < property name =eclipselink.weavingvalue =static/ > 

另请参阅:


I am using the current release of GlassFish 4.1 with EclipseLink version 2.5.2 included. At this GlassFish, I have an enterprise application and a web application deployed. If an EJB that returns a loaded entity, is called from outside the GlassFish (like an external JavaFX application), the entity is returned properly.

But if the same EJB is called from the web application, the entity is not returned properly due to this bug GLASSFISH-17432.

The workaround I already found here Calling Remote EJB in EJB 3.1 is not really solving this problem, because if I disable the weaving in EclipseLink, the following does not work any more properly:

@ManyToOne(fetch=FetchType.LAZY)
public Foo getFoo() {
    return foo;
}

@ManyToOne(fetch=FetchType.EAGER)
public Bar getBar() {
    return bar;
}

解决方案

You can try static weaving as another workaround.

Byte code weaving is a technique for changing the byte code of compiled Java classes. You can configure byte code weaving to enable a number of EclipseLink JPA performance optimizations, including support for the lazy loading of one-to-one and many-to-one relationships, attribute-level change tracking, and fetch groups.

Weaving can be performed either dynamically when entity classes are loaded, or statically as part of the build process.

(Source)

As suggested in GLASSFISH-16164 you can try the eclipselink-staticweave-maven-plugin. A detailed explanation about static weaving and the usage of the plugin (alternativly you can use ant) can be found in the EclipseLink Wiki.

You then have to set this property in your persistence.xml:

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

See also:

这篇关于EclipseLink在远程EJB调用上反序列化一个空的实体对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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