java - Arquillian tool implementation for EJB unit testing -


i working on unit test implementation ejb module. using ejb 3, jboss 7, java ee 7 , jta. using arquillian ejb unit test.

i facing issues while configuring arquillian ejb unit test.

here unit test code:

@runwith(arquillian.class) public class testcountryinfocontrol {      private static final logger logger =                  logger.getlogger(testcountryinfocontrol.class.getname());      @deployment     public static archive<?> createdeployment() {         return shrinkwrap.create(webarchive.class, "test.war")                 .addclasses(countryinfocontrol.class,                             addressparametercontrol.class,                              avstatuscodecontrol.class)                 .addasmanifestresource("meta-inf/persistence.xml", "persistence.xml")                 .addasmanifestresource(emptyasset.instance, "beans.xml");     }      @ejb     private countryinfocontrol countryinfocontrol;      @test     public void callservicetoaddnewusertodb() {         string countrycode = "usa";        system.out.println(countrycode);     } } 

this pom.xml configuration

<!-- jsr-303 (bean validation) implementation --> <!-- provides portable constraints such @email --> <!-- hibernate validator shipped in jboss 7 --> <dependency>     <groupid>org.jboss.arquillian.junit</groupid>     <artifactid>arquillian-junit-container</artifactid>     <scope>test</scope> </dependency>  <dependency>     <groupid>org.jboss.arquillian.protocol</groupid>     <artifactid>arquillian-protocol-servlet</artifactid>     <scope>test</scope> </dependency>  <dependency>     <groupid>junit</groupid>     <artifactid>junit</artifactid>     <scope>test</scope> </dependency>  <profile>     <!-- optional arquillian testing profile executes tests        in jboss instance -->     <!-- profile start new jboss instance, , execute        test, shutting down when done -->     <!-- run with: mvn clean test -parq-jbossas-managed -->     <id>arq-jbossas-managed</id>     <activation>         <activebydefault>true</activebydefault>     </activation>     <dependencies>         <dependency>             <groupid>org.jboss.as</groupid>             <artifactid>jboss-as-arquillian-container-managed</artifactid>             <scope>test</scope>         </dependency>     </dependencies> </profile>  <profile>     <!-- optional arquillian testing profile executes tests        in remote jboss instance -->     <!-- run with: mvn clean test -parq-jbossas-remote -->     <id>arq-jbossas-remote</id>     <dependencies>         <dependency>             <groupid>org.jboss.as</groupid>             <artifactid>jboss-as-arquillian-container-remote</artifactid>             <scope>test</scope>         </dependency>     </dependencies> </profile> 

and code in arqullian.xml

<?xml version="1.0" encoding="utf-8"?> <arquillian xmlns="http://jboss.org/schema/arquillian"    xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"    xsi:schemalocation="http://jboss.org/schema/arquillian         http://jboss.org/schema/arquillian/arquillian_1_0.xsd">     <!-- uncomment have test archives exported file system inspection --> <!--    <engine>  --> <!--       <property name="deploymentexportpath">target/</property>  --> <!--    </engine> -->     <!-- force use of servlet 3.0 protocol containers,         mature -->    <defaultprotocol type="servlet 3.0" />     <!-- example configuration remote jboss 7 instance -->    <container qualifier="jboss" default="true">       <!-- if want use jboss_home environment variable,             delete jbosshome property -->       <!--<configuration>-->          <!--<property name="jbosshome">/path/to/jboss/as</property>-->       <!--</configuration>-->    </container>  </arquillian> 

