1 Reply Latest reply on Jun 7, 2003 12:10 PM by Jon Barnett

    WrapperDataSource problem

    aamstutz Newbie

      Hi,

      While setting up 2 data sources in jboss 3.2.1 in run into some confusing
      problems.
      The 1. DS is set up for jaas and works WHITOUT any problems!
      The 2. DS gives me serious headache.
      See my conclusion on this further down this mail!

      Before I switched to JBoss I did all the DS setup with Struts which worked
      just fine.
      Now I want to move business logic to SLSB's using the DAO-design-pattern.

      JBoss-3.2.1
      PostgreSQL 7.3.x

      so I set up this DS:
      $JBOSS_HOME/server/default/deploy/postgres-ds.xml

      ....
      <local-tx-datasource>
      <jndi-name>JCampDS</jndi-name>
      <connection-url>jdbc:postgresql://192.168.1.40/javabootcamp</connection-url>
      <driver-class>org.postgresql.jdbc3.Jdbc3PoolingDataSource</driver-class>
      <user-name>myuser</user-name>
      mypassword
      <min-pool-size>2</min-pool-size>
      <max-pool-size>50</max-pool-size>
      <blocking-timeout-millis>5000</blocking-timeout-millis>
      </local-tx-datasource>


      Doing a grep on the log file tells me there is a WrapperDataSource to control
      the DS:

      [admins:~] andreas% grep "JCampDS" $JBOSS_HOME/server/default/log/server.log
      ... excerpt
      11:39:05,139 INFO [TxConnectionManager] Starting
      11:39:05,156 DEBUG [JCampDS] Binding object 'org.jboss.resource.adapter.jdbc.WrapperDataSource@fa129b'
      into JNDI at 'java:/JCampDS'
      11:39:05,157 INFO [JCampDS] Bound connection factory for resource adapter
      for ConnectionManager 'jboss.jca:service=LocalTxCM,name=JCampDS to JNDI
      name 'java:/JCampDS'
      11:39:05,158 INFO [TxConnectionManager] Started
      ... the full grep outputs is at the end of this mail.

      The DAO looks it up like this: ctx.lookup("java:comp/env/jdbc/JCampDS");

      After deploying the app.ear in jboss I do some junit testing, whis gives
      the following output:

      11:46:34,101 INFO [STDOUT] *** In ScheduleEJB - null constructor
      11:46:34,104 INFO [STDOUT] In ScheduleEJB - setSessionContext(ctx)
      11:46:34,107 INFO [STDOUT] *** In ScheduleEJB - ejbCreate()
      11:46:34,110 INFO [STDOUT] *** In ScheduleEJB -- searchByCourseTitle
      11:46:34,126 INFO [STDOUT] ScheduleDAO jcampDataSource lookup OK!
      11:46:34,132 INFO [STDOUT] --- ScheduleDAO - searchByCourseTitle
      11:46:34,157 INFO [STDOUT] --- queryString = SELECT sid, courseid, locationid,
      city, state, country, startdate, enddate, status, title, instructorID,
      price, maxenrollment, currentenrollment FROM ScheduleEJBTable s, CourseEJBTable
      c, LocationEJBTable l where courseid = c.id AND locationid = l.id AND
      title LIKE ?



      At this point an Exception is thrown, which tells me that the sql query
      I defined has been MODIFIED to be loking for table names in UPPERCASE.
      That is pretty CONFUSING to me.

      ... excerpt
      [junit] Testcase: testJDBCConnection took 0.542 sec
      [junit] Testcase: testSearchByCourseTitle took 2.047 sec
      [junit] Caused an ERROR
      [junit] SearchByCourseTitle exception = Query exception Table not found:
      SCHEDULEEJBTABLE in statement [SELECT sid, courseid, locationid, city, state,
      country, startdate, enddate, status, title, instructorID, price, maxenrollment,
      currentenrollment FROM ScheduleEJBTable s, CourseEJBTable c, LocationEJBTable
      l where courseid = c.id AND locationid = l.id AND title LIKE '%Java%']


      Executing this query directly on the db works and results in:

      javabootcamp=> SELECT sid, courseid, locationid, city, state, country, startdate,
      enddate, status, title, instructorID, price, maxenrollment, currentenrollment
      FROM ScheduleEJBTable s, CourseEJBTable c, LocationEJBTable l where courseid
      = c.id AND locationid = l.id AND title LIKE '%Java%';
      sid | courseid | locationid | city | state | country |
      startdate | enddate | status | title
      | instructorid | price | maxenrollment | currentenrollment
      ------------+----------+------------+---------------+-------+---------+------------+------------+-----------+-------------------------------------------+--------------+---------+---------------+-------------------
      2001081501 | JAVA-100 | CA-SF-001 | Mountain View | CA | USA |
      2002-08-13 | 2002-08-17 | OPEN | Introduction to Java Programming
      | Joe Davis | 2000.00 | 14 | 2
      2001092403 | JAVA-300 | CA-SF-200 | Milpitas | CA | USA |
      2002-09-24 | 2002-09-28 | OPEN | Advanced Java Programming
      | Joe Davis | 2500.00 | 14 | 0
      2001092402 | EJB-200 | CA-SF-200 | Milpitas | CA | USA |
      2002-03-24 | 2002-03-28 | FULL | Introduction to Enterprise JavaBeans(EJB)
      | Joe Davis | 2500.00 | 14 | 0
      2001092401 | EJB-300 | CA-SF-200 | Milpitas | CA | USA |
      2002-05-24 | 2002-05-28 | CANCELLED | Advanced Enterprise JavaBeans(EJB)
      | Joe Davis | 2500.00 | 14 | 0
      2001092400 | JAVA-300 | CA-SF-200 | Milpitas | CA | USA |
      2002-09-24 | 2002-09-28 | CANCELLED | Advanced Java Programming
      | Joe Davis | 2500.00 | 14 | 0
      2001082009 | WEB-200 | CA-LA-200 | Hollywood | CA | USA |
      2002-08-20 | 2002-08-24 | OPEN | Introduction to Java Server Pages
      | Sue Smith | 1400.00 | 14 | 0
      2001082004 | WEB-200 | CA-LA-200 | Hollywood | CA | USA |
      2002-08-20 | 2002-08-24 | OPEN | Introduction to Java Server Pages
      | Sue Smith | 1400.00 | 14 | 0
      (7 rows)

      ################################################################

      Accessing the DB via a DS from outside Jboss works just fine.

      ################################################################

      ... excerpt from junit test suite
      public void testPooledDataSource() throws Exception {
      assertNotNull("Expected a Datasource beeing returned.", getDataSource("A
      Data Source"));
      javax.sql.DataSource ds = getDataSource("MyDS");
      Connection conn = ds.getConnection();
      String queryString = "SELECT sid, courseid, locationid, city, state, country,
      startdate, enddate, status, title, instructorID, price, maxenrollment,
      currentenrollment " +
      "FROM ScheduleEJBTable s, CourseEJBTable c, LocationEJBTable l where
      courseid = c.id AND locationid = l.id AND title LIKE ?";
      PreparedStatement prepStmt = conn.prepareStatement(queryString);
      prepStmt.setString( 1, "%Java%" );
      ResultSet rset = prepStmt.executeQuery();
      while(rset.next()) {
      ScheduleVO schedule = new ScheduleVO(
      rset.getString("sid"), rset.getString("courseid"), rset.getString("locationid"),
      rset.getString("city"), rset.getString("state"), rset.getString("country"),
      rset.getDate("startdate"), rset.getDate("enddate"),
      rset.getString("status"),rset.getString("title"),
      rset.getFloat("price"), rset.getInt("maxenrollment"), rset.getInt("currentenrollment")
      );
      System.out.println(" --- ScheduleDAO - created schedule item, before
      adding to a vector");
      }

      rset.close();
      prepStmt.close();
      conn.close();
      }

      public javax.sql.DataSource getDataSource(String name) throws Exception
      {
      Jdbc3PoolingDataSource source = new org.postgresql.jdbc3.Jdbc3PoolingDataSource();
      source.setDataSourceName(name);
      source.setServerName("192.168.1.40");
      source.setDatabaseName("javabootcamp");
      source.setUser("postgres");
      source.setPassword("");
      source.setMaxConnections(10);
      return source;
      }


      ########### conclusion ###################################

      So I think there must be something wrong on the jboss side.
      Or is there some DS configuration thing which I've overlooked?

      Please help me with that one.


      ########################################################





      [admins:~] andreas% grep "JCampDS" $JBOSS_HOME/server/default/log/server.log
      <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager"
      display-name="ConnectionManager for DataSource JCampDS" name="jboss.jca:service=LocalTxCM,name=JCampDS">true
      <depends optional-attribute-name="ManagedConnectionPool"><mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"
      display-name="Connection Pool for DataSource JCampDS" name="jboss.jca:service=ManagedConnectionPool,name=JCampDS"><depends
      optional-attribute-name="ManagedConnectionFactoryName"><mbean code="org.jboss.resource.connectionmanager.RARDeployment"
      display-name="ManagedConnectionFactory for DataSource JCampDS" name="jboss.jca:service=ManagedConnectionFactory,name=JCampDS"><depends
      optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss
      LocalTransaction JDBC Wrapper
      JCampDS
      2003-06-07 11:38:57,540 DEBUG [org.jboss.system.ServiceCreator] About to
      create bean: jboss.jca:service=LocalTxCM,name=JCampDS with code: org.jboss.resource.connectionmanager.TxConnectionManager
      2003-06-07 11:38:57,577 DEBUG [org.jboss.system.ServiceCreator] Created
      bean: jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:57,581 DEBUG [org.jboss.system.ServiceConfigurator] TrackConnectionByTx
      set to true in jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:57,583 DEBUG [org.jboss.system.ServiceConfigurator] LocalTransactions
      set to true in jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:57,585 DEBUG [org.jboss.system.ServiceCreator] About to
      create bean: jboss.jca:service=ManagedConnectionPool,name=JCampDS with code:
      org.jboss.resource.connectionmanager.JBossManagedConnectionPool
      2003-06-07 11:38:57,590 DEBUG [org.jboss.system.ServiceCreator] Created
      bean: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,845 DEBUG [org.jboss.system.ServiceCreator] About to
      create bean: jboss.jca:service=ManagedConnectionFactory,name=JCampDS with
      code: org.jboss.resource.connectionmanager.RARDeployment
      2003-06-07 11:38:57,850 DEBUG [org.jboss.system.ServiceCreator] Created
      bean: jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:57,851 DEBUG [org.jboss.system.ServiceController] recording
      that jboss.jca:service=ManagedConnectionFactory,name=JCampDS depends on
      jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper
      2003-06-07 11:38:57,856 DEBUG [org.jboss.system.ServiceConfigurator] ManagedConnectionFactoryProperties
      set to [properties: null] in jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:57,857 DEBUG [org.jboss.system.ServiceController] recording
      that jboss.jca:service=ManagedConnectionPool,name=JCampDS depends on jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:57,858 DEBUG [org.jboss.system.ServiceConfigurator] considering
      ManagedConnectionFactoryName with object name jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:57,859 DEBUG [org.jboss.system.ServiceConfigurator] MinSize
      set to 2 in jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,862 DEBUG [org.jboss.system.ServiceConfigurator] MaxSize
      set to 50 in jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,863 DEBUG [org.jboss.system.ServiceConfigurator] BlockingTimeoutMillis
      set to 5000 in jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,864 DEBUG [org.jboss.system.ServiceConfigurator] IdleTimeoutMinutes
      set to 15 in jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,868 DEBUG [org.jboss.system.ServiceConfigurator] Criteria
      set to ByNothing in jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,869 DEBUG [org.jboss.system.ServiceController] recording
      that jboss.jca:service=LocalTxCM,name=JCampDS depends on jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,870 DEBUG [org.jboss.system.ServiceConfigurator] considering
      ManagedConnectionPool with object name jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,878 DEBUG [org.jboss.system.ServiceConfigurator] JndiName
      set to JCampDS in jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:57,880 DEBUG [org.jboss.system.ServiceController] recording
      that jboss.jca:service=LocalTxCM,name=JCampDS depends on jboss.jca:service=CachedConnectionManager
      2003-06-07 11:38:57,881 DEBUG [org.jboss.system.ServiceController] recording
      that jboss.jca:service=LocalTxCM,name=JCampDS depends on jboss:service=TransactionManager
      2003-06-07 11:38:57,910 DEBUG [org.jboss.system.ServiceController] Creating
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:57,911 DEBUG [org.jboss.system.ServiceController] waiting
      in create of jboss.jca:service=LocalTxCM,name=JCampDS waiting on jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,911 DEBUG [org.jboss.system.ServiceController] Creating
      service jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:57,912 DEBUG [org.jboss.system.ServiceController] waiting
      in create of jboss.jca:service=ManagedConnectionPool,name=JCampDS waiting
      on jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:57,912 DEBUG [org.jboss.system.ServiceController] Creating
      service jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:58,015 DEBUG [org.jboss.management.j2ee.LocalJBossServerDomain]
      handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=
      org.jboss.system.ServiceMBean.create,sequenceNumber=33,timeStamp=1054978738014,message=null,userData=jboss.jca:service=ManagedConnectionFactory,name=JCampDS]
      2003-06-07 11:38:58,015 DEBUG [org.jboss.management.j2ee.factory.DefaultManagedObjectFactoryMap]
      Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=
      org.jboss.system.ServiceMBean.create,sequenceNumber=33,timeStamp=1054978738014,message=null,userData=jboss.jca:service=ManagedConnectionFactory,name=JCampDS]
      2003-06-07 11:38:58,016 DEBUG [org.jboss.system.ServiceController] Creating
      dependent components for: jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      dependents are: [ObjectName: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      Depends On Me: jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:58,017 DEBUG [org.jboss.system.ServiceController] Creating
      service jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:58,234 DEBUG [org.jboss.management.j2ee.LocalJBossServerDomain]
      handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=
      org.jboss.system.ServiceMBean.create,sequenceNumber=34,timeStamp=1054978738234,message=null,userData=jboss.jca:service=ManagedConnectionPool,name=JCampDS]
      2003-06-07 11:38:58,235 DEBUG [org.jboss.management.j2ee.factory.DefaultManagedObjectFactoryMap]
      Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=
      org.jboss.system.ServiceMBean.create,sequenceNumber=34,timeStamp=1054978738234,message=null,userData=jboss.jca:service=ManagedConnectionPool,name=JCampDS]
      2003-06-07 11:38:58,235 DEBUG [org.jboss.system.ServiceController] Creating
      dependent components for: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      dependents are: [ObjectName: jboss.jca:service=LocalTxCM,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:58,241 DEBUG [org.jboss.system.ServiceController] Creating
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:58,242 DEBUG [org.jboss.system.ServiceController] waiting
      in create of jboss.jca:service=LocalTxCM,name=JCampDS waiting on jboss.jca:service=CachedConnectionManager
      jboss.jca:service=LocalTxCM,name=JCampDS state: Stopped
      jboss.jca:service=ManagedConnectionPool,name=JCampDS state: Created
      jboss.jca:service=ManagedConnectionFactory,name=JCampDS state: Created
      2003-06-07 11:38:58,355 DEBUG [org.jboss.system.ServiceController] starting
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:58,395 DEBUG [org.jboss.system.ServiceController] waiting
      in start jboss.jca:service=LocalTxCM,name=JCampDS on jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:58,545 DEBUG [org.jboss.system.ServiceController] starting
      service jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:58,549 DEBUG [org.jboss.system.ServiceController] waiting
      in start jboss.jca:service=ManagedConnectionPool,name=JCampDS on jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:58,549 DEBUG [org.jboss.system.ServiceController] starting
      service jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      2003-06-07 11:38:58,574 DEBUG [org.jboss.system.ServiceController] Starting
      dependent components for: jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      dependent components: [ObjectName: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionFactory,name=JCampDS
      Depends On Me: jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:58,578 DEBUG [org.jboss.system.ServiceController] starting
      service jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:58,580 DEBUG [org.jboss.system.ServiceController] Starting
      dependent components for: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      dependent components: [ObjectName: jboss.jca:service=LocalTxCM,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:38:58,581 DEBUG [org.jboss.system.ServiceController] starting
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:38:58,581 DEBUG [org.jboss.system.ServiceController] waiting
      in start jboss.jca:service=LocalTxCM,name=JCampDS on jboss.jca:service=CachedConnectionManager
      jboss.jca:service=LocalTxCM,name=JCampDS state: Stopped
      jboss.jca:service=ManagedConnectionPool,name=JCampDS state: Started
      jboss.jca:service=ManagedConnectionFactory,name=JCampDS state: Started
      2003-06-07 11:38:58,608 DEBUG [org.jboss.management.j2ee.JCAResource] Created
      JSR-77 JCAResource: JCampDS
      2003-06-07 11:38:58,611 DEBUG [org.jboss.management.j2ee.JCAConnectionFactory]
      postRegister(), parent: jboss.management.local:J2EEServer=JBoss LocalTransaction
      JDBC Wrapper,j2eeType=JCAResource,name=JCampDS
      2003-06-07 11:38:58,612 DEBUG [org.jboss.management.j2ee.JCAConnectionFactory]
      Created JSR-77 JCAConnectionFactory: JCampDS
      2003-06-07 11:38:58,614 DEBUG [org.jboss.management.j2ee.JCAManagedConnectionFactory]
      postRegister(), parent: jboss.management.local:J2EEServer=JBoss LocalTransaction
      JDBC Wrapper,JCAResource=JCampDS,j2eeType=JCAConnectionFactory,name=JCampDS
      jboss.jca:service=LocalTxCM,name=JCampDS
      Depends On Me: , ObjectName: jboss.jca:service=LocalTxCM,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:39:03,293 DEBUG [org.jboss.system.ServiceController] Creating
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:39:03,295 DEBUG [org.jboss.system.ServiceController] waiting
      in create of jboss.jca:service=LocalTxCM,name=JCampDS waiting on jboss.jca:service=CachedConnectionManager
      Depends On Me: , ObjectName: jboss.jca:service=LocalTxCM,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:39:03,382 DEBUG [org.jboss.system.ServiceController] Creating
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:39:03,388 DEBUG [org.jboss.management.j2ee.LocalJBossServerDomain]
      handleNotification: javax.management.Notification[source=jboss.system:service=ServiceController,type=
      org.jboss.system.ServiceMBean.create,sequenceNumber=51,timeStamp=1054978743388,message=null,userData=jboss.jca:service=LocalTxCM,name=JCampDS]
      2003-06-07 11:39:03,390 DEBUG [org.jboss.management.j2ee.factory.DefaultManagedObjectFactoryMap]
      Failed to find factory for event: javax.management.Notification[source=jboss.system:service=ServiceController,type=
      org.jboss.system.ServiceMBean.create,sequenceNumber=51,timeStamp=1054978743388,message=null,userData=jboss.jca:service=LocalTxCM,name=JCampDS]
      2003-06-07 11:39:03,392 DEBUG [org.jboss.system.ServiceController] Creating
      dependent components for: jboss.jca:service=LocalTxCM,name=JCampDS dependents
      are: []
      jboss.jca:service=LocalTxCM,name=JCampDS
      Depends On Me: , ObjectName: jboss.jca:service=LocalTxCM,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:39:03,962 DEBUG [org.jboss.system.ServiceController] starting
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:39:03,964 DEBUG [org.jboss.system.ServiceController] waiting
      in start jboss.jca:service=LocalTxCM,name=JCampDS on jboss.jca:service=CachedConnectionManager
      Depends On Me: , ObjectName: jboss.jca:service=LocalTxCM,name=JCampDS
      I Depend On: jboss.jca:service=ManagedConnectionPool,name=JCampDS
      2003-06-07 11:39:05,138 DEBUG [org.jboss.system.ServiceController] starting
      service jboss.jca:service=LocalTxCM,name=JCampDS
      2003-06-07 11:39:05,156 DEBUG [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.JCampDS]
      Binding object 'org.jboss.resource.adapter.jdbc.WrapperDataSource@fa129b'
      into JNDI at 'java:/JCampDS'
      2003-06-07 11:39:05,157 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.JCampDS]
      Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=JCampDS
      to JNDI name 'java:/JCampDS'
      2003-06-07 11:39:05,173 DEBUG [org.jboss.system.ServiceController] Starting
      dependent components for: jboss.jca:service=LocalTxCM,name=JCampDS dependent
      components: []
      2003-06-07 11:39:38,801 DEBUG [org.jboss.ejb.StatelessSessionContainer]
      Binding resource manager: java:/DefaultDS to JDNI ENC as: jdbc/JCampDS
      [admins:~] andreas%


        • 1. Re: WrapperDataSource problem
          Jon Barnett Master

          It's not real clear about your connection code with the information you have posted. However, the exception seems to be thrown by the database rather than any connection issue.

          I'm not quite sure which version of Postgresql you are using, but 7.3.2 works fine with JBoss using the standard Postgresql JDBC driver. JBoss provides the DataSource implementation around the Postgresql JDBC driver, hence you get a wrapped connection around the standard Connection object provided by the JDBC driver. Typically, the datasource would look something like this:

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

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

          <!-- $Id: postgres-ds.xml,v 1.1 2002/07/22 22:57:24 d_jencks Exp $ -->
          <!-- ==================================================================== -->
          <!-- Datasource config for Postgres -->
          <!-- ==================================================================== -->



          <local-tx-datasource>
          <jndi-name>CorpDataSource</jndi-name>
          <connection-url>jdbc:postgresql://myserver:5432/ecperf</connection-url>
          <driver-class>org.postgresql.Driver</driver-class>
          <user-name>x</user-name>
          y
          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
          </local-tx-datasource>


          Note the driver class declaration.

          So within a stateless session bean, you might get a datasource in this manner:

          try
          {
          Context naming = new InitialContext();
          dataSource = (DataSource)naming.lookup("java:/JCampDS");
          }
          catch(Exception e)
          {
          System.out.println(error + e.toString());
          }

          if (dataSource != null)
          connection = dataSource.getConnection();

          I'm not sure what the effect of wrapping a datasource with JBoss's DataSource implementation is going to do, but it may cause the problems you are seeing.

          If you wanted to use the Postgresql DataSource implementation, I suspect you would have to build an MBean to implement and bind it to the JNDI yourself.

          Hope this helps.