You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "yogesh_d1@yahoo.com" <yo...@yahoo.com> on 2014/01/17 13:17:44 UTC

java.lang.NullPointerException in org.apache.cxf.attachment.LazyDataSource.getXXX

Hello,
I am using MTOM with https ... and it is working ok with java client .

However when I send a message though SOAP UI and in my endpoint
implementation class I try to access any of the methods of the Datahandler
object  ( see abridged code below) - and please note that call to any of the
following <DataHandler >.getXXX method gives exception ( as that translates
to corresponding call to LazyDataSource.getXXX method ... and looks like
LazyDataSource is null.


@WebService(targetNamespace = "http://webservice.dcca.dell.com", 
portName = "ObjectMTOMService", serviceName = "ObjectMTOMServiceService")

public class ObjectMTOMServiceImpl implements ObjectMTOMService {
	
    @Resource
    WebServiceContext wsContext;

    public ObjectStoreResp uploadObject(ObjectStoreReq objectReqParam) {
		
        DataHandler objHandler = objectReqParam.getObjData();
		
        try {
			
			if (objHandler != null)
			{
							
			String objName=objHandler.getName();
				
			String contentType=objHandler.getContentType();
			
			InputStream iStream= objHandler.getDataSource().getInputStream();

                         }
              catch (Exception e) {
			e.printStackTrace();
			respParam.setRespCode(-1);
			return (respParam);
		}
}


Then I get an exception as follows 

java.lang.NullPointerException
        at
org.apache.cxf.attachment.LazyDataSource.getName(LazyDataSource.java:73)
        at javax.activation.DataHandler.getName(DataHandler.java:191)
        at
com.dell.dcca.webservice.objectmtomservice.ObjectMTOMServiceImpl.uploadObject(ObjectMTOMServiceImpl.java:98)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

       ........  <<< removed for bevity >>>

        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1555)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
java.lang.NullPointerException


The message that SOAPUI  sends is as follows << I have approximated this --
copying and pasting from SOAPUI log >>

POST https://160.110.73.35:8443/ObjectMTOMService/services/ObjectMTOMService
HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="application/xop+xml";
start="<ro...@soapui.org>"; start-info="text/xml";
boundary="----=_Part_13_756617.1389959552144"
SOAPAction: "http://InteropBaseAddress/interop/header"
MIME-Version: 1.0
Content-Length: 5432
Host: 160.110.73.35:8443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
 ------=_Part_13_756617.1389959552144"
"Content-Type: application/octet-stream; name=InfantHealthcare.jpg"
 Content-Transfer-Encoding: binary
Content-ID: <images.jpg>
Content-Disposition: attachment; name="images.jpg";
filename="InfantHealthcare.jpg
<< file contents ... >>






--
View this message in context: http://cxf.547215.n5.nabble.com/java-lang-NullPointerException-in-org-apache-cxf-attachment-LazyDataSource-getXXX-tp5738692.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: java.lang.NullPointerException in org.apache.cxf.attachment.LazyDataSource.getXXX

Posted by Aki Yoshida <el...@gmail.com>.
Not knowing the exact CXF version, I don't know which line is causing the NPE.
I would suspect that the root cause is some missing header or
something in the message is invalid/inconsistent.

I see some strange double quote characters appearing in your pasted
message. If those are really there, they could be causing this error.

regards, aki


2014/1/17 yogesh_d1@yahoo.com <yo...@yahoo.com>:
> Hello,
> I am using MTOM with https ... and it is working ok with java client .
>
> However when I send a message though SOAP UI and in my endpoint
> implementation class I try to access any of the methods of the Datahandler
> object  ( see abridged code below) - and please note that call to any of the
> following <DataHandler >.getXXX method gives exception ( as that translates
> to corresponding call to LazyDataSource.getXXX method ... and looks like
> LazyDataSource is null.
>
>
> @WebService(targetNamespace = "http://webservice.dcca.dell.com",
> portName = "ObjectMTOMService", serviceName = "ObjectMTOMServiceService")
>
> public class ObjectMTOMServiceImpl implements ObjectMTOMService {
>
>     @Resource
>     WebServiceContext wsContext;
>
>     public ObjectStoreResp uploadObject(ObjectStoreReq objectReqParam) {
>
>         DataHandler objHandler = objectReqParam.getObjData();
>
>         try {
>
>                         if (objHandler != null)
>                         {
>
>                         String objName=objHandler.getName();
>
>                         String contentType=objHandler.getContentType();
>
>                         InputStream iStream= objHandler.getDataSource().getInputStream();
>
>                          }
>               catch (Exception e) {
>                         e.printStackTrace();
>                         respParam.setRespCode(-1);
>                         return (respParam);
>                 }
> }
>
>
> Then I get an exception as follows
>
> java.lang.NullPointerException
>         at
> org.apache.cxf.attachment.LazyDataSource.getName(LazyDataSource.java:73)
>         at javax.activation.DataHandler.getName(DataHandler.java:191)
>         at
> com.dell.dcca.webservice.objectmtomservice.ObjectMTOMServiceImpl.uploadObject(ObjectMTOMServiceImpl.java:98)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
>        ........  <<< removed for bevity >>>
>
>         at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
>         at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1555)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>         at java.lang.Thread.run(Thread.java:722)
> java.lang.NullPointerException
>
>
> The message that SOAPUI  sends is as follows << I have approximated this --
> copying and pasting from SOAPUI log >>
>
> POST https://160.110.73.35:8443/ObjectMTOMService/services/ObjectMTOMService
> HTTP/1.1
> Accept-Encoding: gzip,deflate
> Content-Type: multipart/related; type="application/xop+xml";
> start="<ro...@soapui.org>"; start-info="text/xml";
> boundary="----=_Part_13_756617.1389959552144"
> SOAPAction: "http://InteropBaseAddress/interop/header"
> MIME-Version: 1.0
> Content-Length: 5432
> Host: 160.110.73.35:8443
> Connection: Keep-Alive
> User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
>  ------=_Part_13_756617.1389959552144"
> "Content-Type: application/octet-stream; name=InfantHealthcare.jpg"
>  Content-Transfer-Encoding: binary
> Content-ID: <images.jpg>
> Content-Disposition: attachment; name="images.jpg";
> filename="InfantHealthcare.jpg
> << file contents ... >>
>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/java-lang-NullPointerException-in-org-apache-cxf-attachment-LazyDataSource-getXXX-tp5738692.html
> Sent from the cxf-user mailing list archive at Nabble.com.