XMLGreeting problems

Hi tried to execute the XMLGreeting example, but when I execute the example I get the next error:

C:\SoftAG\Tamino4.1.1\Tamino 4.1.1.1\SDK\TaminoAPI4J\Documentation\inoapi\listings\hello>java com.softwareag.tamino.db.API.examples.greeting.XMLGreetin
g
Exception in thread “main” Nested Exception (com.softwareag.tamino.db.API.invocation.TCommunicationException, tag: $Name: JavaTaminoAPI_2_1_0_39 $) sta
cktrace:

Nested Exception (java.lang.NullPointerException, tag: $Name: JavaTaminoAPI_2_1_0_39 $) stacktrace:

java.lang.NullPointerException
at java.io.FilterInputStream.read(FilterInputStream.java:64)
at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TAbstractInvocation.getDocument(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TAbstractInvocation.checkServerAvailabilityAndVersion(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TInvocationFactory.initialize(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TInvocationFactory.newInvocation(Unknown Source)
at com.softwareag.tamino.db.API.connection.TConnectionFactory.newConnection(Unknown Source)
at com.softwareag.tamino.db.API.examples.greeting.XMLGreeting.main(Unknown Source)

I’m working with Tamino 4.1.1.1 and JDK 1.3.1_05.
I included the needed jar files in the CLASSPATH variable (TaminoAPI4J.jar, JavaTaminoAPIExamples.jar, xercesImpl.jar, xmlparserAPIs.jar and log4j.jar)

Could someone help me with that?

Thanks

Hello Noelia,

I just tested this using the delivered Jar files and JDKs 1.3.1_06, 1.3.1_07 and 1.4.1_02 - all of which worked fine.
I am also using Tamino 4.1.1.8, though I’m not sure if that makes any difference.

Do you also have the jdom.jar in your classpath? (There should be a NoClassDefFoundError if it is not…)

Could you please try with a newer JDK to see if that makes any difference?

Thanks,
Trevor.

Hi Noelia,

it sounds to me as the connection to the database could not be established. Did you try to connect to your database in a browser window?
(Something like “http://myserver/tamino/mydb?_diagnose=ping”)

Cheers, Christian.

Hi Trevor and Christian,

I have changed the CLASSPATH and now I used the .jar files from the /lib, before I got two of them from another directory. I continue getting an error, but it is a different one:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

C:\SoftAG\Tamino4.1.1\Tamino 4.1.1.1\SDK\TaminoAPI4J\Documentation\inoapi\listings\hello>java com.softwareag.tamino.db.API.examples.greeting.XMLGreetin
g
Exception in thread “main” Nested Exception (com.softwareag.tamino.db.API.invocation.TCommunicationException, tag: $Name: JavaTaminoAPI_2_1_0_39 $) stacktrace:

Nested Exception (com.softwareag.tamino.db.API.invocation.TInvocationRetryHandlerException, tag: $Name: JavaTaminoAPI_2_1_0_39 $) stacktrace:

Nested Exception (com.softwareag.tamino.db.API.invocation.TCommunicationException, tag: $Name: JavaTaminoAPI_2_1_0_39 $) stacktrace:

Nested Exception (com.softwareag.tamino.db.API.invocation.http.THTTPInvocationFailureException, tag: $Name: JavaTaminoAPI_2_1_0_39 $) stacktrace:

HTTP invocation failure.
at com.softwareag.tamino.db.API.invocation.http.THTTPInvocation.getInputStream(Unknown Source)
at com.softwareag.tamino.db.API.invocation.http.THTTPInvocation.doGetInvoke(Unknown Source)
at com.softwareag.tamino.db.API.invocation.http.THTTPInvocation.doInvoke(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TAbstractInvocation.doTemplateInvoke(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TAbstractInvocation.invoke(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TAbstractInvocation.checkServerAvailabilityAndVersion(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TInvocationFactory.initialize(Unknown Source)
at com.softwareag.tamino.db.API.invocation.TInvocationFactory.newInvocation(Unknown Source)
at com.softwareag.tamino.db.API.connection.TConnectionFactory.newConnection(Unknown Source)
at com.softwareag.tamino.db.API.examples.greeting.XMLGreeting.main(Unknown Source)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have tried the browser communication with the Tamino database, and I can see that the DB is alive, so the communication via browser is OK.

I forget to mention that when I compiled the java program XMLGreeting I received a few warnings, but I don’t think that this could be the problem. I’m going to copy the warnings just to confirm that this is not the problem:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

C:\SoftAG\Tamino4.1.1\Tamino 4.1.1.1\SDK\TaminoAPI4J\Documentation\inoapi\listings\hello>javac -deprecation XMLGreeting.java
XMLGreeting.java:56: warning: hasAccessFailureMessage() in com.softwareag.tamino.db.API.accessor.TAccessorException has been deprecated
if ( insertException.hasAccessFailureMessage() )
^
XMLGreeting.java:58: warning: getAccessFailureMessage() in com.softwareag.tamino.db.API.accessor.TAccessorException has been deprecated
insertException.getAccessFailureMessage() );
^
XMLGreeting.java:61: warning: getDeepestException() in com.softwareag.tamino.db.API.common.TException has been deprecated
insertException.getDeepestException().getMessage() );
^
XMLGreeting.java:80: warning: hasAccessFailureMessage() in com.softwareag.tamino.db.API.accessor.TAccessorException has been deprecated
if ( queryException.hasAccessFailureMessage() )
^
XMLGreeting.java:82: warning: getAccessFailureMessage() in com.softwareag.tamino.db.API.accessor.TAccessorException has been deprecated
queryException.getAccessFailureMessage() );
^
XMLGreeting.java:85: warning: getDeepestException() in com.softwareag.tamino.db.API.common.TException has been deprecated
queryException.getDeepestException().getMessage() );
^
6 warnings

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Now I’m going to install Java 1.4.1 and try with that java version.

More information in a near future :wink:

Regards,

No

Hello No

Hi Trevor,

you were right, I was using the XMLGreeting class form the .jar file. It was my fault. Now its running.

But I have been doing a few changes, trying to read the XML doc from a file.

Instead of:

StringReader stringReader = new StringReader( XML );
xmlObject.readFrom( stringReader );

where

String XML =
“HelloWorld”;

I try with that method:

“” xmlObject.readFrom( new FileInputStream(XML));“”


Where XML is

String XML = “2ba.xml”;

This file contain the XML doc, but when I try to execute this I get the next error:

Exception in thread “main” Nested Exception (java.io.UTFDataFormatException, tag: $Name: JavaTaminoAPI_2_1_0_39 $) stacktrace:

java.io.UTFDataFormatException: Invalid byte 2 of 3-byte UTF-8 sequence.
at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source)
at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager$EntityScanner.scanContent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.softwareag.tamino.db.API.objectModel.dom.TDOMReader.read(Unknown Source)
at com.softwareag.tamino.db.API.objectModel.dom.TDOMReader.read(Unknown Source)
at com.softwareag.tamino.db.API.objectModel.dom.TDOMReader.read(Unknown Source)
at com.softwareag.tamino.db.API.objectModel.dom.TDOMAdapter.readFrom(Unknown Source)
at com.softwareag.tamino.db.API.objectModel.dom.TDOMAdapter.readFrom(Unknown Source)
at CarregaXML.main(CarregaXML.java:21)

Something related with UTF-8 sentence.

I don’t know what I’m doing wrong. Could you help me with that?

Thank you,

No

Hi No

The stacktrace tells us that the XML parser is not happy with the input, so I would guess that something is wrong with the content of your file “2ba.xml”.

Hi all,

this is the 2ba.xml file:



22222222B
Francisco P

Hello No

I noticed that the xml file “2ba.xml” has no “xml header line”, which also includes the encoding. If the parser accepts the input file without header (I’m not sure about this), he assumes it is UTF-8 encoding. Your input file contains some spanish special character, which is probably not UTF-8 encoded.
You should add a header line and set the correct encoding there.