Ask a Question

NullPointerException using maven-plugin with MTOM attachment

aholzinger
Occasional Contributor

NullPointerException using maven-plugin with MTOM attachment

Hi,

I'm using soapUI 4.6.1. My application integrates via web services to a server (Apache CXF, HTTPS).
The service is mocked out by a soapUI project using the maven-soapui-plugin.
It works well for some basic scenarios (request and responses are processed and mocked successfully).

One scenario is to have an MTOM attachment in the response. Running a maven build produces the following output:

java.lang.NullPointerException
at com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse.getAttachmentsForPart(WsdlMockResponse.java:594)
at com.eviware.soapui.impl.wsdl.submit.transports.http.support.attachments.AttachmentUtils.prepareMessagePart(AttachmentUtils.java:220)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse.writeResponse(WsdlMockResponse.java:637)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockResponse.execute(WsdlMockResponse.java:311)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation.dispatchRequest(WsdlMockOperation.java:259)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchPostRequest(WsdlMockRunner.java:290)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:375)
at com.eviware.soapui.monitor.JettyMockEngine$ServerHandler.handle(JettyMockEngine.java:715)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:713)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
14:58:42,946 INFO [SoapUIMockServiceRunner] Handled request 1; [getNextElsterXml] with [OkResponse] in [43ms] at [2013-10-29 14:58:42.894]

A successful response from the mock is shown like this:
15:53:56,032 INFO  [SoapUIMockServiceRunner] Handled request 3; [getNextElsterXml] with [EmptyResponse] in [7ms] at [2013-10-29 15:53:56.020]


The soapui-maven-plugin starts correctly within the maven build. See attached log file.

I followed the documentation on the settings and attributes for attachments.
I have attached the soapui project, the complete maven build log, the pom.xml.

Any idea whats wrong?

Thanks,
Alfred
6 REPLIES 6
aholzinger
Occasional Contributor

Re: NullPointerException using maven-plugin with MTOM attach

One more detail.
The soapUI Tests within the soapUI software works as expected, the mock response contains a MTOM attachment.
The tests with the maven plugin fail using the same soapUI project file.

Re: NullPointerException using maven-plugin with MTOM attach

Hi!

Could you try downgrading to SoapUI 4.5.2 by changing

       
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>4.6.1</version>


to

       
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.5.1</version>



Also, there's no TestCase in your project file, is this the correct version of the project file?
Could you try to run the project using the command line runner, and see if you get the same error there?

--
Regards

Erik
SmartBear Sweden
aholzinger
Occasional Contributor

Re: NullPointerException using maven-plugin with MTOM attach

Hi,

thanks for looking into it. I downgraded to eviware:maven-soapui-plugin:4.5.1 and got the same behaviour.

You are correct, a test case was missing. I tested with a manual approach as it is a very limited scenario.
I added a test case and attached it. The test case runs successful now. You can verify the assertions. Most importantly, that there is an attachment.

