7 Replies Latest reply on Jul 10, 2012 9:36 PM by NEFTALY GARCIA

    ClassLoader isolation and a JNDI Datasource

    Darko Hojnik Newbie


      Hi there,

       

      I'm still trying to teach me how to use ClassLoader isolation on Jboss 5.1. I'm a beginner with JAVA and also with Jboss.

      I've got an isolated EAR and six isolated WAR's inside. Could it be the reason why I couldn't get access to JNDI Datasource from the isolated Webapps? The Datasource self is working.

       

      Caused by: org.jboss.util.NestedSQLException: Unable to get managed connection for JetspeedDS; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for JetspeedDS)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
      at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
      at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:210)
      at $Proxy357.getAutoCommit(Unknown Source)
      at org.apache.jetspeed.components.rdbms.ojb.ConnectionManagerImpl.getConnection(ConnectionManagerImpl.java:222)
      ... 69 more
      Caused by: javax.resource.ResourceException: Unable to get managed connection for JetspeedDS
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:441)
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
      at org.jboss.resource.connectionmanager.BaseC
      15:53:29,402 ERROR [STDERR] onnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
      ... 73 more
      Caused by: javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] )
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:305)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
      ... 77 more

       

       

       

      jboss-web.xml of one of my WAR's
      <jboss-web>
        <security-domain flushOnSessionInvalidation="true">java:/jaas/Jetspeed</security-domain>
        <resource-ref>
          <res-ref-name>jdbc/jetspeed</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <jndi-name>java:/JetspeedDS</jndi-name>
        </resource-ref>
      </jboss-web>

       

       

      jboss-classloading.xml of my EAR

       

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

      <classloading xmlns="urn:jboss:classloading:1.0"

      name="jetspeed-enterprise-full-2.2.1.ear"

      domain="jetspeed-enterprise-full-2.2.1.ear"

      parent-domain="DefaultDomain"

      export-all="NON_EMPTY"

      import-all="false">

      </classloading>

       

       

      jboss-classloading.xml one of my WAR's


      <?xml version="1.0" encoding="UTF-8"?>
      <classloading xmlns="urn:jboss:classloading:1.0"
      name="jetspeed-demo-2.2.1.war"
      domain="jetspeed-demo-2.2.1.war"
      parent-domain="jetspeed-enterprise-full-2.2.1.ear"  
      export-all="NON_EMPTY"   
      import-all="true">   
      </classloading>

       

        • 1. Re: ClassLoader isolation and a JNDI Datasource
          Ales Justin Master

          I don't see what classloading has to do here?

          • 2. Re: ClassLoader isolation and a JNDI Datasource
            Darko Hojnik Newbie

            I don't know, thats why I'm asking. Without jboss-classloading.xml JNDI works with the Webapps. But I've to change and remove some JAR's inside. I don't like and accept that.

            • 3. Re: ClassLoader isolation and a JNDI Datasource
              Ales Justin Master

              Could be that the real exception / error is hidden.

              Try debuging or more fine-grained logging.

              e.g. why exactly is the connection not available

              • 4. Re: ClassLoader isolation and a JNDI Datasource
                jaikiran pai Master

                Caused by: javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] )

                What does your -ds.xml look like?

                • 5. Re: ClassLoader isolation and a JNDI Datasource
                  Darko Hojnik Newbie

                  Hello jaikiran,

                   

                  Here is my Datasource. They is working.

                   

                  <datasources>

                      <local-tx-datasource>

                          <jndi-name>JetspeedDS</jndi-name>

                          <rar-name>jboss-local-jdbc.rar</rar-name>

                          <use-java-context>true</use-java-context>

                          <connection-definition>javax.sql.DataSource</connection-definition>

                          <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>

                          <min-pool-size>0</min-pool-size>

                          <max-pool-size>10</max-pool-size>

                          <blocking-timeout-millis>30000</blocking-timeout-millis>

                          <idle-timeout-minutes>30</idle-timeout-minutes>

                          <prefill>false</prefill>

                          <background-validation>false</background-validation>

                          <background-validation-millis>0</background-validation-millis>

                          <validate-on-match>true</validate-on-match>

                          <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>

                          <isSameRM-override-value>false</isSameRM-override-value>

                          <allocation-retry>0</allocation-retry>

                          <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

                          <security-domain xsi:type="securityMetaData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

                          <metadata/>

                          <local-transaction/>

                          <user-name>test</user-name>

                          <password>test</password>

                          <prepared-statement-cache-size>0</prepared-statement-cache-size>

                          <share-prepared-statements>false</share-prepared-statements>

                          <set-tx-query-timeout>false</set-tx-query-timeout>

                          <query-timeout>0</query-timeout>

                          <use-try-lock>0</use-try-lock>

                          <driver-class>org.postgresql.Driver</driver-class>

                          <connection-url>jdbc:postgresql://192.168.0.60:5432/jetspeed</connection-url>

                      </local-tx-datasource>

                  </datasources>

                  • 6. Re: ClassLoader isolation and a JNDI Datasource
                    Gaspare P. Newbie

                    Hi,

                     

                    I have the same problem.

                     

                     

                    Here is my datasource configuration:

                     

                    <datasources>

                     

                      <no-tx-datasource>

                        <jndi-name>MyConnectionDS</jndi-name>

                        <use-java-context>true</use-java-context>

                        <connection-url>jdbc:oracle:thin:@myhost:1521:XE</connection-url>

                        <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

                        <user-name>myUsername</user-name>

                        <password>myPassword</password>

                       

                        <!--pooling parameters-->

                        <min-pool-size>5</min-pool-size>

                        <max-pool-size>40</max-pool-size>

                        <prepared-statement-cache-size>20</prepared-statement-cache-size>

                        <blocking-timeout-millis>5000</blocking-timeout-millis>

                        <new-connection-sql>call dbms_application_info.set_module('xxxx', null)</new-connection-sql>

                        <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>

                     

                        <!-- Checks the Oracle error codes and messages for fatal errors -->

                        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

                      </no-tx-datasource>

                     

                    </datasources>

                     

                    Any idea about this problem?

                     

                    Thanks

                    • 7. Re: ClassLoader isolation and a JNDI Datasource
                      NEFTALY GARCIA Newbie

                      Could you solve the problem? I have the same issue...