3 Replies Latest reply on Feb 19, 2015 6:19 PM by inkimannen

    Wildfly 8.1 and resteasy-multipart-provider ( maven project )

    inkimannen

      Hello,

       

      Porting my application from Glassfish to Wildfly 8.1.

      Environment is :

      • Apache Maven 3.0.5
      • Maven home: /usr/share/maven
      • Java version: 1.7.0_75, vendor: Oracle Corporation
      • Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
      • Default locale: en_US, platform encoding: UTF-8
      • OS name: "linux", version: "3.13.0-45-generic", arch: "amd64", family: "unix"

       

       

      On Glassfish I have these dependencies:

      GF1 - GF15

      1.           <dependency>
      2.             <groupId>org.jboss.resteasy</groupId>
      3.             <artifactId>resteasy-jaxb-provider</artifactId>
      4.             <version>3.0.6.Final</version>
      5.         </dependency>
      6.         <dependency>
      7.             <groupId>org.jboss.resteasy</groupId>
      8.             <artifactId>resteasy-multipart-provider</artifactId>
      9.             <version>2.3.1.GA</version>
      10.         </dependency>
      11.         <dependency>
      12.             <groupId>org.jboss.resteasy</groupId>
      13.             <artifactId>resteasy-jackson-provider</artifactId>
      14.             <version>3.0.5.Final</version>
      15.         </dependency>

       

      And I able to upload a stream using the following class

      org.jboss.resteasy.annotations.providers.multipart.PartType;

      @FormParam("selectedFile")

      @PartType("application/octet-stream")

      private byte[] fileData;

       

      When Adding my dependencies when running in wildfly I use the following :

      Wild1-Wild19

      1.         <dependency>
      2.             <groupId>org.jboss.spec.javax.ejb</groupId>
      3.             <artifactId>jboss-ejb-api_3.2_spec</artifactId>
      4.            <scope>provided</scope>
      5.         </dependency>
      6.       
      7.         <!-- Import the JSON API to build JSON Objects -->
      8.         <dependency>
      9.             <groupId>org.jboss.spec.javax.json</groupId>
      10.             <artifactId>jboss-json-api_1.0_spec</artifactId>
      11.             <scope>provided</scope>
      12.         </dependency>
      13.       
      14.         <!-- Import the JAX-RS API, we use provided scope as the API is included in JBoss WildFly -->
      15.         <dependency>
      16.             <groupId>org.jboss.resteasy</groupId>
      17.             <artifactId>jaxrs-api</artifactId>
      18.            <scope>provided</scope>
      19.         </dependency>

       

      The above is working ( <scope>provided</scope> ) and I able to upload data and retrieve data from the database:

      Wildfly seems to be able to scan its 'modules' and everything works fine.

      But When I add GF6-GF10 I am getting the following Exception.

      1. org.jboss.resteasy.core.AsynchronousDispatcher

       

      providing the GF6-GF10 in this fashion does not help either

      1.          <dependency>
      2.             <groupId>org.jboss.resteasy</groupId>
      3.             <artifactId>resteasy-multipart-provider</artifactId>
      4.           <scope>provided</scope>
      5.         </dependency>

       

      I am getting the dependency.version error - maven does not let this go through.

       

      How can I use resteasy-multipart-provide in wildfly 8.1 ?

       

      Regards, Ingo

       

      Tomaz:

      Seem to have reached some 'frequency limit' when trying to answer:

      19:07:17,616 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./wildfly-ejb-in-ear: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./wildfly-ejb-in-ear: Failed to start service

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]

          at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]

      Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: com/fasterxml/jackson/jaxrs/base/ProviderBase

        • 1. Re: Wildfly 8.1 and resteasy-multipart-provider ( maven project )
          ctomc

          What is the exception?

           

          also please use jackson2 provider not jackson1 as you do now, as WildFly 8.1+ is using that as default.

          1 of 1 people found this helpful
          • 2. Re: Wildfly 8.1 and resteasy-multipart-provider ( maven project )
            inkimannen

            Hello Tomaz,

             

             

            The exception is like this:

             

             

            18:56:31,263 INFO  [org.jboss.resteasy.spi.ResteasyDeployment] (MSC service thread 1-3) Deploying javax.ws.rs.core.Application: class se.nrm.bio.mediaserver.rs.MediaResourceApplication$Proxy$_$$_WeldClientProxy

             

             

            18:56:31,364 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./wildfly-ejb-in-ear: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./wildfly-ejb-in-ear: Failed to start service

             

             

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

             

             

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]

             

             

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]

             

             

                at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]

             

             

            Caused by: java.lang.RuntimeException: Could not find constructor for class: org.jboss.resteasy.core.AsynchronousDispatcher

             

             

            I am trying to use the following ,

             

             

            <dependency>

             

             

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

             

             

                        <artifactId>resteasy-multipart-provider</artifactId>

             

             

                        <version>3.0.9.Final</version>

             

             

                        <type>jar</type>

             

             

                    </dependency>

             

             

            because mvn gives me an error if i try the following :

             

             

            <dependency>

             

             

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

             

             

                        <artifactId>resteasy-multipart-provider</artifactId>

             

             

                         <scope>provided</scope>

             

             

                    </dependency>

             

             

            Tried this :

             

             

            <dependency>

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

                        <artifactId>resteasy-multipart-provider</artifactId>

                        <version>3.0.8.Final</version>

                        <type>jar</type>

                        <!--<scope>provided</scope>-->

                    </dependency>

                    <dependency>

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

                        <artifactId>resteasy-jackson2-provider</artifactId>

                        <version>3.0.8.Final</version>

                        <type>jar</type>

                    </dependency>

             

             

            Now I am getting this error:

             

             

            19:07:17,616 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001:

            Failed to start service jboss.undertow.deployment.default-server.default-host./wildfly-ejb-in-ear: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./wildfly-ejb-in-ear: Failed to start service

             

             

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]

                at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]

             

             

            Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: com/fasterxml/jackson/jaxrs/base/ProviderBase

             

             

            regards,i

            • 3. Re: Wildfly 8.1 and resteasy-multipart-provider ( maven project )
              inkimannen

              I had done this example without a web.xml file as it is in the examples here ->

              quickstart from wildfly

              But reintroducing web.xml solved this problem.

              <web-app xmlns="http://java.sun.com/xml/ns/javaee"

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

                       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"

                       version="3.0">

                

                  <!-- Auto scan REST service -->

                  <servlet-mapping>

                      <servlet-name>resteasy-servlet</servlet-name>

                      <url-pattern>/rest/*</url-pattern>

                  </servlet-mapping>

               

                  <!-- Auto scan REST service -->

                  <context-param>

                      <param-name>resteasy.scan</param-name>

                      <param-value>true</param-value>

                  </context-param>

               

                  <!-- this should be the same URL pattern as the servlet-mapping property -->

                  <context-param>

                      <param-name>resteasy.servlet.mapping.prefix</param-name>

                      <param-value>/rest</param-value>

                  </context-param>

                  <listener>

                      <listener-class>

                          org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap

                      </listener-class>

                  </listener>

                  <servlet>

                      <servlet-name>resteasy-servlet</servlet-name>

                      <servlet-class>

                          org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher

                      </servlet-class>

                  </servlet>

              </web-app>

               

              snippet from my pom.xml :

                  <dependency>

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

                          <artifactId>jboss-json-api_1.0_spec</artifactId>

                          <scope>provided</scope>

                      </dependency>

                    

                      <dependency>

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

                          <artifactId>jaxrs-api</artifactId>

                          <scope>provided</scope>

                      </dependency>

               

                        <dependency>

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

                          <artifactId>resteasy-multipart-provider</artifactId>

                          <scope>provided</scope>

                      </dependency>

               

              Would be nice if the Wildfly-quickstart staff had an example with or without an web.xml when uploading a file .

               

              regards, Ingo

              ps.

              I have only tested this in Wildfly 8.2 as of now.

              ds