I tried with the command line runner. It is successful and it gives the following output:
C:\Program Files (x86)\SmartBear\SoapUI-4.6.1\bin>cmd.exe /C testrunner.bat -s"TestSuite 1" -a -fc:\temp\kw45 C:\ws\epm\epm\src\test\resources\epm-soapui-project.xml
SoapUI 4.6.1 TestCase Runner
Configuring log4j from [C:\Program Files (x86)\SmartBear\SoapUI-4.6.1\bin\soapui-log4j.xml]
14:42:46,778 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\ahol\soapui-settings.xml]
14:42:47,444 INFO [WsdlProject] Loaded project from [file:/C:/ws/epm/epm/src/test/resources/epm-soapui-project.xml]
14:42:47,989 INFO [SoapUITestCaseRunner] Running SoapUI tests in project [epm]
14:42:47,990 INFO [SoapUITestCaseRunner] Running TestSuite [TestSuite 1], runType = SEQUENTIAL
14:42:47,999 INFO [SoapUITestCaseRunner] Running SoapUI testcase [TestCase 1]
14:42:48,005 INFO [SoapUITestCaseRunner] running step [getNextElsterXmlOK]
Progress: 1 - Loading Definition from cache
14:42:48,739 DEBUG [AbstractDefinitionContext] Loading Definition...
14:42:48,753 DEBUG [WsdlInterfaceDefinition] Loading WSDL: file:/C:/ws/epm/epm/src/test/resources/download.wsdl
14:42:48,753 DEBUG [AbstractWsdlDefinitionLoader] Returning baseInputSource [file:/C:/ws/epm/epm/src/test/resources/download.wsdl]
Retrieving document at 'file:/C:/ws/epm/epm/src/test/resources/download.wsdl'.
14:42:48,884 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/xop.xsd with targetNamespace
http://www.w3.org/2004/08/xop/include
14:42:48,919 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/XMLSchema.xsd with targetName
space http://www.w3.org/2001/XMLSchema
14:42:48,920 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/xml.xsd with targetNamespace
http://www.w3.org/XML/1998/namespace
14:42:48,921 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/swaref.xsd with targetNamespa
ce http://ws-i.org/profiles/basic/1.1/xsd
14:42:48,922 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/xmime200505.xsd with targetNa
mespace http://www.w3.org/2005/05/xmlmime
14:42:48,923 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/xmime200411.xsd with targetNa
mespace http://www.w3.org/2004/11/xmlmime
14:42:48,924 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/soapEnvelope.xsd with targetN
amespace http://schemas.xmlsoap.org/soap/envelope/
14:42:48,926 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/soapEncoding.xsd with targetN
amespace http://schemas.xmlsoap.org/soap/encoding/
14:42:48,927 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/soapEnvelope12.xsd with targe
tNamespace http://www.w3.org/2003/05/soap-envelope
14:42:48,929 INFO [SchemaUtils] Added default schema from file:/C:/Program%20Files%20(x86)/SmartBear/SoapUI-4.6.1/bin/soapui-4.6.1.jar!/com/eviware/soapui/resources/xsds/soapEncoding12.xsd with targe
tNamespace http://www.w3.org/2003/05/soap-encoding
14:42:48,930 INFO [SchemaUtils] Loading schema types from [file:/C:/ws/epm/epm/src/test/resources/download.wsdl]
14:42:48,930 INFO [SchemaUtils] Getting schema file:/C:/ws/epm/epm/src/test/resources/download.wsdl
14:42:49,170 DEBUG [AbstractDefinitionContext] Loaded Definition: ok
14:42:49,503 INFO [SoapUITestCaseRunner] Assertion [SOAP Response] has status VALID
14:42:49,503 INFO [SoapUITestCaseRunner] Assertion [Contains] has status VALID
14:42:49,504 INFO [SoapUITestCaseRunner] Assertion [Script Assertion] has status VALID
14:42:49,512 INFO [SoapUITestCaseRunner] Finished running SoapUI testcase [TestCase 1], time taken: 1492ms, status: FINISHED
14:42:49,513 INFO [SoapUITestCaseRunner] TestSuite [TestSuite 1] finished with status [FINISHED] in 1519ms


My application still fails with the maven build and the same NullPointerException.

Thanks,
Alfred
aholzinger
Occasional Contributor

Re: NullPointerException using maven-plugin with MTOM attach

Hi,

I didn't get any further on this. Is there a workaround for this? Do you need more information?

Many thanks,
Alfred
slonik
Regular Visitor

Re: NullPointerException using maven-plugin with MTOM attach

Hi,

 

Did you ever get to the bottom of this exception? I'm getting exactly the same problem

 

Cheers

Dan

Char
New Contributor

Re: NullPointerException using maven-plugin with MTOM attach

Hi,

 

is there a solution for this problem? I have the same behaviour here...

 

best regards

Alex

cancel
Showing results for 
Search instead for 
Did you mean: