NPE when calling SDOHelper.createRootDataObject in test

128 Views Asked by At

We have a service method which succesfully calls the WIM of the WAS. In this method we use the SDOHelper to create the RootDataObject and the ControlDataObject using the following (like described in the IBM docs):

DataObject root = SDOHelper.createRootDataObject();
DataObject controller = SDOHelper.createControlDataObject(root, null, SchemaConstants.DO_SEARCH_CONTROL);

For the implementing we added the com.ibm.websphere.org.eclipse.emf and org.eclipse.emf.ecore JARs to the class path with provided scope as it's part of the WAS. Our source compiles and works in the live enviroment.

Now I'll try to write test for this method. But I'll get NPE on the line to create the RootDataObject

java.lang.NullPointerException
  at org.eclipse.emf.ecore.sdo.util.SDOUtil.create(SDOUtil.java:579)
  at org.eclipse.emf.ecore.sdo.impl.EDataGraphImpl.createRootObject(EDataGraphImpl.java:523)
  at com.ibm.websphere.wim.util.SDOHelper.createRootDataObjectCache(SDOHelper.java:111)
  at com.ibm.websphere.wim.util.SDOHelper.createRootDataObject(SDOHelper.java:124)

But I don't know why or how I can avoid it to write a successfull test method

Any suggestions?

0

There are 0 best solutions below