0 Replies Latest reply on Feb 8, 2006 10:02 AM by r_tacchi

    datasource not bound

    r_tacchi

      I'm trying use DatabaseServerLoginModule , but when try to access DatabaseServerLoginModule I'm getting Exception that Datasource not bound.
      My code

      login-config.xml :


      <application-policy name="tpmrealm">

      <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
      flag="required">
      <module-option name="dsJndiName">java:/OracleDS</module-option>
      <module-option name="principalsQuery">
      select password from PERSEO.TPM_UTENTI where username=? and flg_abilita='S'
      </module-option>
      <module-option name="rolesQuery">
      select id_ruolo ,'Roles' from TPM_UTENTE_RUOLI where username=?
      </module-option>
      </login-module>

      </application-policy>



      Client program :

      String j_username = null;
      String j_password = null;
      ActionErrors errors = null;
      try {
      // validazione
      if (isDebug())
      logger.debug("inizio");
      j_username = ((LoginForm) form).getJ_username();
      j_password = ((LoginForm) form).getJ_password();
      if (isDebug())
      logger.debug("Tentativo autenticazione per l'operatore "
      + j_username + " ...");
      SecurityAssociationHandler handler = new SecurityAssociationHandler();
      SimplePrincipal user = new SimplePrincipal(j_username);
      handler.setSecurityInfo(user, new String(j_password));
      LoginContext loginContext = new LoginContext("tpmrealm",
      (CallbackHandler) handler);


      loginContext.login();
      Subject subject = loginContext.getSubject();
      // creazione UserBean*/
      UserBean userBean = new UserBean();
      // verifico se il ruolo consente l'accesso
      hasRole(subject, userBean);

      userBean.setUserID(j_username);
      userBean.setPwd(j_password);

      SecurityService securityService = (SecurityService)ServiceUtil.createServiceObject(SecurityService.class
      .getName());

      oracle-ds.xml :

      <?xml version="1.0" encoding="UTF-8"?>

      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@138.132.95.83:1522:AT1</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>perseo</user-name>
      perseo

      <type-mapping>Oracle9i</type-mapping>

      </local-tx-datasource>



      Exception when running the client program :

      javax.naming.NameNotFoundException: OracleDS not bound


      I use Jboss 4.0.2 .

      Thanks for your help

      Roberto