使用apache-ivy从3.0.5迁移到Spring 3.1:java.lang.IncompatibleClassChangeError:

时间:2012-10-16 18:51:39

标签: spring hibernate maven-2 spring-security dependency-management

我在过去的两周里一直在努力管理Apache Ivy以管理依赖关系,但是每个人在网上谈论的明显的易用性(曾经使用maven / gradle / apache-ivy用于DM)都让我望而却步。有人可以帮忙,看看我做错了什么?我真的很感激。

我正在尝试将现有的Spring / JPA-Hibernate应用程序迁移到最新的Spring和Hibernate发行版:

Spring 3.1.2
Spring Security 3.1.1
Hibernate 4.1

我的环境:

Eclipse Helios
Tomcat 7.23

的ivy.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">    <info
    organisation=""
    module="FocusIvy"
    status="integration">
</info>
<dependencies>  
    <dependency org="org.hibernate" name="com.springsource.org.hibernate.ejb" rev="4.1.0.Final" />
    <dependency org="org.hibernate" name="com.springsource.org.hibernate.annotations" rev="3.4.0.GA-A" />
    <dependency org="org.hibernate.common" name="com.springsource.org.hibernate.annotations.common" rev="4.1.0.Final" />
    <dependency org="org.hibernate" name="com.springsource.org.hibernate" rev="4.1.0.Final" />
    <dependency org="org.hibernate" name="com.springsource.org.hibernate.core" rev="4.1.0.Final" />
    <dependency org="org.hibernate" name="com.springsource.org.hibernate.validator" rev="4.2.0.Final" /> 

    <dependency org="org.springframework" name="org.springframework.core" rev="3.1.2.RELEASE" />
    <dependency org="org.springframework" name="org.springframework.beans" rev="3.1.2.RELEASE" />
    <dependency org="org.springframework" name="org.springframework.context" rev="3.1.2.RELEASE" />
    <dependency org="org.springframework" name="org.springframework.context.support" rev="3.1.2.RELEASE" />
    <dependency org="org.springframework" name="org.springframework.transaction" rev="3.1.2.RELEASE" />
    <dependency org="org.springframework" name="org.springframework.jdbc" rev="3.1.2.RELEASE" />
    <dependency org="org.springframework" name="org.springframework.expression" rev="3.1.2.RELEASE" />  
    <dependency org="org.springframework" name="org.springframework.aop" rev="3.1.2.RELEASE" />
    <dependency org="org.springframework" name="org.springframework.web" rev="3.1.2.RELEASE" /> 
    <dependency org="org.springframework" name="org.springframework.web.servlet" rev="3.1.2.RELEASE" /> 
    <dependency org="org.springframework" name="org.springframework.orm" rev="3.1.2.RELEASE" />

    <dependency org="org.springframework.security" name="org.springframework.security.core" rev="3.1.1.RELEASE" />      
    <dependency org="org.springframework.security" name="org.springframework.security.aspects" rev="3.1.1.RELEASE" />
    <dependency org="org.springframework.security" name="org.springframework.security.taglibs" rev="3.1.1.RELEASE" />
    <dependency org="org.springframework.security" name="org.springframework.security.web" rev="3.1.1.RELEASE" />
    <dependency org="org.springframework.security" name="org.springframework.security.annotation" rev="2.0.6.RELEASE" />

    <dependency org="javax.activation" name="com.springsource.javax.activation"
            rev="1.1.1" />
    <dependency org="net.sourceforge.cglib" name="com.springsource.net.sf.cglib" rev="2.2.0" />             
</dependencies> 
</ivy-module>

ivysettings.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ivysettings>
<settings defaultResolver="defaultChain"
    defaultConflictManager="all" />

<resolvers>
    <url name="com.springsource.repository.bundles.release">
        <ivy
            pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        <artifact
            pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    </url>

    <url name="com.springsource.repository.bundles.external">
        <ivy
            pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        <artifact
            pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    </url>
    <chain name="defaultChain" returnFirst="true">
        <resolver ref="com.springsource.repository.bundles.release" />
        <resolver ref="com.springsource.repository.bundles.external" />
    </chain>
</resolvers>
</ivysettings>

Tomcat服务器启动(和应用程序部署)会导致错误分数:

 WARNING: Unable to load class     [org.springframework.instrument.classloading.jboss.JBossMCAdapter] to check against the     @HandlesTypes annotation of one or more ServletContentInitializers.
 java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2823)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1655)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:1988)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1951)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1840)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1808)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1794)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1214)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:828)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5148)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
 Oct 16, 2012 2:31:42 PM org.apache.catalina.startup.ContextConfig checkHandlesTypes
 WARNING: Unable to load class      [org.springframework.instrument.classloading.jboss.JBossModulesAdapter] to check against   the @HandlesTypes annotation of one or more ServletContentInitializers.
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2823)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1655)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:1988)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1951)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1840)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1808)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1794)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1214)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:828)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5148)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
   Oct 16, 2012 2:31:44 PM org.apache.catalina.startup.ContextConfig checkHandlesTypes

1 个答案:

答案 0 :(得分:0)

警告:无法加载类[org.springframework.instrument.classloading.jboss.JBossMCAdapter]以检查一个或多个ServletContentInitializers的@HandlesTypes注释。 java.lang.IncompatibleClassChangeError:实现类

完美总结 Apache Tomcat服务器不是JBoss服务器

其次它在spring框架内似乎是一个合理的问题,所以有时间看看在Tomcat中加载spring需要哪个设置而不是JBoss