Uploaded image for project: 'Thorntail'
  1. Thorntail
  2. THORN-1217

EAP quickstart helloworld-html5: JAX-RS Application class gets generated even though JAX-RS is set up in web.xml


    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2017.5.0
    • Component/s: None
    • Labels:
    • Sprint:
      2017-Apr-A, 2017-Apr-B


      I'm trying to run the Arquillian tests in the EAP quickstart helloworld-html5, like this:

      1. git clone -b 7.0.x https://github.com/jboss-developer/jboss-eap-quickstarts.git
      2. cd jboss-eap-quickstarts/helloworld-html5
      3. mvn clean package
      4. cd functional-tests
      5. change version.jboss.bom.eap in pom.xml to 7.0.0.GA
      6. add an exclusion to the dependency on org.jboss.arquillian.graphene:graphene-webdriver:
      7. change pom.xml to include this profile:
      8. add src/test/resources/arquillian-swarm.xml file with this content:
        <?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">
            <container qualifier="wildfly-swarm" default="true">
                    <property name="host">localhost</property>
                    <property name="port">${swarm.arquillian.daemon.port:12345}</property>
            <extension qualifier="webdriver">
                <property name="browser">firefox</property>
      9. LC_ALL=C PATH=/home/lthon/tmp/firefox-45.8.0-esr/:$PATH mvn clean test -Parq-wildfly-swarm # note that Firefox 45 ESR is required because of Selenium deficiency.

      Both tests fail because they can't find the expected elements on the page. After a bit of investigation, I found that this is because Swarm auto-generates a JAX-RS Application class even though JAX-RS is set up in web.xml:

          <!-- One of the ways of activating REST Services is adding these lines.
               The server is responsible for adding the corresponding servlet automatically.
               The class org.jboss.as.quickstarts.html5rest.HelloWorld class has the
               annotation @Path("/") to receive the REST invocation -->

      I had no idea it's enough to specify a <servlet-mapping> without a <servlet> and especially a <servlet-class> but apparently it works. And if I comment out the call to addGeneratedApplication() in the constructor of JAXRSArchiveImpl and try to run the tests with this rebuilt Swarm, both tests pass just fine, like with WildFly proper.

      I believe that the check for hasApplicationPathAnnotation in JAXRSArchiveImpl.addGeneratedApplication is insufficient and should take web.xml into account. Not sure exactly how... Or at least a system property / configurable for switching off the automagic JAX-RS Application class generation.

        Gliffy Diagrams




              • Assignee:
                mkouba Martin Kouba
                lthon Ladislav Thon
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: