Hi What is most likely happening is that you have a method parameter annotated with @FormParam. In that case no message body readers are checked (which would've prevented the NPE) but the runtime checks if its a application/x-www-form-urlencoded request and if not then it assumes straight away it's a mulltipart/form-data request (so this will have to be fixed so that an unsupported media type exception is thrown instead).
So you just need to remove @FormParams from the @PUT-annotated method. If you do need to keep @FormParams, then just introduce another method which accepts PUT and application/json (@Consumes) media type hope it helps, Sergey ----- Original Message ----- From: Pydipati, Karuna To: [email protected] ; Sergey Beryozkin Sent: Tuesday, September 15, 2009 6:28 AM Subject: CXF -Strange HTTP PUT (REST) behavior Hi I posted this in a separate thread today. Sorry. After some investigation, I found this. Please help me. I see a strange behavior in HTTP PUT (REST). When I tried CXF-2.2.2 deploying userapi.ear (with "user" as context-root in jboss), it is failing with following error. If I rename same ear file to something else such as cog.ear (with 'cog' as context-root), it started working. Is 'user' a reserve word in HTTP/CXF/REST world? Can't I use "user' word for my application for "Address"? [in my app, cog.ear contains cog.war. Same way, user.ear contains user.war too] 17:28:54,290 ERROR [STDERR] Sep 14, 2009 5:28:54 PM org.apache.cxf.interceptor.LoggingInInterceptor logging INFO: Inbound Message ---------------------------- ID: 3 Address: /userapi/user/users/6E2D6D23D40D2FC9E04400144F8AE084/contacts/2 Encoding: UTF-8 Content-Type: application/json Headers: {content-length=[536], connection=[keep-alive], cache-control=[no-cache], host=[localhost:28080], user-agent=[J ava/1.5.0_14], pragma=[no-cache], Content-Type=[application/json], content-type=[application/json], Accept=[text/html, i mage/gif, image/jpeg, *; q=.2, */*; q=.2], content-language=[en-US]} Payload: { "UserContact": { "ContactId": 111111, "UserId": 11111, "FirstName": "xxxxxx", "LastName": "xxxxxx", "Street": "Sharynne Ln.", "AptNumber": 5350, "City": "Malibu", "State": "CA", "Zip": 90265, "Phone1": "xxxxxxx", "Phone2": "xxxxxxx", "Company": "Ebay", "Email": "[email protected]", "DateAdded": "24-OCT-02", "Active": 1, "Note": "Note", "Fax": "56356", "Country": "US", "DefaultContact": 1, "PaymentContact": 1, "Title":"Mr.", "LastModifiedDate": "10-SEP-09", "ChkPmtToCo": 0 }} -------------------------------------- 17:28:54,290 ERROR [STDERR] Sep 14, 2009 5:28:54 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org.apache.cxf.attachment.AttachmentUtil.createAttachment(AttachmentUtil.java:136) at org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments(MessageContextImpl.java:135) at org.apache.cxf.jaxrs.ext.MessageContextImpl.get(MessageContextImpl.java:58) at org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils.getMultipartBody(AttachmentUtils.java:54) at org.apache.cxf.jaxrs.utils.JAXRSUtils.processFormParam(JAXRSUtils.java:590) Regards Karuna Pydipati StubHub/eBay - Platform & Services Phone: (415)222-8752 Email: [email protected]
