I am using NW'04 support package 9 and am trying to create a JCo connection in a servlet's init method. The call to JCO.createClient() seems to hang indefinitely. I've attached a code sample below, showing the init method and the class that it calls.
All comments welcome. Using JCo is new to me. I've was able to call createClient() from a session bean in the EJB container just file and have not seem anything posted stating that I cannot use the web container in nw. If an error is getting logged, then I don't know where to look.
Donald
================
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyApplicationServlet extends HttpServlet implements SingleThreadModel {
public void init(ServletConfig cfg)
throws ServletException {
private LoggerImpl _logger =
LoggerFactory.getLogger(...);
_logger.logInfo("Initializing App Servlet");
super.init(cfg);
_logger.logInfo("before call to doTest");
(new JCoTest()).doTest();
_logger.logInfo("after call to doTest");
}
}
================
import com.sap.mw.jco.JCO;
public class JCoTest {
public void doTest () {
private LoggerImpl _logger =
LoggerFactory.getLogger(...);
_logger.logInfo ("running JCoTest.doTest() ...");
JCO.Client jcoClient;
try {
jcoClient = JCO.createClient
("001","user","pw","host","00");
// jcoClient.connect();
} catch (Exception ex) {
_logger.logError("JCoTest.doTest() done with error ... " + ex);
}
_logger.logInfo ("JCoTest.doTest() done ...");
}
}