OTA InitConnectionEx method throwing error: Java/COM Bridge: Server is not available


I am using this below method to connect the QC 9.2 server.

public void connect(){
TDConnection connection = new TDConnection();
connection.Login(user, password);
connection.Connect(domain, project);

Let say this method is existed in ABC.java file

If I run the ABC.class file like a java application it is creating the connection properly.

But If call this method(ABC.connect()) from webservice it is throwing

Java/COM Bridge: Server is not available
at com.bsd.otaclient.ICommandJNI.Execute(Native Method)
at com.bsd.otaclient.ICommandProxy.Execute(ICommandProxy.java:59)

Can someone please help me to fix this.