Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jetty-maven-plugin and loadTimeWeaver

can't seem to have my spring webapp working with jetty-maven pluging

i always get

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [org.eclipse.jetty.webapp.WebAppClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar

though i have:

  • set MAVEN_OPTS to javaagent:/Users/blabla/.m2/repository/org/springframework/spring-instrument/3.1.3.RELEASE/spring-instrument-3.1.3.RELEASE.jar
  • set JAVA_OPTIONS to the same thing
  • added dep to spring-instrument and spring-aspects
  • added jvmArgs with -javaagent:.... to jetty-maven-plugin configuration
like image 358
mfirry Avatar asked Dec 10 '12 10:12

mfirry


People also ask

What is Maven Jetty plugin?

The Jetty Maven plugin is useful for rapid development and testing. You can add it to any webapp project that is structured according to the usual Maven defaults. The plugin can then periodically scan your project for changes and automatically redeploy the webapp if any are found.

What does Mvn jetty run do?

Using the Jetty Plugin enables you to quickly test your web application by skipping the last two steps. By default the Jetty Plugin scans target/classes for any changes in your Java sources and src/main/webapp for changes to your web sources.

How to stop jetty server from Maven?

To start a Jetty Server, you can type the following command. The only way to stop the Jetty Server is by pressing Ctrl + C in the shell prompt.


1 Answers

Probably you are missing few jars aspectjweaver aspectjrt spring-instrument

Additionally you may want to try explicitly defining the bean loadTimeWeaver in applicationcontext.xml file.

    <property name="loadTimeWeaver">
        <bean id="instrumentationLoadTimeWeaver" class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
    </property>
like image 70
Parvez Avatar answered Sep 30 '22 03:09

Parvez