2 Replies Latest reply on Nov 18, 2013 9:42 AM by metalhamster

    Replace a class inside the deployed war

    metalhamster Newbie

      Hey,

       

       

      In my project a have a EJB bean PersistenceServiceBean that is the link between my data layer and my business layer. Basically it loads some objects from the filesystem and stores them again on the filesystem.

       

      For the testing I'd like to mock this class such that it uses some special test data. Therefore I have created another class with the same name and the same package name. Both classes are the same, expect that the mocked one uses the test data.

       

      Then I have replaced the class file of the old PersistenceServiceBean with the mocked one, but when I deploy the .war file and invoke the function that loads the data, the old PersistenceServiceBean is invoked...

       

      And before I try any more I'd like to know if that what I try to achieve is really possible? Or are there maybe better ways to do it?

       

       

      Cheers,

      metalhamster

        • 1. Re: Replace a class inside the deployed war
          Karel Piwko Master

          Hey,

           

          this is pretty easy if you want to replace a resource. You just delete a path from the archive and add a new one, like here:

           

          https://github.com/aerogear/aerogear-unifiedpush-server-integration-tests/blob/java-migration/src/test/java/org/jboss/aerogear/unifiedpush/test/Deployments.java#L50-L53

           

          However, if you want to replace a class, you need to ensure that classloader picks the right class when your test archive is generated. You can achieve this by three different ways:

           

          1/ Not having original class on classpath - this means loading WAR from other Maven project - like using MavenImporter to build the jar from different pom.xml or maybe do some magic with test classpath in both surefire and IDE

          2/ Making sure that classes on classpath are ordered a right way for you

          3/ Use Arquililan Byteman Extension, deploy original class but modify its bytecode

           

          I'm personally using 1/, as for the 2/, there is a call addClass(String fqcn, ClassLoader cl). So, if you write your own very simple classloader that will load class you need to override from the right location, you'll be able to do that in reproducible manner.

          As for 3/, it depens on how much custom logic you'd need to put into Byteman rules.

           

          Edit: Thinking about that, there is a 4/ option as well - on CDI level. Create PersistenceService interface, let PersistenceServiceBean implement it and in your test do not include it into WAR, but put TestPersistenceServiceBean there instead. In such case, CDI will simply inject your test implementation everywhere.

           

          HTH,

           

          Karel

          1 of 1 people found this helpful
          • 2. Re: Re: Replace a class inside the deployed war
            metalhamster Newbie

            Hi,

             

            when I try to deploy the modified ear, the deployment fails and I get the following error:

             

            server.log:

            [#|2013-11-18T13:13:09.347+0100|SEVERE|glassfish3.1.2|org.apache.catalina.core.ContainerBase|_ThreadID=69;_ThreadName=Thread-2;|ContainerBase.addChild: start:

            org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:5332)

                at com.sun.enterprise.web.WebModule.start(WebModule.java:498)

                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)

                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)

                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)

                at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018)

                at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)

                at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)

                at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)

                at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)

                at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)

                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)

                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)

                at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)

                at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)

                at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)

                at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:321)

                at org.glassfish.admin.rest.resources.TemplateListOfResource.post(TemplateListOfResource.java:180)

                at sun.reflect.GeneratedMethodAccessor437.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)

                at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)

                at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)

                at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)

                at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)

                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)

                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)

                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)

                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)

                at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)

                at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)

                at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)

                at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)

                at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)

                at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)

                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)

                at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)

                at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)

                at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)

                at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)

                at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                at java.lang.Thread.run(Thread.java:722)

            Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener

                at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2743)

                at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:1966)

                at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:235)

                at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:94)

                at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:274)

                at com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:172)

                at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:149)

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:5329)

                ... 62 more

            Caused by: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener

                at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2853)

                at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:4806)

                at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1599)

                at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2740)

                ... 69 more

            Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener

                at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:315)

                at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:761)

                at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:1987)

                at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2851)

                ... 72 more

            Caused by: java.lang.NullPointerException

                at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:477)

                at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:420)

                at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:299)

                ... 75 more

            |#]

             

             

            [#|2013-11-18T13:13:09.350+0100|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=69;_ThreadName=Thread-2;|java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener

            java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener

            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:921)

                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)

                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)

                at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018)

                at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)

                at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)

                at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)

                at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)

                at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)

                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)

                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)

                at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)

                at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)

                at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)

                at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:321)

                at org.glassfish.admin.rest.resources.TemplateListOfResource.post(TemplateListOfResource.java:180)

                at sun.reflect.GeneratedMethodAccessor437.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)

                at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)

                at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)

                at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)

                at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)

                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)

                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)

                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)

                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)

                at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)

                at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)

                at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)

                at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)

                at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)

                at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)

                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)

                at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)

                at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)

                at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)

                at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)

                at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

            at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                at java.lang.Thread.run(Thread.java:722)

            |#]

             

             

            [#|2013-11-18T13:13:09.352+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=69;_ThreadName=Thread-2;|Exception while invoking class com.sun.enterprise.web.WebApplication start method

            java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener

                at com.sun.enterprise.web.WebApplication.start(WebApplication.java:138)

                at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)

                at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)

                at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)

                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)

                at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)

                at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)

                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)

                at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)

                at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)

                at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:321)

                at org.glassfish.admin.rest.resources.TemplateListOfResource.post(TemplateListOfResource.java:180)

                at sun.reflect.GeneratedMethodAccessor437.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)

                at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)

                at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)

                at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)

                at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)

                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

                at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)

                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)

                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)

                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)

                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)

                at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)

                at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)

                at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)

                at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)

                at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)

                at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)

                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)

            at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)

                at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)

                at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)

                at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)

                at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                at java.lang.Thread.run(Thread.java:722)

            |#]

            Has anyone an idea what the problem may be?

             

             

            EDIT:

            I just deployed the modified ear manually, i.e. I exported it to the file system and then used the command I normally use to deploy it. And it worked!

            Is it possible to specify how Arquillian exactly deploys the generated ear? Maybe it is just an argument that I have to set or so...

             

            EDIT2:

            Normally I deploy the ear like this:

            /opt/container/myapp/glassfish3/glassfish/bin/asadmin --port 9900 --user admin --passwordfile /opt/container/myapp/glassfish3/glassfish/domains/domain1/config/pwcache_admin.txt deploy --name myapp-application --contextroot /myapp-application --force=true /home/projects/myapp/myapp-application/build/myapp-application-0.0.0.0_dev-SNAPSHOT.ear

             

            My arquillian.xml:

            <?xml version="1.0"?>

            <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xmlns="http://jboss.org/schema/arquillian"

                xsi:schemaLocation="http://jboss.org/schema/arquillian

                http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

             

                <container qualifier="glassfish" default="true">

                    <configuration>

                        <property name="glassFishHome">/opt/container/myapp</property>

                        <property name="adminHost">localhost</property>

                        <property name="adminPort">9900</property>

                        <property name="adminUser">admin</property>

                        <property name="adminPassword">admin</property>

                     </configuration>

                </container>

            </arquillian>

             

            Cheers,

            metalhamster