Hello again,
sorry to put on this topic again. But I was interrupted by other tasks, and this is still a problem. I get no vailid response from the Database.
But this works, and even if the database doesn’t run. And there is a problem. I need a response, at least when the database is not working! This is very importend for me.
Can anybody help. Hope I have enough time to finish this problem now :?
Check the Tamino API for Java Documentation
and the Interface TSystemAccessor
and the method isServerAlive
That will provide you with the servers status.
It checks whether the Tamino database is running by trying to establish a connection. It returns true if this succeeds, false otherwise
Ok, if I try your URL (without starting the database), I got this response:
<?xml version='1.0'?>
<ino:response xmlns:ino='http://namespaces.softwareag.com/tamino/response2'>
<ino:message ino:returnvalue='8201'>
<ino:messagetext ino:code='INOXHE8201'>Can't connect to server on host localhost at port 3201, TCP error code 10061.</ino:messagetext>
</ino:message>
</ino:response>
import com.softwareag.tamino.db.api.accessor.TAccessLocation;
import com.softwareag.tamino.db.api.accessor.TAccessorException;
import com.softwareag.tamino.db.api.accessor.TSystemAccessor;
import com.softwareag.tamino.db.api.common.TException;
import com.softwareag.tamino.db.api.connection.TConnection;
import com.softwareag.tamino.db.api.connection.TConnectionFactory;
import com.softwareag.tamino.db.api.common.TAccessFailureMessage;
import com.softwareag.tamino.db.api.connection.TConnectionException;
import java.io.*;
import java.lang.*;
import java.util.*;
public class TaminoApp {
protected static boolean checkServerAndPrintSystemInformation(TConnection connection, String DATABASE_URL ) throws TAccessorException
{
// Obtain the TSystemAccesor
TSystemAccessor systemaccessor = connection.newSystemAccessor();
if ( !systemaccessor.isServerAlive() )
{
return false;
}
else
{
System.out.println( "------------------------------\nServer is alive" );
System.out.println( "The Tamino server hosting " + DATABASE_URL +
" is version " + systemaccessor.getServerVersion() );
return true;
}
}
private static String[] parseArgs( String[] args)
{
if (args.length >= 1)
return args;
else
{
System.out.println("\nUsage: java TaminoApp database-url\n" +
" e.g. java TaminoApp http://pcmypc/tamino/mydb\n" );
System.exit(0);
return null;
} // end else
} // end parseArgs()
public static void main (String[] args) throws Exception
{
parseArgs(args);
String sargs[]= parseArgs(args);
// URL of the Tamino database
String DATABASE_URL = new String( sargs[0]);
// Establish the connection to Tamino
TConnection connection = TConnectionFactory.getInstance().newConnection( DATABASE_URL );
// Check if the connection is available and print out some system information
if ( !checkServerAndPrintSystemInformation( connection, DATABASE_URL ) )
return ;
} // end main
} // end CheckDBstatus
Which is getting compiled.
But if I call this app with
I got this dumped:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
at com.softwareag.common.instrumentation.logging.LoggerFactory.getLogger
(Unknown Source)
at com.softwareag.common.instrumentation.contract.Contract.<clinit>(Unkn
own Source)
at com.softwareag.common.instrumentation.contract.Precondition.isEnabled
(Unknown Source)
at com.softwareag.tamino.db.api.objectModel.TXMLObjectFactory.<clinit>(U
nknown Source)
at com.softwareag.tamino.db.api.objectModel.TXMLObject.<clinit>(Unknown
Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.softwareag.tamino.db.api.objectModel.dom.TDOMObjectModel.class$(U
nknown Source)
at com.softwareag.tamino.db.api.objectModel.dom.TDOMObjectModel.<init>(U
nknown Source)
at com.softwareag.tamino.db.api.objectModel.dom.TDOMObjectModel.getInsta
nce(Unknown Source)
at com.softwareag.tamino.db.api.common.TPreference.<init>(Unknown Source
)
at com.softwareag.tamino.db.api.common.TPreference.getInstance(Unknown S
ource)
at com.softwareag.tamino.db.api.connection.TConnectionFactory.<init>(Unk
nown Source)
at com.softwareag.tamino.db.api.connection.TConnectionFactory.<clinit>(U
nknown Source)
at TaminoApp.main(taminoapp.java:60)
The exception says “Tamino access failure.”. Please check whether the status of the tamino database you mentioned as URI is proper and is started or not ?
As you can see above, this URL works with e.g. Firefox-Browser and give me the version-number of my tamino-server.
I made this app just to test if there is problem between eclipse and tamino. But it seems to be that eclipse is not the only problem, maybe it isn’t a problem at all. I just startet the “chris”-Database with the “System managemant hub” and got the same output (exceptions) as I got right before I started this database-instance.
And this app is also created to make a test-connection to the database, if this fails it should return with a failure. But without an exception?
I have absolutely to clue, where the problem is.
What is the name of the Tamino-Server-Process, to find it in the Task-Manager-schedule?
C:\Dokumente und Einstellungen\chris\Eigene Dateien>java TaminoApp http://localhost/tamino/chris
------------------------------
Server is alive
The Tamino server hosting http://localhost/tamino/chris is version 4.2.1.2
But this really means, that there is something wrong with Eclipse and its Sysdeo-Plugin for Tomcat?!?
There it is much more complicated to find a problem :roll:
But thank you anyway, you bring me one step further.
But i didnt understand the following line in your previous post
As far as my knowledge is concerned, there is no problem with Eclipse because i ran your above program from my eclipse and it works fine. The only thing you need to do when running the program in eclipse is to set the program arguments from Run → Run → Arguments tab.
This is not a problem concerning the arguments, but getting a real connection to the server. Take a look at the last post of Mark Kuschnir. He was the one who leads me to the idea to create a application without servlets and without eclipse. I use the Eclipse-Tomcat plugin by Sysdeo [url]http://www.sysdeo.com/eclipse/tomcatplugin[/url] and this is perhaps the reason for the problem of “getting tomcat and tamino together” ?
By the way, I didn’t get the application to run in eclipse. Althought I put the argument in the “run-dialog”
I got this dumped:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.softwareag.tamino.db.api.common.TAccessFailureException.retrieveAccessFailureDetails(Unknown Source)
at com.softwareag.tamino.db.api.common.TAccessFailureException.<init>(Unknown Source)
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.connection.TConnectionImpl.<init>(Unknown Source)
at com.softwareag.tamino.db.api.connection.TConnectionFactory.newConnection(Unknown Source)
at TaminoApp.main(TaminoApp.java:62)
Caused by: java.lang.NullPointerException
at com.softwareag.common.resourceutilities.ResourceLocator.getAllResourceLocations(Unknown Source)
at com.softwareag.common.resourceutilities.AbstractXMLBasedResourceBundle.getBundle(Unknown Source)
at com.softwareag.common.resourceutilities.message.XMLMessageResourceBundle.getBundle(Unknown Source)
at com.softwareag.common.resourceutilities.message.XMLMessageResourceBundle.getBundle(Unknown Source)
at com.softwareag.tamino.db.api.message.TResourceId.<init>(Unknown Source)
at com.softwareag.tamino.db.api.common.TCommonMessages.<clinit>(Unknown Source)
... 11 more