Trying to integrate Remedy java api with servlets on Tomcat

Hi,

I've been trying to make remedy my backend for an application. We're using remedy 5.1 (library arapi.jar).

First problem (it may help someone) I ran into right away was that I couldn't put arapi.jar into WEB-INF/lib, since underlining C modules cannot be loaded twice and tomcat complained about it. I eliminated that problem by putting arapi.jar into <tomcathome>/common/lib, but now the library cannot see the server. If I run almost exactly same code from the command line - it works, if I run it through servlet - it doesn't see the database server, and I get same error from remedy api as if I mistyped the server name, so somehow tomcat doesn't seem to resolve server name maybe? This is all very confusing.

Did anybody have same issues? I would greatly appreciate any help.

VG.

P.S. piece of code that works with command line and doesn't in servlet:

String user = args[0];

String password = args[1];

String language = "";

String server = args[2];

ARServerUser remedyUser = new ARServerUser(user, password, language, server);

System.out.println("trying to connect to " + server + "...");

System.getProperties().list(System.out);

try {

remedyUser.login();

} catch (ARException are) {

System.out.println("REMEDY Exception:");

are.printStackTrace();

} catch (Exception e) {

System.out.println(e.getMessage());

}

Error code I get from Remedy API:

MessageType: 2

MessageNum: 90

MessageText: Cannot open catalog; Message number = 90

AppendedText: "diablo" : RPC: Unknown host

[1649 byte] By [Valentyn_Ga] at [2007-10-3 0:57:23]
# 1

Perhaps it is because the database driver cannot be found, did you put that in common/lib as well?

Else it can only be the values you pass to remedy that are faulty. You seem to be passing them as command line parameters to your command line app, how are you passing them in your servlet?

gimbal2a at 2007-7-14 17:52:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks for response.

The values I pass to remedy should be fine, I even had them hard-coded in both servlet and main, so that's not an issue. What dazzles me is that by using same arapi51.jar file in the same location the program launched from commandline works and from servlet doesn't. I mean, the program from the command line wouldn't work without a driver either, or would it?

val_reznika at 2007-7-14 17:52:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

YAY! the data WAS flawed - I was using property file (such as myremedy.user=val_reznik), but I was putting quotes around it, and DUH! it thought my server name was "diablo", not diablo. If you EVER use property files and system property loader - NO QUOTES AROUND VALUES!

However, I hope this post helps others - when using native libraries with tomcat (such as remedy, which is basically a java wrapper for C library) - DON'T put it in WEB-INF/lib, put it in <tomcathome>/common/lib - that way it will only load it once, and tomcat won't complain.

val_reznika at 2007-7-14 17:52:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...