1 Reply Latest reply on Jul 26, 2012 10:27 PM by Tony Herstell

    Servlet protocol can not be used

    Tony Herstell Master

      I am trying to get Arquillian going with arquillian-jbossas-managed profile... as that gives this error

      >> Missing artifact org.apache.felix:org.apache.felix.resolver:jar:0.1.0.Beta1

      when using this setup

       



      <profile>



      <id>arquillian-jbossas-managed</id>

                  <activation>

                      <activeByDefault>true</activeByDefault>

                  </activation>




      <dependencies>




      <dependency>





      <groupId>org.jboss.spec</groupId>





      <artifactId>jboss-javaee-6.0</artifactId>





      <version>1.0.0.Final</version>





      <type>pom</type>





      <scope>provided</scope>




      </dependency>




      <dependency>





      <groupId>org.jboss.as</groupId>





      <artifactId>jboss-as-arquillian-container-managed</artifactId>





      <version>7.1.1.Final</version>





      <scope>test</scope>




      </dependency>




      <dependency>





      <groupId>org.jboss.arquillian.protocol</groupId>





      <artifactId>arquillian-protocol-servlet</artifactId>





      <scope>test</scope>




      </dependency>



      </dependencies>


      </profile>

      </profiles>

       

       

      Anyhow, it's better to at least have part of arquillian work; so the embedded profile:

       



      <profile>



      <id>arquillian-weld-ee-embedded</id>

                  <activation>

                      <activeByDefault>true</activeByDefault>

                  </activation>




      <dependencies>




      <dependency>





      <groupId>org.jboss.spec</groupId>





      <artifactId>jboss-javaee-6.0</artifactId>





      <version>1.0.0.Final</version>





      <type>pom</type>





      <scope>provided</scope>




      </dependency>




      <dependency>





      <groupId>org.jboss.arquillian.container</groupId>





      <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>





      <version>1.0.0.CR3</version>





      <scope>test</scope>




      </dependency>




      <dependency>





      <groupId>org.jboss.weld</groupId>





      <artifactId>weld-core</artifactId>





      <version>1.1.5.Final</version>





      <scope>test</scope>




      </dependency>




      <dependency>





      <groupId>org.slf4j</groupId>





      <artifactId>slf4j-simple</artifactId>





      <version>1.6.4</version>





      <scope>test</scope>




      </dependency>



      </dependencies>


      </profile>

       

      This setup works for the my existing tests; but alas not when trying to get this test for ModeShape (JCR) going :/

       

      @RunWith(Arquillian.class)

      public class RepositoryServiceTest {

       

          @Inject

          RepositoryService repositoryService;

       

          @Deployment

          public static JavaArchive createDeployment() {

                JavaArchive jar = ShrinkWrap.create(JavaArchive.class).addClass(RepositoryService.class).addClass(RepositoryServiceImpl.class)

                          .addAsResource(new File("src/test/resources/apiary-manager-logo-tall.png")).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

                // Add our custom Manifest, which has the additional Dependencies entry

                jar.setManifest(new File("src/main/webapp/META-INF/MANIFEST.MF"));

                System.out.println(jar.toString(true));

                return jar;

          }

       

       

          @Test

          public void testDropRepository() {

                try {

                    this.repositoryService.dropRepository();

                } catch (RepositoryException e) {

                    Assert.fail();

                }

          }

       

      Poking about in the ModeShape arquillian testing area  (setup for JBoss 7) I see they have full setup for the arquillian.xml file which includes the schema localtion (possbly missing from the "getting started" doco):

       

      <?xml version="1.0" encoding="UTF-8"?>

      <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">

       

                <!-- Force the use of the Servlet 3.0 protocol with all containers, as it

                          is the most mature -->

                <defaultProtocol type="Servlet 3.0"/>

       

      <!-- Uncomment to have test archives exported to the file system for inspection -->

      <!--           <engine> -->

      <!--                     <property name="deploymentExportPath">target/</property> -->

      <!--           </engine> -->

       

       

      <!--           <container qualifier="jboss7" default="true"> -->

      <!--                     <configuration> -->

      <!--                               <property name="jbossHome">${project.build.directory}/jboss-as-${jbossas-version}</property> -->

      <!--                               <property name="serverConfig">standalone-modeshape.xml</property> -->

      <!--                               <property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=${arquillian.suspend}</property> -->

      <!--                     </configuration> -->

      <!--           </container> -->

       

      </arquillian>

       

      anyhow; when I use the <defaultProtocol type="Servlet 3.0"/>

      I get this:

       

      java.lang.IllegalArgumentException: No org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext found in org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData. Servlet protocol can not be used

                at org.jboss.arquillian.protocol.servlet.BaseServletProtocol.getExecutor(BaseServletProtocol.java:64)

                at org.jboss.arquillian.protocol.servlet.BaseServletProtocol.getExecutor(BaseServletProtocol.java:35)

       

      I added this:

       



      <dependency>


          <groupId>org.jboss.arquillian.protocol</groupId>


          <artifactId>arquillian-protocol-servlet</artifactId>


          <scope>test</scope>


      </dependency>

       

      which was mentioned in another post of yours... to no avail.

       

      It's a pretty stock pom.xml file (attached - no sublevels) apart from the bit from pl.com.it-crowd.mock-contexts-extension to try to get Converstions (part of J6EE spec) working as arquillian does not support converstions it seems (I have not managed to get this working yet either).

        • 1. Re: Servlet protocol can not be used
          Tony Herstell Master

          (Re: Above - cannot edit the post)

           

          The test cannot run in Embedded due to a null pointer exception.... as I beieve

          @Inject

              RepositoryService repositoryService;

          thi is null....

           

          java.lang.RuntimeException: java.lang.NullPointerException

                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:154)

                    at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

                    at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)

                    at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)

                    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)

                    at com.apiarymanager.service.modeshape.RepositoryServiceImpl$Proxy$_$$_Weld$Proxy$.dropRepository(RepositoryServiceImpl$Proxy$_$$_Weld$Proxy$.java)

                    at com.apiarymanager.modeshape.RepositoryServiceTest.testDropRepository(RepositoryServiceTest.java:39)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.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:94)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

          Caused by: java.lang.NullPointerException

                    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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

                    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)