问题
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.
回答1:
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>
来源:https://stackoverflow.com/questions/23924916/i-use-load-time-weaving-in-spring-how-can-i-set-class-loader-in-jetty