java.lang.VerifyError, Incompatible argument to function

問題:
     在搞QuickFIXJ 的時候,遇到:

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xmlasia.fox.fix.server.GatewayConnector]: Constructor threw exception; nested exception is java.lang.VerifyError
class: org/quickfixj/jmx/mbean/session/SessionAdmin, method: resetSequence signature: (I)V) Incompatible argument to function
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:111)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:237)
    ... 49 more
Caused by: java.lang.VerifyError: (class: org/quickfixj/jmx/mbean/session/SessionAdmin, method: resetSequence signature: (I)V) Incompatible argument to function
    at org.quickfixj.jmx.mbean.session.SessionJmxExporter.export(SessionJmxExporter.java:28)
    at org.quickfixj.jmx.mbean.connector.ConnectorJmxExporter.export(ConnectorJmxExporter.java:66)
    at org.quickfixj.jmx.mbean.connector.ConnectorJmxExporter.export(ConnectorJmxExporter.java:46)
    at org.quickfixj.jmx.JmxExporter.export(JmxExporter.java:60)

原因: 版本沖突,用maven 管理classpath,但classpath里至少有兩個jar里有一樣的class,一個是用1.5build(QuickFIXJ),一個是用1.6build(自己的jar),在JMX Export的時候,拿了1.6的class放到1.5中。


辦法: 可通過maven dependency的priority, 因為dependency在pom.xml的先后是會造成其在classpath的優先順序。

你可能感兴趣的:(java,maven,bean,xml)