2 Replies Latest reply on Aug 23, 2002 5:04 PM by Manan

    NamingException that given DataSource name not bound

    Rahul Newbie

      Hello all,
      We have our own implementation of LoginModule and CallbackHandler which are registered in the login-config.xml as :
      <application-policy name = "Login">

      <login-module code = "com.teoco.security.SecurityLoginModule" flag = "required">
      <module-option name =
      "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=BTPDataSource</module-option>
      <module-option name = "debug">true</module-option>
      </login-module>

      </application-policy>

      The "managedConnectionFactoryName" is the option property used to get the datasource value : jboss.jca:service=LocalTxCM,name=BTPDataSource

      we have an entry in our database-service configuration file as :


      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->

      BTPDataSource


      .
      .
      .
      .

      I can fetch the DataSource option property in my code and get the value jboss.jca:service=LocalTxCM,name=BTPDataSource but when i do :
      Context initial = new InitialContext();
      DataSource dataSource = (DataSource) initial.lookup(dsJNDIName);

      i get a NamingException for the second line of code as:
      javax.naming.NameNotFoundException: jboss.jca:service=LocalTxCM,name=BTPDataSource not bound

      Any help please will be greatly appreciated..
      Thank you in advance,
      Regards,
      rahul

      The full trace of the exception is as :
      javax.naming.NameNotFoundException: jboss.jca:service=LocalTxCM,name=BTPDataSource not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:450)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:434)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at com.teoco.dao.DBConnection.(DBConnection.java:54)
      at com.teoco.dao.BaseDAO.getConnection(BaseDAO.java:39)
      at com.teoco.security.dao.SecurityDAO.authenticateUser(SecurityDAO.java:58)
      at com.teoco.security.SecurityLoginModule.login(SecurityLoginModule.java:196)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at javax.security.auth.login.LoginContext.invoke(LoginContext.java:664)
      at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
      at javax.security.auth.login.LoginContext$4.run(LoginContext.java:599)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:596)
      at javax.security.auth.login.LoginContext.login(LoginContext.java:523)
      at com.teoco.btp.btpweb.authenticate.LogonAction.perform(LogonAction.java:107)
      at org.apache.struts.action.Action.execute(Action.java:401)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:371)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:613)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1387)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1326)
      at org.mortbay.http.HttpServer.service(HttpServer.java:757)
      at org.jboss.jetty.Jetty.service(Jetty.java:528)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:741)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:914)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:756)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:151)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
      at java.lang.Thread.run(Thread.java:536)