2 Replies Latest reply on Mar 27, 2019 7:03 AM by Marek Kopecky

    Resteasy + WF 14 Method not Allowed

    Captain Subtext Newbie

      I try to implement Example CH03_1 in Wildfly from Restful Java with JAX-RS 2.0 and Resteasy --> https://github.com/oreillymedia/restful_java_jax-rs_2_0.

       

      I always get

       HTTP method POST is not supported by this URL

      when i issue a POST Request.

       

      e.g.:

      curl -X POST -H 'Content-Type: application/xml' -i 'http://127.0.0.1:8080/jaxrs-2.0-workbook-ex03_1/services/customers/' --data '
      Peter
      Example
      555 Beacon St.
      Boston
      MA
      02115
      '

       

      server.log states out:

       

       

      2019-02-13 09:41:25,308 DEBUG [io.undertow.request] (default I/O-1) Matched prefix path /jaxrs-2.0-workbook-ex03_1 for path /jaxrs-2.0-workbook-ex03_1/services/customers/
      2019-02-13 09:41:25,310 DEBUG [io.undertow.request.security] (default task-1) Attempting to authenticate /jaxrs-2.0-workbook-ex03_1/services/customers/, authentication required: false
      2019-02-13 09:41:25,310 DEBUG [io.undertow.request.security] (default task-1) Authentication outcome was NOT_ATTEMPTED with method io.undertow.security.impl.CachedAuthenticatedSessionMechanism@5be990cf for /jaxrs-2.0-workbook-ex03_1/services/customers/
      2019-02-13 09:41:25,310 DEBUG [io.undertow.request.security] (default task-1) Authentication result was ATTEMPTED for /jaxrs-2.0-workbook-ex03_1/services/customers/

       

      Is there some setting for undertow to allow POST?

       

      I also impelemted some Response for GET, also gets this Logentry from undertow:

       

      2019-02-13 09:45:51,969 DEBUG [io.undertow.request.security] (default task-1) Authentication result was ATTEMPTED for /jaxrs-2.0-workbook-ex03_1/services/customers
      2019-02-13 09:46:00,867 DEBUG [io.undertow.request] (default I/O-5) Matched prefix path /jaxrs-2.0-workbook-ex03_1 for path /jaxrs-2.0-workbook-ex03_1/services/customers/helloworld
      2019-02-13 09:46:00,868 DEBUG [io.undertow.request.security] (default task-1) Attempting to authenticate /jaxrs-2.0-workbook-ex03_1/services/customers/helloworld, authentication required: false
      2019-02-13 09:46:00,868 DEBUG [io.undertow.request.security] (default task-1) Authentication outcome was NOT_ATTEMPTED with method io.undertow.security.impl.CachedAuthenticatedSessionMechanism@5be990cf for /jaxrs-2.0-workbook-ex03_1/services/customers/helloworld

      Are there some settings in combination with undertow?

       

      Wildfly Version used: wildfly-14.0.1.Final

      Resteasy Version used: 3.6.1.Final

        • 1. Re: Resteasy + WF 14 Method not Allowed
          Captain Subtext Newbie

          Seems to be a problem with libraries, when i build a version from https://github.com/resteasy/resteasy-examples/tree/3.6.0.Final Tag 3.6.0.Final.

           

          When i use my Version i get this error, so maybe a missing jar-file:

           

          2019-02-13 15:03:30,322 DEBUG [org.jboss.as.ee] (MSC service thread 1-3) Configuring component class: org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest$Servlet3ExecutionContext$Servle3AsychronousResponse named org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest$Servlet3ExecutionContext$Servle3AsychronousResponse

          2019-02-13 15:03:30,322 WARN  [org.jboss.as.ee] (MSC service thread 1-3) WFLYEE0007: Not installing optional component org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest$Servlet3ExecutionContext$Servle3AsychronousResponse due to an exception (enable DEBUG log level to see the cause)

          2019-02-13 15:03:30,322 DEBUG [org.jboss.as.ee] (MSC service thread 1-3) Not installing optional component org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest$Servlet3ExecutionContext$Servle3AsychronousResponse due to an exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0048: Could not find default constructor for class org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest$Servlet3ExecutionContext$Servle3AsychronousResponse

                  at org.jboss.as.ee.component.DefaultInterceptorConfigurator.configure(DefaultInterceptorConfigurator.java:92)

                  at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:92)

                  at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:144)

                  at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)

                  at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)

                  at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)

                  at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)

                  at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)

                  at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)

                  at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1364)

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

          • 2. Re: Resteasy + WF 14 Method not Allowed
            Marek Kopecky Newbie

            I takes resteasy-jaxrs-3.0.5.Final/examples/oreilly-jaxrs-2.0-workbook/ex03_1, remove tests, updates pom.xml:

             

            --- a/pom.xml

            +++ b/pom.xml

            @@ -2,12 +2,6 @@

            <project xmlns="http://maven.apache.org/POM/4.0.0"

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

                      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

            -    <parent>

            -        <groupId>com.oreilly.rest.workbook</groupId>

            -        <artifactId>jaxrs-2.0-workbook-pom</artifactId>

            -        <version>1.0</version>

            -        <relativePath>../pom.xml</relativePath>

            -    </parent>

                 <modelVersion>4.0.0</modelVersion>

                 <groupId>com.oreilly.rest.workbook</groupId>

                 <artifactId>jaxrs-2.0-workbook-ex03_1</artifactId>

            @@ -20,33 +14,14 @@

                     <dependency>

                         <groupId>org.jboss.resteasy</groupId>

                         <artifactId>resteasy-jaxrs</artifactId>

            -            <version>3.0.5.Final</version>

            +            <version>3.6.3.Final</version>

            +            <scope>provided</scope>

                     </dependency>

                     <dependency>

                         <groupId>org.jboss.resteasy</groupId>

                         <artifactId>resteasy-client</artifactId>

            -            <version>3.0.5.Final</version>

            -        </dependency>

            -        <dependency>

            -            <groupId>org.jboss.resteasy</groupId>

            -            <artifactId>async-http-servlet-3.0</artifactId>

            -            <version>3.0.5.Final</version>

            -        </dependency>

            -        <dependency>

            -            <groupId>org.jboss.resteasy</groupId>

            -            <artifactId>jaxrs-api</artifactId>

            -            <version>3.0.5.Final</version>

            -        </dependency>

            -        <dependency>

            -            <groupId>org.jboss.resteasy</groupId>

            -            <artifactId>resteasy-servlet-initializer</artifactId>

            -            <version>3.0.5.Final</version>

            -        </dependency>

            -        <dependency>

            -            <groupId>junit</groupId>

            -            <artifactId>junit</artifactId>

            -            <version>4.1</version>

            -            <scope>test</scope>

            +            <version>3.6.3.Final</version>

            +            <scope>provided</scope>

                     </dependency>

                 </dependencies>

             

            And deploy it to WF16. These curl commands works as expected: