SmartBear / readyapi-swagger-plugin

Ready! API Plugin for importing Swagger definitions as REST Services
36 stars 27 forks source link

Null pointer exception when trying to import Swagger definition into ReadyAPI 1.4.1 or 1.4.1-m-SNAPSHOT #24

Closed testingwithfire closed 8 years ago

testingwithfire commented 8 years ago

Stack trace below. I will post a GIST of the Swagger definition shortly.

Mon Nov 02 10:08:02 EST 2015:ERROR:java.lang.NullPointerException: Cannot get property 'info' on null object java.lang.NullPointerException: Cannot get property 'info' on null object at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:57) at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169) at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:293) at com.smartbear.swagger.Swagger2Importer.createRestService(Swagger2Importer.groovy:212) at com.smartbear.swagger.Swagger2Importer.this$2$createRestService(Swagger2Importer.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171) at com.smartbear.swagger.Swagger2Importer.importSwagger(Swagger2Importer.groovy:66) at com.smartbear.swagger.SwaggerImporter$importSwagger.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122) at com.smartbear.swagger.SwaggerUtils$1.construct(SwaggerUtils.groovy:64) at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:48) at com.eviware.soapui.support.swing.SwingWorker.run(SwingWorker.java:88)

olensmar commented 8 years ago

thanks - what versions of the plugin and Ready! API (or SoapUI) are you using?

testingwithfire commented 8 years ago

ReadyAPI 1.4.1 and a recent snapshot of the nightly 1.4.1 build.

Plugin version 2.1.3.

I'll email you the gist link.

olensmar commented 8 years ago

ok - seems as if 2.2.1 fixed this - closing!

djorg83 commented 7 years ago

Im getting this error. Swagger plugin 2.5.1, ReadyAPI 1.9.0

olensmar commented 7 years ago

@djorg83 please share your swagger definition so we can reproduce and fix - thanks!

michelchristianen commented 6 years ago

I'm having the same error with SoapUI Free version 5.4.0. The jar in the plugins folder is: soapui-swagger-plugin-2.2-dist The petstore can fine being loaded.

Is there a new version of the plugin which solves this? or is it possible to add some more debug tracing for seeing the root cause of this.

se7vanj commented 6 years ago

Got the same error in SOAP UI 5.4.0.

ErrorMessage from SOAP-UI:

Mon Feb 26 14:19:35 EST 2018:ERROR:java.lang.NullPointerException: Cannot get property 'info' on null object java.lang.NullPointerException: Cannot get property 'info' on null object at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:60)

Used Altova XML Spy 2018 and checked the JSON format of the Swagger JSON, got few errors in result:

Character '}' is grammatically unexpected. Reason: one of the following is expected (see below) String

Before: image

After removing all the unwanted , (commas) before the end of the last braces, problem resolved within Altova XML Spy for "Check well-formedness".

After: image

Now SOAP-UI Import Swagger successfully completed. @michelchristianen can give it a try:

ishegelman commented 5 years ago

In my case the issue seemed to be some whitespace character. Simply saving swagger yaml in Notepad++ eliminated that character and I was able to open it in soapUI.

Prior to that, I was getting the same error: "java.lang.NullPointerException: Cannot get property 'info' on null object", while I was still able to open the same yaml file in ReadyAPI.