有人可以帮我这个吗?
每当我使用Maven命令mvn clean verify启动集成测试时。我收到错误java.lang.NoClassDefFoundError:无法初始化类。
我正在使用Maven 3.0.2,JUnit4和故障安全插件(v2.18)来运行集成测试。
我的集成和单元测试的pom.xml配置:
<!--Plugin to lauch unit and integration tests-->
<plugin>
<!-- Separates the unit tests from the integration tests. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Skip the default running of this plug-in (or everything is run twice...see below) -->
<skip>true</skip>
<!-- Show 100% of the lines from the stack trace (doesn't work) -->
<trimStackTrace>false</trimStackTrace>
</configuration>
<executions>
<execution>
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!-- Never skip running the tests when the test phase is invoked -->
<skip>false</skip>
<includes>
<!-- Include unit tests within integration-test phase. -->
<include>**/*Test.java</include>
</includes>
<excludes>
<!-- Exclude integration tests within (unit) test phase. -->
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<excludes>
<exclude>**/*Test.java</exclude>
</excludes>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
这是测试报告
运行com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT 测试运行:3,失败:3,错误:0,跳过:0,经过的时间:0秒&lt;&lt;&lt;失败! - 在com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT中 com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT.test_createANewICEDefinitionVersion_Version_ICEDefDependantWithNewParameterName_ICEdVersionnedHasNoCache_IT()时的时间间隔:0秒-1;&LT;&LT;失败! java.lang.NoClassDefFoundError:无法初始化类com.dps.fr.adn.adnGenericDao.utils.HibernateUtils at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager $ Info。(ADNHbSessionManager.java:49) at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager.startSession(ADNHbSessionManager.java:65) at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager.iNeedASession(ADNHbSessionManager.java:134) 在com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManagerAspect.ajc $之前$ com_dps_fr_adn_hbSessionOnDemand_ADNHbSessionManagerAspect $ 1 $ 82350913(ADNHbSessionManagerAspect.aj:39) at com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT.test_createANewICEDefinitionVersion_Version_ICEDefDependantWithNewParameterName_ICEdVersionnedHasNoCache_IT(VersionningWithDependentICEdWithoutCacheTestIT.java:141)
com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT.test_createANewICEDefinitionVersion_Version_ICEDefDependantWithNewParameterUnit_ICEdVersionnedHasNoCache_IT()时的时间间隔:0秒-1;&LT;&LT;失败! java.lang.NoClassDefFoundError:无法初始化类com.dps.fr.adn.adnGenericDao.utils.HibernateUtils at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager $ Info。(ADNHbSessionManager.java:49) at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager.startSession(ADNHbSessionManager.java:65) at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager.iNeedASession(ADNHbSessionManager.java:134) 在com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManagerAspect.ajc $之前$ com_dps_fr_adn_hbSessionOnDemand_ADNHbSessionManagerAspect $ 1 $ 82350913(ADNHbSessionManagerAspect.aj:39) at com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT.test_createANewICEDefinitionVersion_Version_ICEDefDependantWithNewParameterUnit_ICEdVersionnedHasNoCache_IT(VersionningWithDependentICEdWithoutCacheTestIT.java:233)
com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT.test_createANewICEDefinitionVersion_Version_ICEDefDependantWithNewParamDescription_ICEdVersionnedHasNoCache_IT()时的时间间隔:0秒-1;&LT;&LT;失败! java.lang.NoClassDefFoundError:无法初始化类com.dps.fr.adn.adnGenericDao.utils.HibernateUtils at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager $ Info。(ADNHbSessionManager.java:49) at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager.startSession(ADNHbSessionManager.java:65) at com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManager.iNeedASession(ADNHbSessionManager.java:134) 在com.dps.fr.adn.hbSessionOnDemand.ADNHbSessionManagerAspect.ajc $之前$ com_dps_fr_adn_hbSessionOnDemand_ADNHbSessionManagerAspect $ 1 $ 82350913(ADNHbSessionManagerAspect.aj:39) 在com.dps.fr.adn.adnKCMTest.service.VersionningWithDependentICEdWithoutCacheTestIT.test_createANewICEDefinitionVersion_Version_ICEDefDependantWithNewParamDescription_ICEdVersionnedHasNoCache_IT(VersionningWithDependentICEdWithoutCacheTestIT.java:332)