Yes Paul. BTW yesterday I saw your presentation on JAX-RS @ Devoxx. its
simply superb.
Is there any know issue adding dependency with jersey-multipart?
Thanks,
Anil
Paul Sandoz wrote:
> Hi,
>
> Did you include a dependency on jersey-multipart?
>
> https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#d4e959
>
> Paul.
>
> On Nov 24, 2009, at 12:58 PM, Anil Kumar Veeramalli wrote:
>
>> Hi,
>>
>> I am trying to deploy fileupload sample.This is the error I am getting.
>>
>> com.sun.enterprise.admin.event.AdminEventListenerException:
>> ContainerBase.addChild: start: LifecycleException:
>> com.sun.jersey.api.container.ContainerException: [failed to localize]
>> not.valid.httpmethod(public void
>> com.fresco.filepost.XMLPost.uploadUrlFormData(java.util.List,com.sun.jersey.multipart.FormDataBodyPart)
>> throws java.io.IOException,java.text.ParseException, POST, class
>> com.fresco.filepost.XMLPost)
>> at
>> com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:188)
>> at
>> com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:278)
>> at
>> com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:1005)
>> at
>> com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:992)
>> at
>> com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:470)
>> at
>> com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:182)
>> at
>> com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:308)
>> at
>> com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:231)
>> at
>> com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:298)
>> at
>> com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:132)
>> at
>> com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
>> at
>> com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
>> at
>> com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:609)
>> at
>> com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:653)
>> at
>> com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:773)
>> 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.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:381)
>> at
>> com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:364)
>> at
>> com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:477)
>> at
>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
>> at
>> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
>> at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90)
>> at $Proxy1.invoke(Unknown Source)
>> at
>> com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304)
>> at
>> com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:174)
>> at
>> com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:69)
>> at
>> com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:155)
>> at
>> com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:122)
>> at
>> com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:193)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
>> at
>> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
>> at com.sun.enterprise.web.WebPipeline.invoke
>> <http://web.WebPipeline.invoke>(WebPipeline.java:94)
>> at
>> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke
>> <http://web.PESessionLockingStandardPipeline.invoke>(PESessionLockingStandardPipeline.java:98)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
>> at
>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
>> at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
>> at
>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
>> at
>> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter
>> <http://web.connector.grizzly.DefaultProcessorTask.invokeAdapter>(DefaultProcessorTask.java:647)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess
>> <http://web.connector.grizzly.DefaultProcessorTask.doProcess>(DefaultProcessorTask.java:579)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process
>> <http://web.connector.grizzly.DefaultProcessorTask.process>(DefaultProcessorTask.java:831)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask
>> <http://web.connector.grizzly.DefaultReadTask.executeProcessorTask>(DefaultReadTask.java:341)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask
>> <http://web.connector.grizzly.DefaultReadTask.doTask>(DefaultReadTask.java:263)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask
>> <http://web.connector.grizzly.DefaultReadTask.doTask>(DefaultReadTask.java:214)
>> at com.sun.enterprise.web.connector.grizzly.TaskBase.run
>> <http://web.connector.grizzly.TaskBase.run>(TaskBase.java:265)
>> at
>> com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run
>> <http://web.connector.grizzly.WorkerThreadImpl.run>(WorkerThreadImpl.java:116)
>> Caused by: java.lang.IllegalStateException: ContainerBase.addChild:
>> start: LifecycleException:
>> com.sun.jersey.api.container.ContainerException: [failed to localize]
>> not.valid.httpmethod(public void
>> com.fresco.filepost.XMLPost.uploadUrlFormData(java.util.List,com.sun.jersey.multipart.FormDataBodyPart)
>> throws java.io.IOException,java.text.ParseException, POST, class
>> com.fresco.filepost.XMLPost)
>> at
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:992)
>> at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:973)
>> at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:704)
>> at com.sun.enterprise.web.WebContainer.loadWebModule
>> <http://web.WebContainer.loadWebModule>(WebContainer.java:1627)
>> at com.sun.enterprise.web.WebContainer.loadWebModule
>> <http://web.WebContainer.loadWebModule>(WebContainer.java:1232)
>> at
>> com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:182)
>> ... 63 more
>> ADM5603:Event listener error [ContainerBase.addChild: start:
>> LifecycleException: com.sun.jersey.api.container.ContainerException:
>> [failed to localize] not.valid.httpmethod(public void
>> com.fresco.filepost.XMLPost.uploadUrlFormData(java.util.List,com.sun.jersey.multipart.FormDataBodyPart)
>> throws java.io.IOException,java.text.ParseException, POST, class
>> com.fresco.filepost.XMLPost)]
>> ADM1075:Error on listening event:[ContainerBase.addChild: start:
>> LifecycleException:
>> *com.sun.jersey.api.container.ContainerException: [failed to
>> localize] not.valid.httpmethod(public void
>> com.fresco.filepost.XMLPost.uploadUrlFormData(java.util.List,com.sun.jersey.multipart.FormDataBodyPart)
>> *throws java.io.IOException,java.text.ParseException, POST, class
>> com.fresco.filepost.XMLPost)]
>>
>>
>>
>> This is the piece of code.
>>
>>
>> @Path("form-data")
>> @Consumes(MediaType.MULTIPART_FORM_DATA)
>> @POST
>> public void uploadUrlFormData(
>> @FormDataParam("file") List<FormDataBodyPart> parts,
>> @FormDataParam("submit") FormDataBodyPart submit)
>> throws IOException, ParseException {
>>
>> System.out.println("XXXX: " + submit.getMediaType());
>> System.out.println("XXXX: " +
>> submit.getHeaders().getFirst("Content-Type"));
>>
>> for (FormDataBodyPart bp : parts) {
>> System.out.println(bp.getMediaType());
>>
>> System.out.println(bp.getHeaders().get("Content-Disposition"));
>>
>> //
>> System.out.println(bp.getParameterizedHeaders().getFirst("Content-Disposition").getParameters().get("name"));
>> bp.cleanup();
>> }
>>
>>
>> Please help on this issue.
>>
>> Thanks,
>> Anil
>