解惑

解己之惑,解人之惑

标签:hot deploy

使用AOP带来的问题

AOP绝对是个好东西,但是因为大部分的AOP实现都是通过修改字节码实现的,这就给Hot Deploy带来问题,在进行Hot Code Replace的时候JVM会抛错:Hot code replace failed – Hierarchy change not implemented,根据字面的意思,我猜测是JVM判断出原始的字节码有变化,但是JVM中的字节码是修改过的,类似子类的结构。目前还没有找到比较权威的解释,另外我对AOP也不是很熟悉,所以仅仅是猜测

Hot Deploy成功

前几天曾经抱怨新公司的开发环境太复杂,不能Hot Deploy,极其影响开发的效率,今天成功的在Eclipse(实际上是MyEclipse)中配置好了可以Hot Deploy的环境,其实也很简单,我们的工程发布非常的复杂,sar, ear, har, jar, war一个套一个,要想严格的按照那个目录结果配置工程几乎不可能,但是要想Hot Deploy很简单,配置一个Web工程,引入全部的工程需要的类,把Jar包修改为手工发布,然后使用MyEclipse的Manage Deployment发布,只要你的这个web工程先于原来的工程发布就行了,对于同名的类,由于新的工程先加载,所以也就可以达到Hot Deploy的目的了,现在修改了源代码,保存一下就可以生效了,爽啊

更新:
关于类加载,找到理论依据:
Packaging J2EE applications for JBOSS 3.2.1

By default, all the EARs in a jboss instance, under, JBOSS_HOME/server/jboss-instance-name/deploy/ use the same loader repository and hence, a class found in one can be used by the other. But we don’t like calling this bug a feature as it goes against the idea of scoping by EAR. Fortunately, JBoss provides a way to supress this behaviour through what they call as deployment based scoping.

© 2024 解惑

本主题由Anders Noren提供向上 ↑