TConnection and Servlets -> TServerNotAvailableException


i try to connect my Tamino I wrote a DBHandler, which contanis following lines:

TConnectionFactory connectionFactory = TConnectionFactory.getInstance();
try {
// Obtain the connection to the database
connection = connectionFactory.newConnection( url );
} catch (TServerNotAvailableException e) { throw new Exception (e)}

If I create an instance of my DBHandler from another Class, which is started from the DOS-Prompt with a main-method, there is no Problem. But if I create an instance of my DBHandler from a Servlet I get this Exceptionmessage:
Server Not Available!
NestedException:Invocation constructor failed.
NestedException without message!

Has anybody any idea about this?

Thanks for your help, MArtin

hi MArtin,

do you have

Tamino\SDK\TaminoAPI4J\lib\log4j-core.jar in the classpath of the servlet?


andreas f.

It is in the global classpath… should be the same, isn’t it?


Hi MArtin,

one way to be sure would be to print the CLASSPATH from your Servlet class. You can accomplish this fairly easily:

   String cp = System.getProperty(“java.class.path”);
   System.out.println("CLASSPATH: " + cp);
(If you are using more advanced logging - which appears not to be the case - you should print the value of “cp” appropriately. If you use System.out it prints to the Tomcat console, if I remember correctly.)

Perhaps this is a silly question, but: are you 100% sure that the same value is being used for “url” in the working/not working tests?


Guys, you are great.

Andreas you were right. I had not several files in the tomcat classpath. With your help Trever I got it…

Tsts… I didn’t know, that the Tomcat uses another classpath than the rest of the system.

Thanks guys,