what's wrong with this info?

I use JB7 to run the ProcessPerson.java(an example in Tamino Document)
but I couldn’t fix this problem,what’s wrong with it?

the tracestack infomation:
Nested Exception (com.softwareag.tamino.db.API.common.TPreconditionViolation) stacktrace:


com.softwareag.tamino.db.API.common.TPreconditionViolation: No Reader given.

at com.softwareag.tamino.db.API.common.TContractVerifier.precondition(TContractVerifier.java:31)

at com.softwareag.tamino.db.API.objectModel.dom.TDOMReader.read(TDOMReader.java:56)Reading documents from file and insert into database



at com.softwareag.tamino.db.API.objectModel.dom.TDOMAdapter.readFrom(TDOMAdapter.java:182)

at com.softwareag.tamino.db.API.examples.person.ProcessPersons.performInsertPersonFromFile(ProcessPersons.java:96)

at com.softwareag.tamino.db.API.examples.person.ProcessPersons.main(ProcessPersons.java:210)

I am a Java NewComer.

InputStream myInputStream =null;

System.out.println((new File(“person1.xml”)).exists());
myInputStream = (new ProcessPersons()).getClass().getResourceAsStream( “e:\test\person1.xml” );

the console result show me that the file “person1.xml” is existing,but myInputStream is still null…

this is the part of ProcessPerson example in Tamino Documents.(Tamino Server 3.1.1)

could u please tell me what’s going wrong?

I am a Java NewComer.

hi,

since you claim to be a newbie, it’s rather hard to tell, what you were doing.
either, something is generally wrong in the way you set up the TDOMReader.
or, you did a smart thing and tested what’s in the reader before passing it to the TDOMReader. this you must not do, as then the data stream is “consumed” and cannot be read anymore.

hope that helps.

andreas f.

The statement

InputStream myInputStream = (new ProcessPersons()).getClass().getResourceAsStream( filename );

in the sample is used to read an input file, which is located in the JavaTaminoAPIExamples.jar archive from the same location as the class itself. You can’t give a path to this method.

What you want to do is read from the filesystem. Try the statement, which is given in the comment section of ProcessPersons.java, which is:

xmlObject.readFrom( new FileReader( “e:\test\person1.xml” ) );

This will give you an TXMLObject build from your file.

the problem occurs when I created a new project and copy-paste the source code to a new file…
so…

it puzzles me a lot.

thank u again for ur help:)

I am a Java NewComer.