jersey
  1. jersey
  2. JERSEY-696

samples/bookstore - provider class com.sun.jersey.multipart.impl.MultiPartReader, not instantiated when sun-web.xml <class-loader delegate="false"/>

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.7
    • Component/s: examples
    • Labels:
      None

      Description

      in samples/bookstore/src/main/webapp/WEB-INF/sun-web.xml change :
      <class-loader delegate="true"/>
      to
      <class-loader delegate="false"/>

      then the sample errors during test run, and get this error in server.log:

      The provider class, class com.sun.jersey.multipart.impl.MultiPartReader, could not
      be instantiated. Processing will continue but the class will not be utilized
      java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is
      not present. Have you registered the MultiPartConfigProvider class?

      from steps:
      % cd $JERSEY_SAMPLES_DIR/bookstore
      % mvn -Dmaven.test.skip=true -DforkMode=never clean package
      % $AS_HOME/bin/asadmin --port $ADMIN_PORT --host localhost deploy --force=true target/*.war
      % mvn test -Dtest=**/*Test.java -DforkMode=never -Djersey.test.containerFactory=com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory -DenableLogging -DJERSEY_HTTP_PORT=$HTTP_PORT

      The fix is same as described in http://java.net/jira/browse/GLASSFISH-11873 :
      i.e., including the following in samples/bookstore/pom.xml will resolve the error:
      <dependency>
      <groupId>com.sun.jersey.contribs</groupId>
      <artifactId>jersey-multipart</artifactId>
      <version>$

      {jersey-version}

      </version>
      </dependency>

      Here is the svn diff:

      C:\jersey\samples\bookstore>svn diff pom.xml
      Index: pom.xml
      ===================================================================
      — pom.xml (revision 4807)
      +++ pom.xml (working copy)
      @@ -53,6 +53,11 @@
      <name>Bookstore - Jersey sample</name>
      <packaging>war</packaging>
      <dependencies>
      + <dependency>
      + <groupId>com.sun.jersey.contribs</groupId>
      + <artifactId>jersey-multipart</artifactId>
      + <version>$

      {project.version}

      </version>
      + </dependency>
      <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-server</artifactId>

        Activity

        Hide
        jbenoit added a comment -

        Fixed. Workspace Updated to revision 4820.
        Committed this change to samples\bookstore\pom.xml:
        C:\jersey>svn diff samples\bookstore\pom.xml
        Index: samples/bookstore/pom.xml
        ===================================================================
        — samples/bookstore/pom.xml (revision 4820)
        +++ samples/bookstore/pom.xml (working copy)
        @@ -53,7 +53,12 @@
        <name>Bookstore - Jersey sample</name>
        <packaging>war</packaging>
        <dependencies>

        • <dependency>
          + <dependency>
          + <groupId>com.sun.jersey.contribs</groupId>
          + <artifactId>jersey-multipart</artifactId>
          + <version>$ {project.version}</version>
          + </dependency>
          + <dependency>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-server</artifactId>
          <version>${project.version}

          </version>
          @@ -161,7 +166,7 @@
          <autoDelete>true</autoDelete>
          <port>8080</port>
          </configuration>

        • <dependencies>
          + <dependencies>
          <dependency>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-server</artifactId>

        C:\jersey>svn commit -m "add dependency to <groupId>com.sun.jersey.contribs <artifactId>jersey-multipart to fix provider class com.sun.jersey.multipart.impl.MultiPartReader, could not be instantiated, see http://java.net/jira/browse/JERSEY-696" --changelist review47
        Sending samples\bookstore\pom.xml
        Transmitting file data .
        Committed revision 4821.

        Show
        jbenoit added a comment - Fixed. Workspace Updated to revision 4820. Committed this change to samples\bookstore\pom.xml: C:\jersey>svn diff samples\bookstore\pom.xml Index: samples/bookstore/pom.xml =================================================================== — samples/bookstore/pom.xml (revision 4820) +++ samples/bookstore/pom.xml (working copy) @@ -53,7 +53,12 @@ <name>Bookstore - Jersey sample</name> <packaging>war</packaging> <dependencies> <dependency> + <dependency> + <groupId>com.sun.jersey.contribs</groupId> + <artifactId>jersey-multipart</artifactId> + <version>$ {project.version}</version> + </dependency> + <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> <version>${project.version} </version> @@ -161,7 +166,7 @@ <autoDelete>true</autoDelete> <port>8080</port> </configuration> <dependencies> + <dependencies> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> C:\jersey>svn commit -m "add dependency to <groupId>com.sun.jersey.contribs <artifactId>jersey-multipart to fix provider class com.sun.jersey.multipart.impl.MultiPartReader, could not be instantiated, see http://java.net/jira/browse/JERSEY-696 " --changelist review47 Sending samples\bookstore\pom.xml Transmitting file data . Committed revision 4821.

          People

          • Assignee:
            jbenoit
            Reporter:
            jbenoit
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: