tomcat中的javaagent错误

时间:2015-06-03 06:17:11

标签: java eclipse tomcat

错误:

 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由我添加并保留默认情况..我如何解决此问题?有什么想法吗?

1 个答案:

答案 0 :(得分:0)

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

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

</beans>