I’m getting a NullPointer Exception when inserting a document into Tamimo.
//Insert new document into Tamino
TXMLObject submission = TXMLObject.newInstance(element);
TResponse response = accessor.insert(submission);
System.out.println("Response to insert: " + response.getReturnValue());
I’m getting an exception on the TResponse response = accessor.insert(submission) line.
I think that the most likely possibility for a NullPointerException on the line you mentioned is that the “accessor” object is null.
Could you please post the code where you create and assign a value to the “accessor” object?
Thank for the reply Trevor,
Here’s the code where I assign a value to the accessor
// Obtain the concrete TXMLObjectAccessor using the JDOM object model
accessor = connection.newXMLObjectAccessor(TAccessLocation.newInstance(collection), TJDOMObjectModel.getInstance());
I’ve also attached the whole java program.
CreateNew.java (4.94 KB)
In your code you assign values to the “connection” and “accessor” fields in the “CreateNew” constructor - but unfortunately this constructor is never called!
I would recommend making the “connection” and “accessor” fields local to the main method, and initializing them just before usage.
I hope that helps,