4 Replies Latest reply on Sep 21, 2011 12:32 PM by Aslak Knutsen

    InjectionTestCase fails in Remote Glassfish and not in embedded, with no logs written

    Vineet Reynolds Apprentice

      The usecase is attached, but it is mostly the same as the InjectionTestCase unit test from Arquillian Core. I've added a separate profile to allow the test to be executed on a remote Glassfish instance as an in-container test, and I receive the following stacktrace:

       

      -------------------------------------------------------------------------------

      Test set: com.acme.ejb.InjectionTestCase

      -------------------------------------------------------------------------------

      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 32.227 sec <<< FAILURE!

      shouldBeAbleToInjectEJB(com.acme.ejb.InjectionTestCase)  Time elapsed: 3.822 sec  <<< ERROR!

      java.lang.NullPointerException

          at com.acme.ejb.InjectionTestCase.shouldBeAbleToInjectEJB(InjectionTestCase.java:58)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

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

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

          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

          at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:246)

          at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

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

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

          at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

          at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

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

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:82)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

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

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

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

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

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

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

          at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)

          at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:239)

          at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:202)

          at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)

          at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)

          at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:216)

          at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)

          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

          at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:161)

          at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)

          at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)

          at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175)

          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

          at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:123)

          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)

          at org.junit.runner.JUnitCore.run(JUnitCore.java:136)

          at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)

          at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160)

          at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)

          at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

          at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

          at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

          at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

          at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

          at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

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

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

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

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

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

          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:662)

       

      It was quite evident that injection of the EJB instance into the test class had failed. Worse, the Glassfish logs did not write any messages, even when the following entry was added to logging.properties:

       

      org.jboss.arquillian.level=FINEST

       

      Other log entries generated by loggers for other classes were written to server.log, but not the ones generated by Arquillian. Remote debugging revealed that the log variables, i.e. the java.util.Logger instances used Arquillian, in the EJBEnricher extension (and elsewhere) were null. However, no NullPointerExceptions were thrown, which indicates quite a different problem.

       

      My questions would be:

       

      1. Does Arquillian support enrichment of in-container tests deployed on a remote Glassfish instance? If not, where does one begin implementing support for this?

      2. How does one get Glassfish to write the log messages issued by Arquillian of level INFO/FINE/FINEST (or any other level)?