How to trace java.lang.NullPointerException error.

Originally posted by GMSoapUI on February 02, 2015

Can someone please tell me how to debug java.lang.NullPointerException errors? I have an automated solution written in groovy and every so often in the error log I get the line: ERROR:java.lang.NullPointerException. The error does not appear to affect the running of the script but I am really keen to resolve whatever might be causing the problem. I get no other information other than this and the script log gives me nothing extra to go off. There is nothing to tell me what line and in what script the error is occurring, which makes debugging very difficult and time consuming. If someone has experience of debugging issues of this nature I’d be very grateful if they could tell me how to go about determining the script and line responsible. Thank you.

Originally posted by nmrao on February 02, 2015

It is difficult to say unless there is more information like what is the reproducible steps along with soapui version, os etc.,

Originally posted by GMSoapUI on February 02, 2015

Hi and thanks for your reply.

The OS is Windows 7 Pro 64-bit.

SoapUI version is 5.1.2

The steps to reproduce are simply running my groovy script. It occurs several times throughout the script because the script loops through many test cases each of which contain several test steps. I know this may not be particularly helpful as you would need my entire project but my employer very likely won’t let me share it due to it being intellectual property. I can ask.

I find the user-friendliness of SoapUI to be quite poor especially when it comes to debugging things. It never tells you the script or the line number and this makes debugging nearly impossible. It would be great to have a full IDE within it.

Regards

Originally posted by nmrao on February 02, 2015

In general log files shows the error line of the groovy script, in my opinion. Have you checked soapui.log, soapui-error.log files?
At least you could tell what script is doing, that would help to understand or post the script if possible.

Originally posted by nmrao on February 02, 2015

If you are a pro user, then you must be able to use Ready API using the same license where groovy script has context sensitive help support like IDE.

Originally posted by GMSoapUI on February 03, 2015

Hi Rao,

Thank you for your reply again. Here is another example of how unhelpful I find the messages in the logs. In the SoapUI log I have this error:

So I do as it states and look in the error log for the details. That shows this:

There are no additional details. I don’t have any idea what Script1 is as I have many scripts - why doesn’t it refer to the script by the name I have given it? There is no line number anywhere, which would at least help. The variable it is complaining about *was* one I was using but I now no longer use it. I have searched every script individually for the variable in case I have a bad reference but the search string is not found in any script. Saying ‘see error log for details’ would be really helpful *if* there were some actual details rather than a repeat of what is in the SoapUI log. Do you understand the difficulties this is now presenting me with?

I will take a look at Ready API as I’m disheartened with how hard simple debugging is in SoapUI Pro. It is costing me huge amounts of time to track down errors. I really don’t want to have to switch products though.

Thanks.

Gary.

Originally posted by nmrao on February 04, 2015

Not sure how tests are run in your case.

See the attached screen shot, it shows the line number where the problem is clearly. And it always varies the script name irrespective of the groovy script test step name i.e., error always shows Script.groovy and is the intended behaviour. I ran the groovy script test step from SoapUI Pro. And wonder how did not show for you?

And you dont have to be dishartened. You can post the problems in the active community or take it up with support.

Originally posted by nmrao on February 04, 2015

If you run one more time, it may show up as Script3 and so on.

Originally posted by GMSoapUI on February 05, 2015

Hi thanks for the replies.

I have *never* received an error message like yours where it clearly shows the line number responsible for the error. I’ve been using SoapUI Pro since around September 2014.

I run my tests via a Groovy script. The main script runs on a loop that is on a timer of one hour. Each time that script executes it calls a driver script that runs all the test steps in turn for each test case. It is automated. Even running the scripts manually I never get a line number for the errors and never have done. It’s really frustrating.

Regards

G

Originally posted by nmrao on February 05, 2015

Hmm. May you want to try the same example that was shown in the screen shot to see atleast that shows same error as above?

Originally posted by GMSoapUI on February 06, 2015

Hi Rao,

Thank you for your continued interest in helping me and your assistance.

I was able to reproduce the example you showed easily:

By looking at your earlier post I was also able to determine that the error I receive earlier is indicating line 11 of the script is responsible (thank you for helping me find this). However, looking at line 11 in *all* scripts does not reveal a use of the variable mentioned. It only mentions ‘Script 1’ as the cause and line 11 of this script. Since I have no idea what Script 1 refers to I had to check all my scripts. As I said previously I have done a Find to see where the variable is being used but it is not found in any script I am using. I am totally puzzled. If a variable is not longer in use (as it cannot be found by a Find & Replace) then why does SoapUI keep complaining about it. It doesn’t even appear to cause any problems but it is exceptionally irritating to see this in the error log all the time.

Regards

Gary

Originally posted by nmrao on February 06, 2015

That’s fine.
Just to confirm that you were able to proceed, right?

Originally posted by GMSoapUI on February 06, 2015

Hi,

Yes I can proceed as it doesn’t seem to cause any visible problems and I get the correct results. My issue is why the error log is reporting an error with a variable I no longer use. It isn’t found in *any* script I have. It undermines my confidence in the product when it reports false problems.

I have discussed this and various other issues with my line manager and we have decided to switch to using JMeter instead so we are no longer going to be using SoapUI Pro and therefore this will cease to be a problem.

Thank you so much for the time you have spared me on this issue, it was really appreciated.

Regards

Gary.