[
https://issues.jboss.org/browse/ARQ-1889?page=com.atlassian.jira.plugin.s...
]
Saurabh Agarwal commented on ARQ-1889:
--------------------------------------
Hi Gerhard,
I have referred to ARQ-1488 before opening this issue.
The test case you have mentioned in working for me in one condition and that is the code
should be deployed by Arquillian framework as documented.
However my setup & infrastructure is little different as
1. We are using WAS 8.5 (Not important difference I believe)
2. The code is already deployed on our servers and we don't want Arquillian should
build & Deploy code before executing the test case.
For point 2 above we have commented out some portion of code in
https://github.com/arquillian/arquillian-container-was/blob/master/was-re...
I am attaching my file which depicts my test case. I am getting a null pointer exception
(Assertion error) at line 65.
Also I am attaching the complete stacktrace if this helps.
CDI Injection not working in WebSphere Containers (V8)
------------------------------------------------------
Key: ARQ-1889
URL:
https://issues.jboss.org/browse/ARQ-1889
Project: Arquillian
Issue Type: Bug
Components: WebSphere Containers
Affects Versions: was_1.0.0.Beta1
Environment: Windows 7, IBM WebSphere Application Server (8.0.0.9), IBM RSA 8
Reporter: Saurabh Agarwal
Priority: Blocker
Hi,
I have gone through ARQ-1488 and it depicts the same problem what I am facing.
In my IBM WebSphere Application Server (8.0.0.9), CDI is not working and it is giving me
the NP exception.
Please note I am not using MAVEN build but have all required JARS file in my web-inf/lib
directory
JARS List I am having
------------------------------
arquillian-config-api.jar
arquillian-config-impl-base.jar
arquillian-config-spi.jar
arquillian-container-impl-base.jar
arquillian-container-spi.jar
arquillian-container-test-api.jar
arquillian-container-test-impl-base.jar
arquillian-container-test-spi.jar
arquillian-core-api.jar
arquillian-core-impl-base-1.1.5.Final.jar
arquillian-core-spi-1.1.5.Final.jar
arquillian-junit-container.jar
arquillian-junit-core.jar
arquillian-protocol-jmx-1.1.5.Final.jar
arquillian-protocol-servlet.jar
arquillian-protocol.jar
arquillian-test-api.jar
arquillian-test-impl-base.jar
arquillian-test-spi.jar
arquillian-testenricher-cdi.jar
arquillian-testenricher-ejb.jar
arquillian-testenricher-initialcontext.jar
arquillian-testenricher-resource.jar
arquillian-was-remote.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
deltaspike-core-api-1.0.0.jar
deltaspike-core-impl-1.0.0.jar
deltaspike-jsf-module-api-1.0.0.jar
deltaspike-jsf-module-impl-1.0.0.jar
deltaspike-security-module-api-1.0.0.jar
deltaspike-security-module-impl-1.0.0.jar
itext-1.3.jar
jsfcore.jar
junit.jar
org.hamcrest.core_1.3.0.v201303031735.jar
poi-3.8-20120326.jar
primefaces-4.0.6.jar
shrinkwrap-api.jar
shrinkwrap-descriptors-api-base.jar
shrinkwrap-descriptors-api-javaee.jar
shrinkwrap-descriptors-impl-base.jar
shrinkwrap-descriptors-impl-javaee.jar
shrinkwrap-descriptors-spi.jar
shrinkwrap-impl-base.jar
shrinkwrap-spi.jar
Code snippet
------------------
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.ford.jcoe.jab.inbound.booking.ui.bean.ListBookingBean;
import com.ford.jcoe.jab.inbound.booking.ui.bean.TestArquillianBean;
/**
* TODO - Place class description here
*/
@RunWith(Arquillian.class)
public class ArquillianInjectionTest extends BaseArquillianPersistenceTest {
@Inject
ListBookingBean b;
/**
* TODO - Place method description here
*
* @return
*/
@Deployment
public static EnterpriseArchive createTestArchive() {
java.net.Authenticator.setDefault(basicAuthAuthenticator);
return BaseArquillianPersistenceTest.createTestArchive("JabEAR");
}
/**
* Unit Test Method
*/
@Test
public void testInjection() {
String stringRepresentation = null;
try {
System.out.println("Not Working Step 1");
stringRepresentation = this.b.toString();
System.out.println("Not Working Step 2");
} catch (final NullPointerException npe) {
Assert.fail("Injection failed.");
}
Assert.assertNotNull(stringRepresentation);
}
}
Exception I am getting
-----------------------------
Null Pointer exception in stringRepresentation = this.b.toString(); as b is null.
Complete stack trace
--------------------------
java.lang.AssertionError: Injection failed.
at org.junit.Assert.fail(Assert.java:88)
at ArquillianInjectionTest.testInjection(ArquillianInjectionTest.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:301)
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:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
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:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at
org.jboss.arquillian.container.test.impl.client.protocol.local.LocalContainerMethodExecutor.invoke(LocalContainerMethodExecutor.java:50)
at
org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
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:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at
org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
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.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294)
at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:269)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345)
at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at
org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:66)
at
org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:159)
at
org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:125)
at
org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:914)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)
Most Important Thing
------------------------------
I have commented out the code in WebSphereRemoteContainer.java (for WAS 8 -
https://github.com/arquillian/arquillian-container-was) which is responsible for deploying
and un-deploying the code.
For our requirements, the code is already deployed and all we need to run the test on PRE
DEPLOYED code only.
Methods which I have modified
1. public ProtocolMetaData deploy(final Archive<?> archive) throws
DeploymentException
2. public void undeploy(final Archive<?> archive) throws DeploymentException
I have just commented out the code which install / uninstall the application.
Can someone help me in getting this issue resolved.
Please let me know if I need to provide more information for debugging purpose.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)