Skip to Content
0
Former Member
Jun 30, 2014 at 07:18 AM

Odata JDBC Service: getting NullPointerException: while trying to invoke the method

424 Views

Hi,

I am testing OData, for that I followed the steps given in this tutorial:

http://scn.sap.com/community/developer-center/mobility-platform/blog/2014/06/10/creating-an-odata-service-based-on-sap-gateway-soap-jdbc-and-jpa-data-sources-ba

It wasn't working as it should, so to understand it better, I created a new project with Stock table only.

Manually entered all it's properties and then deploy it.

Issue1: when I create a JDBC connection to connect with derby database, The driver field has maximum limit and whole driver string is not copied. Attached is the screen shot.

Where as I need to enter: org.apache.derby.jdbc.ClientDriver.

Issue 2: I can't test the connection from here, weather it's working fine or not ?

Issue 3:

When I deploy the project and test the result, I get the Stock Service, But when I try to run this, I get nullpointer exception.

URL: http://localhost:8080/gateway/odata/sap/WSTest1;v=1

Response:

<?xml version="1.0" encoding="utf-8"?>
<service xml:base="http://localhost:8080/gateway/odata/sap/WSTest1;v=1/" xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom">
  <workspace>
   <atom:title>Default</atom:title>
   <collection href="StockSet">
   <atom:title>StockSet</atom:title>
   </collection>
  </workspace>
</service>

Now I need to run StockSet, so next url to access the stock list,

to get stocks:

http://localhost:8080/gateway/odata/sap/WSTest1;v=1/SAP/StockSet

Now I get the following response:

<?xml version="1.0" ?>

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<code>

</code>

<message xml:lang="en">java.lang.NullPointerException: while trying to invoke the method java.lang.Object.hashCode() of a null object loaded from local variable 'k'</message>

</error>

I am not able to figure out, why I am getting this error and how to fix it.

All I want is to create a ODAta on ESPM_STOCK sample table given in example.

Looking forward to hear from you.

Thanks.

Attachments