i getting following exception when executing test case:

    17:27:14,251 info  [org.jboss.as.repository] (management-handler-thread - 2) jbas014900: content added @ location d:\dev\project\gcs\servers\jboss-eap-6.2.2\standalone\data\content\bf\fc95a3d63220d32769c1fd6b2018056be7e761\content 17:27:14,264 info  [org.jboss.as.server.deployment] (msc service thread 1-5) jbas015876: starting deployment of "test.war" (runtime-name: "test.war") 17:27:14,701 error [org.jboss.msc.service.fail] (msc service thread 1-3) msc000001: failed start service jboss.deployment.unit."test.war".post_module: org.jboss.msc.service.startexception in service jboss.deployment.unit."test.war".post_module: jbas018733: failed process phase post_module of deployment "test.war"     @ org.jboss.as.server.deployment.deploymentunitphaseservice.start(deploymentunitphaseservice.java:127) [jboss-as-server-7.3.2.final-redhat-2.jar:7.3.2.final-redhat-2]     @ org.jboss.msc.service.servicecontrollerimpl$starttask.startservice(servicecontrollerimpl.java:1811) [jboss-msc-1.0.4.ga-redhat-1.jar:1.0.4.ga-redhat-1]     @ org.jboss.msc.service.servicecontrollerimpl$starttask.run(servicecontrollerimpl.java:1746) [jboss-msc-1.0.4.ga-redhat-1.jar:1.0.4.ga-redhat-1]     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) [rt.jar:1.7.0_75]     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) [rt.jar:1.7.0_75]     @ java.lang.thread.run(thread.java:745) [rt.jar:1.7.0_75] caused by: java.lang.runtimeexception: jbas018757: error getting reflective information class com.pb.gpp.addressverification.ejb.controller.addressparametercontrol classloader moduleclassloader module "deployment.test.war:main" service module loader     @ org.jboss.as.server.deployment.reflect.deploymentreflectionindex.getclassindex(deploymentreflectionindex.java:72) [jboss-as-server-7.3.2.final-redhat-2.jar:7.3.2.final-redhat-2]     @ org.jboss.as.ee.metadata.methodannotationaggregator.runtimeannotationinformation(methodannotationaggregator.java:58)     @ org.jboss.as.ee.component.deployers.interceptorannotationprocessor.handleannotations(interceptorannotationprocessor.java:107)     @ org.jboss.as.ee.component.deployers.interceptorannotationprocessor.processcomponentconfig(interceptorannotationprocessor.java:92)     @ org.jboss.as.ee.component.deployers.interceptorannotationprocessor.deploy(interceptorannotationprocessor.java:77)     @ org.jboss.as.server.deployment.deploymentunitphaseservice.start(deploymentunitphaseservice.java:120) [jboss-as-server-7.3.2.final-redhat-2.jar:7.3.2.final-redhat-2]     ... 5 more caused by: java.lang.noclassdeffounderror: com/pb/gpp/commons/util/gppexception     @ java.lang.class.getdeclaredfields0(native method) [rt.jar:1.7.0_75]     @ java.lang.class.privategetdeclaredfields(class.java:2499) [rt.jar:1.7.0_75]     @ java.lang.class.getdeclaredfields(class.java:1811) [rt.jar:1.7.0_75]     @ org.jboss.as.server.deployment.reflect.classreflectionindex.<init>(classreflectionindex.java:57) [jboss-as-server-7.3.2.final-redhat-2.jar:7.3.2.final-redhat-2]     @ org.jboss.as.server.deployment.reflect.deploymentreflectionindex.getclassindex(deploymentreflectionindex.java:68) [jboss-as-server-7.3.2.final-redhat-2.jar:7.3.2.final-redhat-2]     ... 10 more caused by: java.lang.classnotfoundexception: com.pb.gpp.commons.util.gppexception [module "deployment.test.war:main" service module loader]     @ org.jboss.modules.moduleclassloader.findclass(moduleclassloader.java:213) [jboss-modules.jar:1.3.3.final-redhat-1]     @ org.jboss.modules.concurrentclassloader.performloadclassunchecked(concurrentclassloader.java:459) [jboss-modules.jar:1.3.3.final-redhat-1]     @ org.jboss.modules.concurrentclassloader.performloadclasschecked(concurrentclassloader.java:408) [jboss-modules.jar:1.3.3.final-redhat-1]     @ org.jboss.modules.concurrentclassloader.performloadclass(concurrentclassloader.java:389) [jboss-modules.jar:1.3.3.final-redhat-1]     @ org.jboss.modules.concurrentclassloader.loadclass(concurrentclassloader.java:134) [jboss-modules.jar:1.3.3.final-redhat-1]     ... 15 more  17:27:14,708 error [org.jboss.as.server] (management-handler-thread - 2) jbas015870: deploy of deployment "test.war" rolled following failure message:  {"jbas014671: failed services" => {"jboss.deployment.unit.\"test.war\".post_module" => "org.jboss.msc.service.startexception in service jboss.deployment.unit.\"test.war\".post_module: jbas018733: failed process phase post_module of deployment \"test.war\"     caused by: java.lang.runtimeexception: jbas018757: error getting reflective information class com.pb.gpp.addressverification.ejb.controller.addressparametercontrol classloader moduleclassloader module \"deployment.test.war:main\" service module loader     caused by: java.lang.noclassdeffounderror: com/pb/gpp/commons/util/gppexception     caused by: java.lang.classnotfoundexception: com.pb.gpp.commons.util.gppexception [module \"deployment.test.war:main\" service module loader]"}} 17:27:14,736 info  [org.jboss.as.server.deployment] (msc service thread 1-2) jbas015877: stopped deployment test.war (runtime-name: test.war) in 28ms tests run: 1, failures: 0, errors: 1, skipped: 0, time elapsed: 11.405 sec <<< failure! com.pb.gpp.addressverification.ejb.controller.testcountryinfocontrol  time elapsed: 11402 sec  <<< error! org.jboss.arquillian.container.spi.client.container.deploymentexception: cannot deploy: test.war     @ org.jboss.as.arquillian.container.archivedeployer.deployinternal(archivedeployer.java:83)     @ org.jboss.as.arquillian.container.archivedeployer.deployinternal(archivedeployer.java:64)     @ org.jboss.as.arquillian.container.archivedeployer.deploy(archivedeployer.java:46)     @ org.jboss.as.arquillian.container.commondeployablecontainer.deploy(commondeployablecontainer.java:145)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller$3.call(containerdeploycontroller.java:161)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller$3.call(containerdeploycontroller.java:128)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller.executeoperation(containerdeploycontroller.java:271)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller.deploy(containerdeploycontroller.java:127)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81)     @ org.jboss.arquillian.container.impl.client.containerdeploymentcontexthandler.createdeploymentcontext(containerdeploymentcontexthandler.java:78)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88)     @ org.jboss.arquillian.container.impl.client.containerdeploymentcontexthandler.createcontainercontext(containerdeploymentcontexthandler.java:57)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88)     @ org.jboss.arquillian.container.impl.client.container.deploymentexceptionhandler.verifyexpectedexceptionduringdeploy(deploymentexceptionhandler.java:50)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88)     @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:135)     @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:115)     @ org.jboss.arquillian.core.impl.eventimpl.fire(eventimpl.java:67)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller$1.perform(containerdeploycontroller.java:95)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller$1.perform(containerdeploycontroller.java:80)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller.foreachdeployment(containerdeploycontroller.java:263)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller.foreachmanageddeployment(containerdeploycontroller.java:239)     @ org.jboss.arquillian.container.impl.client.container.containerdeploycontroller.deploymanaged(containerdeploycontroller.java:79)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81)     @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:135)     @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:115)     @ org.jboss.arquillian.core.impl.eventimpl.fire(eventimpl.java:67)     @ org.jboss.arquillian.container.test.impl.client.containereventcontroller.execute(containereventcontroller.java:101)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81)     @ org.jboss.arquillian.test.impl.testcontexthandler.createclasscontext(testcontexthandler.java:75)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88)     @ org.jboss.arquillian.test.impl.testcontexthandler.createsuitecontext(testcontexthandler.java:60)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94)     @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:88)     @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:135)     @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:115)     @ org.jboss.arquillian.test.impl.eventtestrunneradaptor.beforeclass(eventtestrunneradaptor.java:80)     @ org.jboss.arquillian.junit.arquillian$2.evaluate(arquillian.java:182)     @ org.jboss.arquillian.junit.arquillian.multiexecute(arquillian.java:314)     @ org.jboss.arquillian.junit.arquillian.access$100(arquillian.java:46)     @ org.jboss.arquillian.junit.arquillian$3.evaluate(arquillian.java:199)     @ org.junit.runners.parentrunner.run(parentrunner.java:300)     @ org.jboss.arquillian.junit.arquillian.run(arquillian.java:147)     @ org.apache.maven.surefire.junit4.junit4provider.execute(junit4provider.java:252)     @ org.apache.maven.surefire.junit4.junit4provider.executetestset(junit4provider.java:141)     @ org.apache.maven.surefire.junit4.junit4provider.invoke(junit4provider.java:112)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.apache.maven.surefire.util.reflectionutils.invokemethodwitharray(reflectionutils.java:189)     @ org.apache.maven.surefire.booter.providerfactory$providerproxy.invoke(providerfactory.java:165)     @ org.apache.maven.surefire.booter.providerfactory.invokeprovider(providerfactory.java:85)     @ org.apache.maven.surefire.booter.forkedbooter.runsuitesinprocess(forkedbooter.java:115)     @ org.apache.maven.surefire.booter.forkedbooter.main(forkedbooter.java:75) caused by: java.lang.exception: {"jbas014671: failed services" => {"jboss.deployment.unit.\"test.war\".post_module" => "org.jboss.msc.service.startexception in service jboss.deployment.unit.\"test.war\".post_module: jbas018733: failed process phase post_module of deployment \"test.war\"     caused by: java.lang.runtimeexception: jbas018757: error getting reflective information class com.pb.gpp.addressverification.ejb.controller.addressparametercontrol classloader moduleclassloader module \"deployment.test.war:main\" service module loader     caused by: java.lang.noclassdeffounderror: com/pb/gpp/commons/util/gppexception     caused by: java.lang.classnotfoundexception: com.pb.gpp.commons.util.gppexception [module \"deployment.test.war:main\" service module loader]"}}     @ org.jboss.as.controller.client.helpers.standalone.impl.serverdeploymentplanresultfuture.getactionresult(serverdeploymentplanresultfuture.java:134)     @ org.jboss.as.controller.client.helpers.standalone.impl.serverdeploymentplanresultfuture.getresultfromnode(serverdeploymentplanresultfuture.java:123)     @ org.jboss.as.controller.client.helpers.standalone.impl.serverdeploymentplanresultfuture.get(serverdeploymentplanresultfuture.java:85)     @ org.jboss.as.controller.client.helpers.standalone.impl.serverdeploymentplanresultfuture.get(serverdeploymentplanresultfuture.java:42)     @ org.jboss.as.controller.client.helpers.standalone.serverdeploymenthelper.deploy(serverdeploymenthelper.java:52)     @ org.jboss.as.arquillian.container.archivedeployer.deployinternal(archivedeployer.java:77)     ... 96 more   results :  tests in error:    com.pb.gpp.addressverification.ejb.controller.testcountryinfocontrol: cannot deploy: test.war  tests run: 1, failures: 0, errors: 1, skipped: 0 

i don't know how fix issue.

the problem appears type , name of archive. if you're trying deploy war file, need use webarchive, change deployment like

public static archive<?> createdeployment() {     return shrinkwrap.create(webarchive.class, "test.war") 

and issue should go away.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -