7 Replies Latest reply on Apr 27, 2012 3:11 AM by dan.j.allen

    Error deploying to managed glassfish

    bri256

      Greetings,

       

      I'm trying to switch from glassfish-embedded to glassfish-managed, but I can't seem to get the application to deploy. Here's the stack trace:

       

      com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class com.sun.jersey.multipart.FormDataMultiPart, and MIME media type, multipart/form-data, was not found

                at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)

                at com.sun.jersey.api.client.filter.CsrfProtectionFilter.handle(CsrfProtectionFilter.java:97)

                at com.sun.jersey.api.client.Client.handle(Client.java:648)

                at com.sun.jersey.api.client.WebResource.handle(WebResource.java:670)

                at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)

                at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:563)

                at org.jboss.arquillian.container.glassfish.clientutils.GlassFishClientUtil.POSTMultiPartRequest(GlassFishClientUtil.java:129)

                at org.jboss.arquillian.container.glassfish.clientutils.GlassFishClientService.doDeploy(GlassFishClientService.java:203)

                at org.jboss.arquillian.container.glassfish.CommonGlassFishManager.deploy(CommonGlassFishManager.java:101)

                at org.jboss.arquillian.container.glassfish.managed_3_1.GlassFishManagedDeployableContainer.deploy(GlassFishManagedDeployableContainer.java:91)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)

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

                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.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)

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

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

                at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.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:90)

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

                at org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)

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

                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.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:95)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:80)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:263)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:239)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:79)

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

                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.ContainerEventController.execute(ContainerEventController.java:101)

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

                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.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:90)

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

                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.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

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

                at org.jboss.arquillian.testng.Arquillian.arquillianBeforeClass(Arquillian.java:103)

                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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)

                at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)

                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)

                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)

                at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:173)

                at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)

                at org.testng.TestRunner.runWorkers(TestRunner.java:1178)

                at org.testng.TestRunner.privateRun(TestRunner.java:757)

                at org.testng.TestRunner.run(TestRunner.java:608)

                at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

                at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

                at org.testng.SuiteRunner.run(SuiteRunner.java:240)

                at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

                at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

                at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)

                at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)

                at org.testng.TestNG.run(TestNG.java:999)

                at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)

                at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)

                at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)

                at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:111)

                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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

      Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class com.sun.jersey.multipart.FormDataMultiPart, and MIME media type, multipart/form-data, was not found

                at com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)

                at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:204)

                at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:147)

                ... 116 more

       

      I'm using arquillian-testng-container 1.0.0.Final, arquillian-glassfish-managed-3.1 1.0.0.CR3, and a freshly unpacked Glassfish 3.1.2. Does anyone have any ideas what the problem might be? Thanks.

        • 1. Re: Error deploying to managed glassfish
          nwallman

          I'm experiencing the exact same exception at the moment.

          • 2. Re: Error deploying to managed glassfish
            vineet.reynolds

            What version of Jersey are you using in your POM? The managed and remote GlassFish 1.0.0.CR3 container adapters use Jersey 1.10 (jersey-bundle and jersey-multipart artifacts) to manage deployments among other things. Overriding it with a lower version could cause problems.

             

            For the record, I've managed to get the jaxrs example in the Arquillian showcase to work with Jersey 1.10 (along with a few other changes that are immaterial here).

            1 of 1 people found this helpful
            • 3. Re: Error deploying to managed glassfish
              bri256

              Thanks Vineet. I had been using jersey 1.8. Updating to 1.10 does get me past this error (and onto another yet another one).

               

              Interestingly, before seeing your reply, I had updated  jersey to 1.12 because of a reference to a decommissioned maven repository in the POM for 1.8. Version 1.12 causes the exact same error. Every  version >1.10 that I've tried has also failed with the same error (1.11, 1.11.1, 1.12, 1.13-b01). Only 1.10 works. This is unfortunate because the version that the application uses must be the same version used by the Glassfish container adaptor. Luckily, 1.10 is recent enough to have fixed the issue of the decommissioned maven repository, but it makes me very nervous about maintaining this balancing act.

              • 4. Re: Error deploying to managed glassfish
                dan.j.allen

                Brian, this is one of the tricky things with working with the limited classpath control that Maven constrains you to. The general purpose solution is to make sure that the adapter works with a broader range of Jersey versions, and always the most recent (as we don't want to hold people back). Can you file a JIRA?

                 

                If you are concerned with the Jersey version of the app conflicting with the version needed by the adapter, the safest bet is to split the tests out into a separate Maven module (separate project) so that the tests are isolated from the application. You see projects such as DeltaSpike taking this approach.

                • 5. Re: Error deploying to managed glassfish
                  dan.j.allen

                  Hmm, I ran the tests in the GlassFish container adapter with Jersey 1.12 and they ran fine. I also tried it with a standalone project, also successful. What is the error when Jersey > 1.10? I suspect there may be a difference in the APIs we have on the classpath, so it may be necessary to hunt down what is missing. Maybe you don't have all the parts of Jersey required?

                   

                  Here's what Arquillian is using:

                   

                  [INFO]    |  +- com.sun.jersey:jersey-bundle:jar:1.10:test
                  [INFO]    |  |  \- javax.ws.rs:jsr311-api:jar:1.1.1:test
                  [INFO]    |  \- com.sun.jersey.contribs:jersey-multipart:jar:1.10:test
                  [INFO]    |     +- org.jvnet:mimepull:jar:1.6:test
                  [INFO]    |     \- com.sun.jersey:jersey-core:jar:1.10:test
                  
                  • 6. Re: Error deploying to managed glassfish
                    vineet.reynolds

                    I think Brian's point is that he want to use Jersey 1.12 or whatever is required by his project. The Arquillian adapter pulls in a different Jersey version (the dependency tree shows 1.10), and for some reason he's unable to replace this successfully with a higher version.

                    • 7. Re: Error deploying to managed glassfish
                      dan.j.allen

                      Ah, right. Now I see.

                       

                      This can be resolved w/ dependency management. That will force the higher version to be used. So that should work in this case:

                       

                      <dependencyManagement>
                        <dependencies>
                              <dependency>
                                  <groupId>com.sun.jersey</groupId>
                                  <artifactId>jersey-bundle</artifactId>
                                   <version>1.12</version>
                              </dependency>
                              <dependency>
                                  <groupId>com.sun.jersey.contribs</groupId>
                                  <artifactId>jersey-multipart</artifactId>
                                   <version>1.12</version>
                              </dependency>
                        </dependencies>
                      </dependencyManagement>