Comment #2 on issue 2352 by jean.deruelle: Couldn't get datasource from
SipServlet. Bu we can get from HttpServlet.
http://code.google.com/p/mobicents/issues/detail?id=2352
I just tried this with the defaultDS from hsqldb-ds.xml deployed by default
in AS 5.1 and it worked (please note I tried against trunk, if you want to
give it a try you can get it from here
http://hudson.jboss.org/hudson/view/Mobicents/job/MobicentsSipServletsRelease/):
public class ShootmeSipServletAuth extends SipServlet {
private static final long serialVersionUID = 1L;
private static transient Logger logger =
Logger.getLogger(ShootmeSipServletAuth.class);
@Override
public void init(ServletConfig servletConfig) throws ServletException {
logger.info("the register jbcp leak sip servlet has been
started");
super.init(servletConfig);
try {
Context ctx = new InitialContext();
DataSource ds = (DataSource)
ctx.lookup("java:DefaultDS");
logger.info("Datasource " + ds);
} catch (NamingException e) {
throw new ServletException("Uh oh -- JNDI problem !",
e);
}
}
@Override
protected void doRegister(SipServletRequest req) throws
ServletException,
IOException {
logger.info("Received REGISTER " + req);
req.createResponse(200).send();
}
@Override
public void destroy() {
super.destroy();
logger.info("app Destroyed !");
}
}
Can you provide a standalone application (ideally as a maven project) and
all the configuration files and steps needed to reproduce this issue so
that we don't loose time in back and forth ?
Thanks
Jean