java.lang.NoClassDefFoundError:Arquillian Test执行期间的oracle / sql / ORAData

时间:2015-11-16 06:19:57

标签: jboss7.x jboss-arquillian dbunit

我是Arquillian的新手,对它的用法有基本的了解。 我在测试执行期间遇到了一个问题,我已经尝试了很多但是无法通过。 我面临的问题与arquillian persistence extension类似。

但遗憾的是还没有得到答复。 让我详细解释一下这个问题。

我们将以下档案层次结构作为部署单位。

  1. XYZ-main.ear
    1.1。 LIB /
    1.2。 XYZ-主lib.jar /
    1.3。 xyz-dao-lib.jar [项目#1.2使用]
    1.4。 common-lib.jar / [项目#1.2使用]
  2. 代码库pom.xml层次结构:

      <module>source</module> <!-- xyz-main-lib.jar -->
      <module>ear</module><!-- xyz-main.ear -->
      <module>test</module><!-- Contains Integration Tests of  xyz-main-lib.jar -->
    

    arquillian.xml,附带测试的pom.xml片段和正在使用的数据集。

    我们使用Oracle 11g作为DB-Unit功能的数据库和Arquillian持久性扩展。 我们需要在测试执行之前保留一些实体,因此我们决定使用arquillian-persistence-extension,但坚持使用'nvarchar2'数据类型。

    测试用例的代码片段:

    @Deployment
    public static EnterpriseArchive createDeployment() {
        EnterpriseArchive mainEar= ShrinkWrap.create(ZipImporter.class, "xyz- main.ear").importFrom(new File(System.getenv("APP_HOME") + "/main- project/ear/target/xyz-main.ear")).as(EnterpriseArchive.class);
        final JavaArchive integrationTestArchive =  ShrinkWrap.create(JavaArchive.class, "tests.jar");
        integrationTestArchive.addClasses(TestClassName.class);
        integrationTestArchive.addAsManifestResource(new  File(Thread.currentThread().getContextClassLoader().getResource("persistence.xml").getFile()), "resources/persistence.xml");
        mainEar.addAsModule(integrationTestArchive);
        return mainEar;
    }
    @Test
    @UsingDataSet("dataset.xml")
    @Transactional
    @Cleanup(phase = TestExecutionPhase.BEFORE, strategy =    CleanupStrategy.USED_ROWS_ONLY)
    public void verifyData(){
        // Verification of persisted object
    }
    

    问题:

    对于阿拉伯数据,我们有' NVARCHAR2 ',例如datat.xml中的AR_DESC。 如果在arquillian.xml中使用org.dbunit.dataset.datatype.DefaultDataTypeFactory并且在NVARCHAR2类型的dataset.xml中没有列,则记录将很容易保留,并带有一些警告,如下所示。

    *(1111, 'NVARCHAR2') not recognized and will be ignored. See FAQ for more information.*
    Potential problem found: The configured data type factory 'class org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the current database 'Oracle' (**e.g. some datatypes may not be supported properly**). In rare cases you might see this message because the list of supported database products is incomplete (list=[derby]). If so please request a java-class update via the forums.If you are using your own IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override getValidDbProducts() to specify the supported database products.
    
    When we update 'datatypeFactory' to org.dbunit.ext.oracle.Oracle10DataTypeFactory it starts throwing a different exception which is sort of annoying for us.
    Provided that ojdbc6.jar is available in ear's lib folder as well as in jboss module.
    
    
     12:12:16,607 WARN  [org.jboss.modules] (pool-1-thread-1) Failed to define class **org.dbunit.ext.oracle.OracleSdoGeometry** in Module "deployment.arquillian-service:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/dbunit/ext/oracle/OracleSdoGeometry (Module "deployment.arquillian-service:main" from Service Module Loader)
      at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:407) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:254) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.Module.loadModuleClass(Module.java:518) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]
      at org.dbunit.ext.oracle.OracleSdoGeometryDataType.<init>(OracleSdoGeometryDataType.java:143) [arquillian-service:]
      at org.dbunit.ext.oracle.OracleDataTypeFactory.<clinit>(OracleDataTypeFactory.java:57) [arquillian-service:]
      at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_45]
      at java.lang.Class.forName(Class.java:190) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationTypeConverter.convert(ConfigurationTypeConverter.java:191) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createConfiguration(ConfigurationImporter.java:153) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createFrom(ConfigurationImporter.java:105) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.loadFromPropertyFile(ConfigurationImporter.java:80) [arquillian-service:]
      at org.jboss.arquillian.persistence.dbunit.configuration.DBUnitConfigurationRemoteProducer.configure(DBUnitConfigurationRemoteProducer.java:43) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.lifecycle.PersistenceTestTrigger.beforeClass(PersistenceTestTrigger.java:99) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
      at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
      at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-service:]
      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:87) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:201) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:422) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:218) [arquillian-service:]
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:166) [arquillian-service:]
      at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-service:]
      at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-service:]
      at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.doRunTestMethod(JMXTestRunner.java:180) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:162) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:120) [arquillian-service:]
      at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:214) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:137) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252) [rt.jar:1.7.0_45]
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [rt.jar:1.7.0_45]
      at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:527)
      at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:263)
      at org.jboss.remotingjmx.protocol.v2.ServerProxy$InvokeHandler.handle(ServerProxy.java:915)
      at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:152)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
      at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
    Caused by: java.lang.NoClassDefFoundError: **oracle/sql/ORAData**
      at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_45]
      at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_45]
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_45]
      at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:338) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:402) [jboss-modules.jar:1.2.0.CR1]
      ... 90 more
    Caused by: java.lang.ClassNotFoundException: oracle.sql.ORAData from [Module "deployment.arquillian-service:main" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]
      ... 95 more
    
    
    12:12:16,622 SEVERE [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (pool-1-thread-1) Failed: com.TestClass.testMethodName:
    java.lang.NoClassDefFoundError: org/dbunit/ext/oracle/OracleSdoGeometry
      at org.dbunit.ext.oracle.OracleSdoGeometryDataType.<init>(OracleSdoGeometryDataType.java:143) [arquillian-service:]
      at org.dbunit.ext.oracle.OracleDataTypeFactory.<clinit>(OracleDataTypeFactory.java:57) [arquillian-service:]
      at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_45]
      at java.lang.Class.forName(Class.java:190) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationTypeConverter.convert(ConfigurationTypeConverter.java:191) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createConfiguration(ConfigurationImporter.java:153) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createFrom(ConfigurationImporter.java:105) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.loadFromPropertyFile(ConfigurationImporter.java:80) [arquillian-service:]
      at org.jboss.arquillian.persistence.dbunit.configuration.DBUnitConfigurationRemoteProducer.configure(DBUnitConfigurationRemoteProducer.java:43) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-service:]
      at org.jboss.arquillian.persistence.core.lifecycle.PersistenceTestTrigger.beforeClass(PersistenceTestTrigger.java:99) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-service:]
      at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
      at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94) [arquillian-service:]
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145) [arquillian-service:]
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116) [arquillian-service:]
      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:87) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:201) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:422) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:218) [arquillian-service:]
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [arquillian-service:]
      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:166) [arquillian-service:]
      at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [arquillian-service:]
      at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [arquillian-service:]
      at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.doRunTestMethod(JMXTestRunner.java:180) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:162) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:120) [arquillian-service:]
      at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:214) [arquillian-service:]
      at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:137) [arquillian-service:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252) [rt.jar:1.7.0_45]
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [rt.jar:1.7.0_45]
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [rt.jar:1.7.0_45]
      at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:527)
      at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:263)
      at org.jboss.remotingjmx.protocol.v2.ServerProxy$InvokeHandler.handle(ServerProxy.java:915)
      at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:152)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
      at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
    Caused by: java.lang.ClassNotFoundException: org.dbunit.ext.oracle.OracleSdoGeometry from [Module "deployment.arquillian-service:main" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]
      ... 82 more
    

    请帮我摆脱这个问题,如果您需要更多信息,请告诉我。

    For attachments, please follow the link

