2 Replies Latest reply on Apr 10, 2003 9:34 AM by krake

    EXCEPTION: Error in use of ManagedConnectionPool

    krake

      Hello,

      Using jboss 3.0.6 and Oracle 8..1.7.

      I have the datasource working and wrote a small .jsp page and watched the datasource work. I then implemented login authentication with the DatabaseServerLoginModule using the same datasource. This again works fine (only the right users can get in as listed in the DB).

      However, when I use the two together I get the following exception:

      EXCEPTION: Error in use of ManagedConnectionPool: matchManagedConnection failed with subject: null and ConnectionRequestInfo: org.jboss.resource.adapter.jdbc.local.LocalConnectionRequestInfo@552d3bec; - nested throwable: (javax.resource.ResourceException: Error in use of ManagedConnectionPool: matchManagedConnection failed with subject: null and ConnectionRequestInfo: org.jboss.resource.adapter.jdbc.local.LocalConnectionRequestInfo@552d3bec)

      The basic scenario is, user logs into my DB test .jsp page and the error shows up. If I wait a few minutes I can get the conneciton on the .jsp page to work. I have also had the login authentication fail with the same error when I've tried to open a new browser (and force a new authentication) after the test .jsp page has run successfully (not always consistent though).

      Any insite you can give to what might be going wrong would be helpful. I'm mainly wondering if the datasouce pooling is set up right, but it could be a race condition though I don't understand how.

      ----------------------------
      .jsp section:
      ----------------------------

      <%
      Context context = new InitialContext();
      DataSource dataSource = (DataSource) context.lookup("java:/MyDS");

      Connection c = null;
      ResultSet rs = null;
      try {
      c = dataSource.getConnection("xxxx","xxxx");
      if (c == null) {
      %> Connection is null <%
      }
      DatabaseMetaData dbmd = c.getMetaData();
      rs = dbmd.getTables(null,null,"%",null);
      ResultSetMetaData rsmd = rs.getMetaData();
      int columnCount = rsmd.getColumnCount();
      %>


      Table


      <%
      for (int i=1;i<=columnCount;i++) {
      %>
      <%= rsmd.getColumnLabel(i) %>
      <%
      }
      %>

      <%
      while (rs.next()) {
      %> <%
      for (int i=1;i<=columnCount;i++) {
      %><%= rs.getString(i) %><%
      }
      %> <%
      }
      %>

      <%
      }
      catch (Exception e) {
      %>EXCEPTION: <%= e.getMessage() %><%
      }
      finally {
      if (rs != null) {
      rs.close();
      }
      if (c != null) {
      if (!c.isClosed()) {
      c.close();
      }
      }
      c = null;
      }

      %>

      ----------------------------
      oracle-service.xml
      ----------------------------

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

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->



      <!-- ==================================================================== -->
      <!-- ConnectionManager setup for Oracle dbs -->
      <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
      <!-- Thanks to Steven Coy -->
      <!-- ==================================================================== -->




      <!-- Include a login module configuration named OracleDbRealm.
      Update your login-conf.xml, here is an example for a
      ConfiguredIdentityLoginModule:

      <application-policy name = "OracleDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal">yourprincipal</module-option>
      <module-option name = "userName">yourusername</module-option>
      <module-option name = "password">yourpassword</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MyDS</module-option>
      </login-module>

      </application-policy>

      NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
      module-option name = "managedConnectionFactoryName"
      must match the object name of the ConnectionManager you are configuring here.
      -->

      <!--uncomment out this line if you are using the OracleDbRealm above
      OracleDbRealm
      -->

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


      MyDS



      <config-property name="ConnectionURL"
      type="java.lang.String">jdbc:oracle:thin:@localhost:1521:TRANSWEB</config-property>
      <!--
      <config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:oci8:@TRANSWEB</config-property>
      -->
      <config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
      <config-property name="UserName" type="java.lang.String">xxxx</config-property>
      <config-property name="Password" type="java.lang.String">xxxx</config-property>




      <!--Below here are advanced properties -->
      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper



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


      0
      50
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByNothing



      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

      java:/TransactionManager

      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer