8 Replies Latest reply on Apr 1, 2002 7:44 PM by hleblanc

    Problem creating Oracle connection Pool

    anjan_123

      Hi

      I am unable to create a connection pool for oracle. I have modified the jboss.jcml file for oracle but it is giving NullPointerException. Would be of great help if someone may give me some suggestion.I have checked the entire forum...

      Following is the jboss.jcml file :

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- This is where you can add and configure your MBeans
      ATTENTION: The order of the listing here is the same order as
      the MBeans are loaded. Therefore if a MBean depends on another
      MBean to be loaded and started it has to be listed after all
      the MBeans it depends on.
      -->


      <!-- ==================================================================== -->
      <!-- Classloading -->
      <!-- ==================================================================== -->

      8083


      <!-- ==================================================================== -->
      <!-- JNDI -->
      <!-- ==================================================================== -->

      1099




      <!-- ==================================================================== -->
      <!-- Transactions -->
      <!-- ==================================================================== -->

      300

      <!-- Use this attribute if you need to use a specific Xid
      implementation
      oracle.jdbc.xa.OracleXid
      -->


      <!-- Uncomment to use Tyrex (tyrex.exolab.org) transaction manager plugin
      instead of the org.jboss.tm.TransactionManagerService and comment out
      the TransactionManagerService above

      ../conf/default/domain.xml

      -->





      <!-- ==================================================================== -->
      <!-- Security -->
      <!-- ==================================================================== -->

      <!-- Uncomment to enable the sample SRPVerifierStore service

      SRPDefaultVerifierSource
      SRPVerifierStore.ser

      -->
      <!-- Uncomment to enable the SRP login service

      SRPServerInterface
      SRPDefaultVerifierSource
      SRPAuthenticationCache
      10099

      -->

      <!-- JAAS security manager and realm mapping -->

      org.jboss.security.plugins.JaasSecurityManager


      <!-- Uncomment to enable the XML implementation of the JAAS policy

      DefaultSecurityPolicy
      sample_policy.xml

      -->

      <!-- ==================================================================== -->
      <!-- JDBC -->
      <!-- ==================================================================== -->


      oracle.jdbc.driver.OracleDriver



      DefaultDS
      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
      jdbc:oracle:thin:@girish:1521:ulysses
      system
      manager



      <!-- ==================================================================== -->
      <!-- JBoss Server Management -->
      <!-- ==================================================================== -->

      5000


      <!-- ==================================================================== -->
      <!-- J2EE deployment -->
      <!-- ==================================================================== -->


      true
      false
      false
      true
      false


      <!-- Uncomment to add embedded tomcat service

      -->

      <!-- Uncomment and set file URL to add Jetty service (you can set config more than once)

      file URL to jetty.xml e.g. file:/usr/local/jboss/dist/conf/default/jetty.xml

      -->


      <!-- ==================================================================== -->
      <!-- JBossMQ -->
      <!-- ==================================================================== -->


      <!-- The StateManager is used to keep JMS perisitent state data. -->
      <!-- For example: what durable subscriptions are active. -->

      jbossmq-state.xml


      <!-- The PersistenceManager is used to store messages to disk. -->

      ../../db/jbossmq/


      <!-- InvocationLayers are the different transport methods that can be used to access the server -->

      java:/ConnectionFactory
      java:/XAConnectionFactory



      RMIConnectionFactory
      RMIXAConnectionFactory



      ConnectionFactory
      XAConnectionFactory



      UILConnectionFactory
      UILXAConnectionFactory


      <!-- The following three line create 3 topics named: testTopic, example, and bob -->




      <!-- The following 9 line create 9 topics named: testQueue, controlQueue, A, B, -->
      <!-- C, D, E, F, and ex -->










      <!-- Used for backwards compatability with JBossMQ versions before 1.0.0 -->

      ConnectionFactory
      QueueConnectionFactory


      ConnectionFactory
      TopicConnectionFactory


      <!-- For Message Driven Beans -->

      DefaultJMSProvider
      org.jboss.jms.jndi.JBossMQProvider
      java:/XAConnectionFactory
      java:/XAConnectionFactory


      StdJMSPool
      org.jboss.jms.asf.StdServerSessionPoolFactory



      <!-- Make sure you change EmbeddedTomcat to Jetty if you are using Jetty -->

      Default
      :service=ContainerFactory
      :service=EmbeddedTomcat


      <!-- Uncomment this and disable previous J2eeDeployer entry to enable an alternative "scoped" deployment

      Default
      :service=ContainerFactory
      :service=EmbeddedTomcat

      -->

      <!-- ==================================================================== -->
      <!-- JBossCX setup, for J2EE connector architecture support -->
      <!-- ==================================================================== -->




      <!-- Minerva no transaction connection manager factory.

      Use this for resource adapters that don't support
      transactions. -->

      MinervaNoTransCMFactory

      org.jboss.pool.connector.jboss.MinervaNoTransCMFactory




      <!-- Minerva local transaction connection manager factory.

      Use this for resource adapters that support "local"
      transactions. -->

      MinervaSharedLocalCMFactory

      org.jboss.pool.connector.jboss.MinervaSharedLocalCMFactory




      <!-- Minerva XA transaction connection manager factory

      Use this for resource adapters that support "xa"
      transactions. -->

      MinervaXACMFactory

      org.jboss.pool.connector.jboss.MinervaXACMFactory




      <!-- Connection factory for the Minerva JDBC resource adapter. This
      points at the same database as DefaultDS. -->

      MinervaDS
      JCA:service=RARDeployer

      Minerva JDBC LocalTransaction ResourceAdapter


      ConnectionURL=jdbc:HypersonicSQL:hsql://localhost:1476



      MinervaSharedLocalCMFactory

      <!-- See the documentation for the specific connection manager
      implementation you are using for the properties you can set -->

      # Pool type - uncomment to force, otherwise it is the default
      #PoolConfiguration=per-factory

      # Connection pooling properties - see
      # org.jboss.pool.PoolParameters
      MinSize=0
      MaxSize=10
      Blocking=true
      GCEnabled=false
      IdleTimeoutEnabled=false
      InvalidateOnError=false
      TrackLastUsed=false
      GCIntervalMillis=120000
      GCMinIdleMillis=1200000
      IdleTimeoutMillis=1800000
      MaxIdleTimeoutPercent=1.0


      <!-- Principal mapping configuration -->

      org.jboss.resource.security.ManyToOnePrincipalMapping


      userName=sa
      password=



      <!-- This is an example of using a resource adapter that supports XA
      transactions. The Minerva XA resource adapter requires an
      XADataSource to be in JNDI somewhere. JBoss doesn't include a
      database with an XA-compliant JDBC driver, so this will need to
      be configured to use whatever XADataSource implementation you
      have.


      MinervaXADS

      Put your XADataSource implementation class here





      XAMinervaDS
      JCA:service=RARDeployer

      Minerva JDBA XA Resource Adapter


      XADataSourceName=java:/MinervaXADS



      MinervaXACMFactory


      # Pool type - uncomment to force, otherwise it is the default
      #PoolConfiguration=per-factory

      # Connection pooling properties - see
      # org.jboss.pool.PoolParameters
      MinSize=0
      MaxSize=10
      Blocking=true
      GCEnabled=false
      IdleTimeoutEnabled=false
      InvalidateOnError=false
      TrackLastUsed=false
      GCIntervalMillis=120000
      GCMinIdleMillis=1200000
      IdleTimeoutMillis=1800000
      MaxIdleTimeoutPercent=1.0



      org.jboss.resource.security.ManyToOnePrincipalMapping


      userName=sa
      password=


      -->

      <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->

      JmsXA
      JCA:service=RARDeployer
      JMS Adapter
      MinervaXACMFactory
      <!-- See the documentation for the specific connection manager
      implementation you are using for the properties you can set -->

      # Pool type - uncomment to force, otherwise it is the default
      #PoolConfiguration=per-factory

      # Connection pooling properties - see
      # org.jboss.pool.PoolParameters
      MinSize=0
      MaxSize=10
      Blocking=true
      GCEnabled=false
      IdleTimeoutEnabled=false
      InvalidateOnError=false
      TrackLastUsed=false
      GCIntervalMillis=120000
      GCMinIdleMillis=1200000
      IdleTimeoutMillis=1800000
      MaxIdleTimeoutPercent=1.0


      <!-- Principal mapping configuration -->
      org.jboss.resource.security.ManyToOnePrincipalMapping




      <!-- ==================================================================== -->
      <!-- Auto deployment -->
      <!-- ==================================================================== -->


      J2EE:service=J2eeDeployer;
      JCA:service=RARDeployer

      ../deploy,../deploy/lib


      <!-- ==================================================================== -->
      <!-- JMX adaptors -->
      <!-- ==================================================================== -->






      10

      8082


      <!-- ==================================================================== -->
      <!-- Mail Connection Factory -->
      <!-- ==================================================================== -->

      Mail
      mail.properties
      user_id
      password


      <!-- ==================================================================== -->
      <!-- Uncomment to enable JMX monitoring of the bean cache

      -->
      <!-- ==================================================================== -->

      <!-- ==================================================================== -->
      <!-- Scheduler Service -->
      <!-- ==================================================================== -->
      <!-- Uncomment this to enable Scheduling - ->











      <!- - -->

      <!-- ==================================================================== -->
      <!-- Add your custom MBeans here -->
      <!-- ==================================================================== -->


        • 1. Re: Problem creating Oracle connection Pool
          anjan_123

          Extremely sorry... a correction, the Poolname is OracleDB and not DefaultDS. Related changes have been made in standardjaws.xml (datasource name changed to java:/OracleDB and type_naming to Oracle8). The problem persists with all these corrections.

          • 2. Re: Problem creating Oracle connection Pool
            davidjencks

            You don't show us your error. One possible problem is that you have removed the hsql/hypersonic db and its driver but are still using them in the ConnectionFactoryLoader mbean MinervaDS.

            • 3. Re: Problem creating Oracle connection Pool
              anjan_123

              Hi davidjencks

              I will be more specific about the changes I have made and the error I am getting :

              Changes made :
              1) jboss.jcml -

              Oracle JDBC Driver is declared as shown below. Everything else in the file remains unchanged.


              oracle.jdbc.driver.OracleDriver,org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver



              OracleDB
              org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
              jdbc:oracle:thin:@girish:1521:ulysses
              system
              manager


              2. standardjaws.xml

              Following changes have been made. Everything else remains same.


              java:/OracleDB
              <type-mapping>Oracle8</type-mapping>
              false

              3. The oracle jdbc file (classes111.zip)has been copied to <jboss_home>\lib\ext.

              Now the error that I am getting is as below :

              [JdbcProvider] Starting
              [JdbcProvider] Started
              [XADataSourceLoader] Starting
              [OracleDB] XA Connection pool OracleDB bound to java:/OracleDB
              [XADataSourceLoader] Stopped
              java.lang.NullPointerException
              at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:178)
              at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:407)
              at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:107)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:836)
              at $Proxy0.start(Unknown Source)
              at org.jboss.util.ServiceControl.start(ServiceControl.java:81)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              at org.jboss.Main.(Main.java:210)
              at org.jboss.Main$1.run(Main.java:116)
              at java.security.AccessController.doPrivileged(Native Method)

              • 4. Re: Problem creating Oracle connection Pool
                davidjencks

                This usually means your driver can't connect to the db you have specified. One reason might be a problem with your url. I have recently found that another problem might be inaccessible native libraries needed by the driver. If Oracle is not running, that's another possibility. Can you connect using that exact url/username etc with a small standalone program? Does the oracle driver need any native libraries?

                • 5. Re: Problem creating Oracle connection Pool
                  anjan_123

                  I have found the problem, it was in the jboss.jcml file. I replaced the JDBC section with the example in documentation and then made the relevant changes. It worked. Thanks anyway.

                  • 6. Re: Problem creating Oracle connection Pool
                    thelukas

                    > I have found the problem, it was in the jboss.jcml
                    > file. I replaced the JDBC section with the example in
                    > documentation and then made the relevant changes. It
                    > worked. Thanks anyway.

                    Being faced with the same problem I am wondering what you actually changed to make it work?
                    Thanks in advance!

                    • 7. Re: Problem creating Oracle connection Pool
                      lionel

                      As am I. I get an error that the connection string I specified can't be bound. I know this works, because independent JUnit tests on my code works with Oracle.

                      • 8. Solution!
                        hleblanc

                        I found the problem on my server, and now that it's straightened out, it seems pretty simple. So don't lose hope!
                        First of all, beware of the multiple directories problem. We're running tomcat (aka catalina) with jboss, and the relevant configuration files are in .../jboss/conf/catalina, *not* in .../jboss/conf/default, as I thought for a while.
                        Second of all, in standardjaws.xml, make sure that it refers to your database, not to the DefaultDS. Here's my chunk, for the Oracle8 database called TestDB:
                        java:/TestDB
                        <type-mapping>Oracle8</type-mapping>
                        false
                        You'll see it right near the top, just search for DefaultDS if you don't see it.
                        In jboss.jcml, you need to tell it about the Oracle driver, then about your database. Here's how you tell it about the driver:

                        org.hsqldb.jdbcDriver,oracle.jdbc.driver.OracleDriver

                        ...and here's how you tell it about the database:

                        TestDB
                        org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
                        jdbc:oracle:thin:@localhost:1521:TestDB
                        DEKWEB
                        ThePassword


                        That's it, that's all it took. Would that the documentation were a little clearer on this point.
                        I hope this helps all you poor souls who are still flailing at this, as I have been for the past few days.
                        H