1 个答案:

答案 0 :(得分:0)

此问题已得到解决。

实际问题出在项目结构本身。

以下是问题:

  1. 我们将测试作为模块
  2. 在测试执行期间,我们正在构建.ear文件,并在.ear
  3. 中添加了测试模块jar
  4. 需要多个库的测试模块需要添加为Test模块jar的依赖项(我们在使用ShrinkWrap API制作jar时没有提供这些依赖项)
  5. 我们做了什么:

    1. 我们在EJBs lib模块中使用了测试文件夹

    2. 作为测试配置,我们创建了虚拟战争并添加了所有依赖项,包括EJBs模块jar

    3. 以下是我们在Test Class中所做的示例。

      public static Archive<?> prepareDeploymentArtifact() {
      
              JavaArchive oracleDriver = ShrinkWrap.create(JavaArchive.class, "oracleDriver.jar");
              oracleDriver.merge(Maven.resolver().resolve("com.oracle:ojdbc6:11.2.0.3").withoutTransitivity()
                      .asSingle(JavaArchive.class));
      
              JavaArchive commons = ShrinkWrap.create(JavaArchive.class, "custom-commons-util.jar");
              commons.merge(Maven.resolver().resolve("com.xyx:custom-common-lib:1.0").withoutTransitivity()
                      .asSingle(JavaArchive.class));
      
      
              JavaArchive mqClient = ShrinkWrap.create(JavaArchive.class, "mq-client.jar");
              mqClient.merge(Maven.resolver().resolve("com.ibm.mq:com.ibm.mq.allclient:8.0").withoutTransitivity()
                      .asSingle(JavaArchive.class));
      
              JavaArchive jms = ShrinkWrap.create(JavaArchive.class, "jms.jar");
              jms.merge(Maven.resolver().resolve("javax.jms:javax.jms-api:2.0").withoutTransitivity()
                      .asSingle(JavaArchive.class));
      
              return ShrinkWrap
                      .create(WebArchive.class, "Dummy.war")
                      .addClasses(EJB_To_Be_Tested.class, All_Classes_used_by_EJB.class)
                      .addAsResource(
                              new File(Thread.currentThread().getContextClassLoader().getResource("config.properties")
                                      .getFile()), "resources/config.properties")
                      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsLibraries(oracleDriver)
                      .addAsLibraries(commons).addAsLibraries(mqClient).addAsLibraries(jms);
          }