2 Replies Latest reply on Jan 6, 2003 11:26 PM by David Jencks

    Datasource installs, but isn't present in context (oracle8,

    Matthew Pekar Newbie

      I think I finally managed to get my Oracle 8 data source installed by modifying the oracle-ds.xml file and dropping it into the deploy directory. Here it is:


      <local-tx-datasource>
      <jndi-name>CCTADS</jndi-name>
      <connection-url>jdbc:oracle:thin:@servername:1521:ccta_test</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>ccta</user-name>
      ccta
      </local-tx-datasource>


      I have added classes12.zip to server/default/lib, and modified standardjaws.xml and standardjbosscmp-jdbc.xml to have the following:

      java:CCTADS
      <datasource-mapping>Oracle8</datasource-mapping>

      where CCTADS is the name I chose instead of OracleDS. In my web.xml file I reference the resource like this:

      <resource-ref>
      Database reference for CCTA application
      <res-ref-name>jdbc/CCTADS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      <env-entry>
      Name of resource reference for database
      <env-entry-name>jndi-datasource-name</env-entry-name>
      <env-entry-value>jdbc/CCTADS</env-entry-value>
      <env-entry-type>java.lang.String</env-entry-type>
      </env-entry>

      I run JBoss, and lines such as the following lead me to believe things are going OK:

      17:07:45,516 INFO [CCTADS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=CCTADS to JNDI name 'java:/CCTADS'

      Then in my action servlet class (for struts), I try and grab the data source, but I'm getting nothing. It throws the following:

      17:07:48,875 INFO [STDOUT] explanation: Could not dereference object
      17:07:48,891 ERROR [MainDeployer] could not start deployment: file:/D:/jboss-3.2.0beta/server/default/deploy/ccta.war
      org.jboss.deployment.DeploymentException: Could not dereference object; - nested throwable: (javax.servlet.ServletException: Could not dereference object)
      at org.jboss.jetty.Jetty.deploy(Jetty.java:427)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:243)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:302)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:812)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:624)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:588)
      at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy7.deploy(Unknown Source)

      Can anyone tell me what I should type from this point on to obtain my DataSource correctly:

      Context ic = new InitialContext();
      .....
      DataSource ds = .....

        • 1. Re: Datasource installs, but isn't present in context (oracl
          venko Newbie

          > I think I finally managed to get my Oracle 8 data
          > source installed by modifying the oracle-ds.xml file
          > and dropping it into the deploy directory. Here it
          > is:
          >
          >
          > <local-tx-datasource>
          > <jndi-name>CCTADS</jndi-name>
          >
          >
          >
          > <connection-url>jdbc:oracle:thin:@servername:1521:cct
          > _test</connection-url>
          >
          >
          >
          > <driver-class>oracle.jdbc.driver.OracleDriver class>
          > <user-name>ccta</user-name>
          > ccta
          > </local-tx-datasource>
          >
          >
          > I have added classes12.zip to server/default/lib, and
          > modified standardjaws.xml and
          > standardjbosscmp-jdbc.xml to have the following:
          >
          > java:CCTADS
          > <datasource-mapping>Oracle8</datasource-mapping>
          >
          > where CCTADS is the name I chose instead of OracleDS.
          > In my web.xml file I reference the resource like
          > this:
          >
          > <resource-ref>
          > Database reference for CCTA
          > A application
          > <res-ref-name>jdbc/CCTADS</res-ref-name>
          > <res-type>javax.sql.DataSource</res-type>
          > <res-auth>Container</res-auth>
          > </resource-ref>
          > <env-entry>
          > Name of resource reference for
          > r database
          >
          > <env-entry-name>jndi-datasource-name</env-entry-name>
          >
          > <env-entry-value>jdbc/CCTADS</env-entry-value>
          > <env-entry-type>java.lang.String</env-entry-type>
          > </env-entry>
          >
          > I run JBoss, and lines such as the following lead me
          > to believe things are going OK:
          >
          > 17:07:45,516 INFO [CCTADS] Bound connection factory
          > for resource adapter for ConnectionManager
          > 'jboss.jca:service=LocalTxCM,name=CCTADS to JNDI name
          > 'java:/CCTADS'
          >
          > Then in my action servlet class (for struts), I try
          > and grab the data source, but I'm getting nothing.
          > It throws the following:
          >
          > 17:07:48,875 INFO [STDOUT] explanation: Could not
          > dereference object
          > 17:07:48,891 ERROR [MainDeployer] could not start
          > deployment:
          > file:/D:/jboss-3.2.0beta/server/default/deploy/ccta.wa
          >
          > org.jboss.deployment.DeploymentException: Could not
          > dereference object; - nested throwable:
          > (javax.servlet.ServletException: Could not
          > dereference object)
          > at org.jboss.jetty.Jetty.deploy(Jetty.java:427)
          > at
          > org.jboss.jetty.JettyService.performDeploy(JettyServi
          > e.java:243)
          > at
          > org.jboss.web.AbstractWebContainer.start(AbstractWebC
          > ntainer.java:302)
          > at
          > org.jboss.deployment.MainDeployer.start(MainDeployer.
          > ava:812)
          > at
          > org.jboss.deployment.MainDeployer.deploy(MainDeployer
          > java:624)
          > at
          > org.jboss.deployment.MainDeployer.deploy(MainDeployer
          > java:588)
          > at
          > sun.reflect.GeneratedMethodAccessor25.invoke(Unknown
          > Source)
          > at
          > sun.reflect.DelegatingMethodAccessorImpl.invoke(Deleg
          > tingMethodAccessorImpl.java:25)
          > at java.lang.reflect.Method.invoke(Method.java:324)
          > at
          > org.jboss.mx.capability.ReflectedMBeanDispatcher.invo
          > e(ReflectedMBeanDispatcher.java:284)
          > at
          > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServe
          > Impl.java:549)
          > at
          > org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:
          > 74)
          > at $Proxy7.deploy(Unknown Source)
          >
          > Can anyone tell me what I should type from this point
          > on to obtain my DataSource correctly:
          >
          > Context ic = new InitialContext();
          > .....
          > DataSource ds = .....

          Have you configured oracle-service.xml file ?
          what is the content?

          • 2. Re: Datasource installs, but isn't present in context (oracl
            David Jencks Master

            It's not clear to me from what you show that the problem is related to the datasource.

            You can look in the jndiview mbean to check for yourself, but I tend to believe the log message saying the ds is bound.

            One popular way of making datasources inaccessible is to do jndi lookups through tcp/ip instead of in-vm. Nothing in a java:/ context will be visible if you do this. You can make this happen by including an inappropriate jndi.properties file in your .war.