You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Scott Kurinskas <sc...@gemstone.com> on 2006/08/15 02:03:38 UTC
java.lang.NullPointerException when trying to create an empty dat
a graph
Hi-
I'm trying to put togther a very simple example constructing an empty
DataObject. Its very similar to the ChangeSummary test case. However,
whenever I try to construct an empty DataObject, I receive a null pointer
exception. My example is below. Its failing on 'DataObject customer ...'.
I do not understand why this exception occurs. Any assistance would be
greatly appreciated.
try {
DataGraph dataGraph = SDOUtil.createDataGraph();
DataObject customer =
dataGraph.createRootObject("http://www.example.com/simple", "Customer");
...
Exception:
java.lang.NullPointerException
at org.eclipse.emf.ecore.util.EcoreUtil.create(EcoreUtil.java:2918)
at
org.apache.tuscany.sdo.util.DataObjectUtil.create(DataObjectUtil.java:2324)
at
org.apache.tuscany.sdo.impl.DataGraphImpl.createRootObject(DataGraphImpl.jav
a:594)
at gemfire.example.customer.sdo.SDOTest.main(SDOTest.java:21)
Regards,
Scptt
Re: java.lang.NullPointerException when trying to create an empty dat a
graph
Posted by Hasan Muhammad <as...@us.ibm.com>.
Hi Scott,
It looks like the SDO Runtime did not get initialized prior to creating the
DataGraph. If so, it would most likely fail to get the right SDO Factory
and hence could return a null object for the DataGraph. Hence the
NullPointerException.
You could initiate the SDO Runtime simply by inserting the following line
in the beginning before any SDO calls..
SDOUtil.createTypeHelper();
regards
Hasan Muhammad
Allah's Messenger Muhammad (Pbuh) said, "While a man was on the way, he
found a thorny branch of a tree there on the way and removed it. Allah
thanked him for that deed and forgave him."
Scott Kurinskas
<scott.kurinskas@
gemstone.com> To
tuscany-user@ws.apache.org
08/14/2006 08:03 cc
PM
Subject
java.lang.NullPointerException when
Please respond to trying to create an empty dat a
tuscany-user@ws.a graph
pache.org
Hi-
I'm trying to put togther a very simple example constructing an empty
DataObject. Its very similar to the ChangeSummary test case. However,
whenever I try to construct an empty DataObject, I receive a null pointer
exception. My example is below. Its failing on 'DataObject customer ...'.
I do not understand why this exception occurs. Any assistance would be
greatly appreciated.
try {
DataGraph dataGraph =
SDOUtil.createDataGraph();
DataObject customer =
dataGraph.createRootObject("http://www.example.com/simple", "Customer");
...
Exception:
java.lang.NullPointerException
at
org.eclipse.emf.ecore.util.EcoreUtil.create(EcoreUtil.java:2918)
at
org.apache.tuscany.sdo.util.DataObjectUtil.create(DataObjectUtil.java:2324)
at
org.apache.tuscany.sdo.impl.DataGraphImpl.createRootObject(DataGraphImpl.jav
a:594)
at gemfire.example.customer.sdo.SDOTest.main(SDOTest.java:21)
Regards,
Scptt