错误:

 SEVERE: Exception sending context initialized event to listener instance
 of class org.springframework.web.context.ContextLoaderListener

 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': Initialization of bean failed; nested
 \exception is java.lang.IllegalStateException: ClassLoader
 [org.apache.catalina.loader.WebappClassLoader] does NOT provide an
 'addTransformer(ClassFileTransformer)' method. Specify a custom
 LoadTimeWeaver or start your Java virtual machine with Spring's agent:
 -javaagent:spring-agent.jar


但是我的tomcat VM参数中有javaagent

 -Dext.prop.dir="/home/gopi/Desktop/REST_CONFIG" -javaagent:/home/gopi/.m2
 /repository/org/springframework/spring-agent/2.5.6/spring-agent-
 2.5.6.jar -Dcatalina.base="/opt/apache-tomcat-7.0.62"
 -Dcatalina.home="/opt/apache-tomcat-7.0.62" -Dwtp.deploy="/opt/apache-
  tomcat-7.0.62/wtpwebapps" -Djava.endorsed.dirs="/opt/apache-tomcat-
  7.0.62/endorsed"


默认情况下,我添加的-Dext.prop.dir and -javaagent是其余的。.如何解决此问题?有任何想法吗?

最佳答案

我想您需要在下面指定要使用的loadTimeWeaver。有关详细信息,请参见here

 <context:load-time-weaver
            weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>

</beans>

10-08 02:07