简体   繁体   English

Java SE和Java EE中的热交换代理

[英]Hotswap agent in Java SE and Java EE

I found that Hotswapagent works different way in SE and EE application. 我发现Hotswapagent在SE和EE应用程序中的工作方式不同。 In SE application I can add a new property to the class (eg private Long x;) without any problem, Hotswap can update the code. 在SE应用程序中,我可以毫无问题地向类中添加新属性(例如,私有Long x;),Hotswap可以更新代码。 But I'm not able to do this in my EE application in a JSF ManagedBean, I got "The virtual machine does not support this operation: schema changes not implemented" . 但是我无法在JSF ManagedBean的EE应用程序中执行此操作 ,得到了“虚拟机不支持此操作:未实现架构更改”

My EE application is a Maven Enterprise Application (ejb,web,ear projects) in Netbeans 8.2 with Wildfly 10. I use DCEVM (jdk1.8.0_112) and Hotswapagent 1.1.0. 我的EE应用程序是带有Wildfly 10的Netbeans 8.2中的Maven企业应用程序(ejb,web,ear项目)。我使用DCEVM(jdk1.8.0_112)和Hotswapagent 1.1.0。

Simple code changes (eg edit method body) are works both in SE and EE applications, but it can't handle new property creation neither in ejb nor in web project. 简单的代码更改(例如,编辑方法主体)在SE和EE应用程序中均可使用,但无论是在ejb还是在Web项目中,它都无法处理新的属性创建。 I'd like to know if I made some mistake in settings or this is because the differences between SE and EE environments. 我想知道是否在设置上犯了一些错误,或者是因为SE和EE环境之间存在差异。 Thanks for any ideas. 感谢您的任何想法。

There's no problem with it. 没问题。 Only when I start application in debug mode. 仅当我以调试模式启动应用程序时。

I would expect the addition of a field to be considered a schema change (in such a case, you would get the exception in both Java SE and Java EE). 我希望添加字段会被视为架构更改(在这种情况下,Java SE和Java EE都会出现异常)。 But Java EE is specific by modification of classes (bytecode) at runtime. 但是Java EE是通过在运行时修改类(字节码)来实现的。 I guess that when you inserted a field, it wasn't just that field what was added, but also some synthetic getter and/or setter was introduced, which was a schema change for sure. 我猜想,当您插入一个字段时,不仅添加了该字段,而且还引入了一些综合的getter和/或setter,这肯定是架构更改。

HotswapAgent works on JVM level, there should be no difference between Java SE and Java EE. HotswapAgent在JVM级别上工作,Java SE和Java EE之间应该没有区别。 Most probably your Wildfly server does not use DCEVM, please check your setup. 您的Wildfly服务器很可能不使用DCEVM,请检查设置。

在这里,您需要配置所有EE应用程序服务器Payara + DCEVM的所有配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM