我在春天使用加载时间编织。如何在jetty中设置类加载器?
问题描述:
我在春天使用加载时间编织。一切都适用于websphere,因为它有自己的类加载器,但我在开发模式下遇到麻烦,我使用嵌入式jetty。如何在jetty中设置类加载器?
I use load time weaving in spring. All works fine with websphere, because it has own class loader, but i have troubles in dev mode, where i use embedded jetty. How can i set class loader in jetty?
当我运行它时,我看到以下错误
When i run it i see following error
[INFO] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver]: Constructor threw exception; nested exception is java.lang.IllegalStateException: ClassLoader [com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension] does NOT provide an 'addTransformer(ClassFileTransformer)' method.
答
我通过添加-Xbootclasspath解决了这个问题/ a:[jar的路径]作为JvmArgs param。
现在它看起来像
I've resolved it by adding a "-Xbootclasspath/a:[path to jar]" as JvmArgs param. Now it's looks like
<extraJvmArgs>-Xmx4g -XX:MaxPermSize=512m -javaagent:C:\Users\auldanov\.m2\repository\org\springframework\spring-instrument\3.1.4.RELEASE\spring-instrument-3.1.4.RELEASE.jar -Xbootclasspath/a:C:\Users\auldanov\.m2\repository\org\springframework\spring-instrument\3.1.4.RELEASE\spring-instrument-3.1.4.RELEASE.jar</extraJvmArgs>