Search code examples
playframeworkplayframework-2.0semantic-webjena

Jena API in Play Framework 2


Scenario -

  1. Jena API
  2. Play framework 2
  3. Database server - fuseki
  4. Database - TDB

Problem - I have insert query in module, when I fill information in HTML form I am getting error like [NullPointerException: null] error points at where I am closing my datasource which is at the bottom of method ds.close(); interesting thing is that when I commented //ds.close(); error shifts to the UpdateAction.parseExecute(query1, graph); and because of this I am not able to see filled form information.

Most interesting thing is that when I am writing select * where {?a ?b ?n} on fuseki database server I can see inserted data. Means data is getting stored.

Am I supposed to do any changes in conf/application.conf file in play framework?, guys your help will be appreciated.

Thanks.


Solution

  • Generally speaking, if you want to debug a NullPointerException you need to look at the stack trace to see where the error is occurring. Based on what you've told us so far, if commenting out ds.close() moves the NPE somewhere else in your code, then the value of variable ds must be null.

    If you can't tell just from looking at the code why ds has the wrong value, run in a debugger and single-step through that method. Or, even better, write some JUnit tests to check that the contract you have for each object in your system is correct.

    But in answer to your direct question, no: changing conf/applicaton.conf is highly unlikely to solve your NPE.