Tamino call causing nullpointer exception

Hi,

I’m doing a xquery but I get a nullpointer exception if the there is no documents that satisfy the query. This only happens if the accessor is set to xml, but works fine when the accessor is set to stream. It also works if I change the query to retrieve a document that I know exists.

It appears as if a nullpointer exception occurs as there is no document to set to active. How can I overcome this or am I doing something wrong?

===============
Here is the sequence.
===============
<?xml version="1.0" encoding="UTF-8"?>
















===============
Section from file log
===============
FormController[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,513[slf5s.DATE] Thread-4[slf5s.THREAD] DEBUG[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagSequencer - 1127b52~ff692859a67fb8 - xbd.tamino.xquery-text = for $a in input()/Process, $b in input()/ProcessSequence where $a/Name = “RFQ” and $b/CompanyID = “None11” and $a/ID = $b/ProcessID return $b/FormSequence[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,513[slf5s.DATE] Thread-4[slf5s.THREAD] DEBUG[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagSequencer - 1127b52~ff692859a6
7fb8 - xbd.tamino.connection-name = TaminoConnection[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,513[slf5s.DATE] Thread-4[slf5s.THREAD] DEBUG[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagTaminoQuery - TaminoQuery: connection table is com.softwareag.xbridge.tamino.INOConnectionImpl@17414c8[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,513[slf5s.DATE] Thread-4[slf5s.THREAD] INFO [slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagTaminoQuery - TaminoQuery: Using connection TaminoConnection and XML accessor to query collectionFormController[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,513[slf5s.DATE] Thread-4[slf5s.THREAD] DEBUG[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagTaminoQuery - TaminoQuery: connection object is com.softwareag.tamino.db.API.connection.TConnectionImpl@fbbbc[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,773[slf5s.DATE] Thread-4[slf5s.THREAD] INFO [slf5s.PRIORITY] xbd[slf5s.CATEGORY] - TaminoQuery: XQuery succeeded, return value=0[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,773[slf5s.DATE] Thread-4[slf5s.THREAD] DEBUG[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - TaminoQuery: Query response: First of -1[slf5s.MESSAGE]
[slf5s.start]05 Oct 2004 16:59:36,773[slf5s.DATE] Thread-4[slf5s.THREAD] ERROR[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagSequencer - SEQUENCER ERROR: sequence “http://jean-laptop:8080/mediator/BDHub/FormController/Sequence/GetProcessDocument.xml”, line 14, : null[slf5s.MESSAGE]
java.lang.NullPointerException
at com.softwareag.xbridge.tamino.INOHelper.logXMLResponse(DashOB6501:1100)
at com.softwareag.xbridge.tamino.INOHelper.queryAsXML(DashOB6501:241)
at com.softwareag.xbridge.tamino.TaminoQuery.modify(DashOB6501:313)
at com.softwareag.xbridge.infrastructure.y.modify(DashOB6501:56)
at com.softwareag.xbridge.sequencer.KeywordSTEP.execute(DashOB6501:148)
at com.softwareag.xbridge.sequencer.SequencerImpl.execute(DashOB6501:573)
at com.softwareag.xbridge.sequencer.SequencerImpl.dispatch(DashOB6501:293)
at com.softwareag.xbridge.infrastructure.ac.perform(DashOB6501:235)
at com.softwareag.xbridge.util.WorkerThread.run(DashOB6501:424)
[slf5s.start]05 Oct 2004 16:59:36,793[slf5s.DATE] Thread-4[slf5s.THREAD] DEBUG[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagSequencer - execute STOP flag:false END flag:false next statement:step[slf5s.MESSAGE]


Any help appreciated,
Regards Jean

Hi Jean,

What version of Mediator are you running?

Regards,

Jason

I’m running Mediator 7.3.1.

It’s the demo version.

and I’m using Tamino 4.2.1.1

Regards,
Jean

Hi Jason,

Just one more thing, I don’t know if it’s related.

My options for the xbd.tamino.isolation-degree property for the SagTaminoConnection step is wrong. It gives me stable_document, commited_command, etc. But when I use these values I get an error stating that I have an invalid value for the field. When I enter stableDocument in the text area I don’t have a problem with the field.

This is weird.

Mediator 7.3.1.0

Hi Jean,

Can you turn off DEBUG logging and rerun the query that does not return a result?

Thanks,

Jason

Hi Jason,

I turned off debug logging and the query now works if there is no result.

1 - If there is no result the new document is not created, how do I check if it exists or not? I suppose I could use the enumerator but is there an easier way?

2 - And what about the wrong values I get for xbd.tamino.isolation-degree?

Thanks
J

Jean,

1. This is a bug in Mediator that was just fixed. The error occurs if DEBUG is on and the query returns no records. The workaround is to turn off DEBUG logging.

2. Please post the log message.

Regards,

Jason

Jason,

1 - I just wanted to know if there is an easier way to determine if a contentID exists in a multipart message as the document is not created if there was no valid document from the Tamino query. I currently do determine this by using the enumerator but thought there might be an easier way, like a property stating the number of documents returned etc.

2 - Here is the log file, the value entered(stable_document) is from the drop down list and also appears in the documentation!

[slf5s.start]07 Oct 2004 08:32:21,409[slf5s.DATE] main[slf5s.THREAD] WARN [slf5s.PRIORITY] xbd[slf5s.CATEGORY] - Optional component (name=SagEntireXGateway)(type=EntireXGateway) could not be created.[slf5s.MESSAGE]
[slf5s.start]07 Oct 2004 08:32:21,419[slf5s.DATE] main[slf5s.THREAD] WARN [slf5s.PRIORITY] xbd[slf5s.CATEGORY] - Optional component (name=SagXmlWrapperGateway)(type=XmlWrapperGateway) could not be created.[slf5s.MESSAGE]
[slf5s.start]07 Oct 2004 08:32:21,489[slf5s.DATE] main[slf5s.THREAD] WARN [slf5s.PRIORITY] xbd[slf5s.CATEGORY] - Optional component (name=SagCommunicatorGateway)(type=XACIGateway) could not be created.[slf5s.MESSAGE]
[slf5s.start]07 Oct 2004 08:33:45,761[slf5s.DATE] Thread-4[slf5s.THREAD] ERROR[slf5s.PRIORITY] xbd[slf5s.CATEGORY] - SagSequencer - SEQUENCER ERROR: sequence “http://jean-laptop:8080/mediator/BDHub/FormController/Sequence/GetProcessDocumentTest.xml”, line 13, : com.softwareag.xbridge.exceptions.XException: Cannot perform modify-session for an invalid value. xbd.tamino.isolation-degree=stable_document[slf5s.MESSAGE]
com.softwareag.xbridge.exceptions.XException: Cannot perform modify-session for an invalid value. xbd.tamino.isolation-degree=stable_document
at com.softwareag.xbridge.tamino.TaminoConnection.validateProperty(DashOB6501:393)
at com.softwareag.xbridge.tamino.TaminoConnection.modifySession(DashOB6501:252)
at com.softwareag.xbridge.tamino.TaminoConnection.modify(DashOB6501:172)
at com.softwareag.xbridge.infrastructure.y.modify(DashOB6501:56)
at com.softwareag.xbridge.sequencer.KeywordSTEP.execute(DashOB6501:148)
at com.softwareag.xbridge.sequencer.SequencerImpl.execute(DashOB6501:573)
at com.softwareag.xbridge.sequencer.SequencerImpl.dispatch(DashOB6501:293)
at com.softwareag.xbridge.infrastructure.ac.perform(DashOB6501:235)
at com.softwareag.xbridge.util.WorkerThread.run(DashOB6501:424)

Thanks for all your help
Jean

Hi Jean,

1. If you are using a stream accessor you could
use an XPath expression to set a property to the number of returned documents.
For example:


If you are using an XML or non-XML accessor
you have to test the properties such
as xbd.tamino.iterator or xbd.tamino.return-code. See the “Maintaining XML Documents in Tamino” in the Mediator documentation.

2. This is a bug which is being fixed now. You can workaround this by editing the sequence in text mode. The correct values for
xbd.tamino.isolation-degree are committedCommand, serializable, stableCursor, stableDocument and uncommittedDocument.

Regards,

Jason

Hi Jason,

1. Isn’t the xbd.tamino.iterator property only created if there is more than one document returned, to indicate there is another so that you can do another query?


2. Thanks, thought I was going crazy.

Regards,
Jean

Hi Jean,

1. You’re right about xbd.tamino.iterator.

There is no property that will tell you the number of documents returned from an xquery. The reason for this, if I’m reading the Tamino Javadoc correctly, is that iterator class’s getCount() method does not return anything for xqueries.

Regards,

Jason