6 Replies Latest reply on Mar 17, 2003 1:04 PM by anfo

    Please help for Datasource not bound error

    soemoe

      I don’t know what I did was incorrect.
      Here is my setup
      Jboss-3.0.6 and tomcat 4.1
      Postgresql 7.2

      Placed the postgres-service.xml in server/default/deploy.

      Changed the parameters accordingly. (see attached file)

      Placed the pg73jdbc3.jar in server/default/lib.

      Server startup with no error.


      I have this helper class in server/default/lib.

      static Properties contextProperties;

      static {
      contextProperties = new Properties();
      contextProperties.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
      contextProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      contextProperties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      }


      context = new InitialContext(contextProperties);
      dataSource = (javax.sql.DataSource)context.lookup(“jdbc/DefaultDS”);

      I tried all combinations, InitialContext with or without properties without success.


      The unit test class in the xxxejb.jar which I placed in server/default/deploy and calls the above helper class.

      The attached ejb-jar.xml and jboss.xml is in that xxxejb.jar
      Please help me I am stuck here for 3 days.

      JNDIView

      java:

      DefaultDS
      org.jboss.resource.adapter.jdbc.local.LocalDataSource


      List Deployed view
      org.jboss.deployment.DeploymentInfo@57d446 { url=file:/E:/jboss-3.0.6/server/default/deploy/postgres-service.xml }
      deployer: org.jboss.deployment.SARDeployer@2f1921
      status: Deployed
      state: STARTED
      watch: file:/E:/jboss-3.0.6/server/default/deploy/postgres-service.xml
      lastDeployed: 1047330630407
      lastModified: 1047330630387
      mbeans:
      jboss.jca:service=LocalTxCM,name=DefaultDS state: Started
      jboss.jca:service=LocalTxDS,name=DefaultDS (state not available)
      jboss.jca:service=LocalTxPool,name=DefaultDS state: Started
      ]

        • 1. Re: Please help for Datasource not bound error
          soemoe

          I've check the forum and followed the every steps but with no success. Please help.

          • 2. Re: Please help for Datasource not bound error
            fsalimi

            Hi,
            This is the instruction of connecting to a mysql database:

            1. place your db driver in <jboss_home>\server\default\lib

            2. copy mysql-service.xml file from <jboss_home>\docs\examples\jca to <jboss_home>\server\default\deploy directory.

            3. Do not use DefaultDS name for your datasource since Hyperion is using it. I used MysqlDS.

            4. lookup java:MysqlDS

            I hope it works for you

            • 3. Re: Please help for Datasource not bound error
              soemoe

              Initially I named PostgreDS, I tried every combination.
              java:/PostgreDS
              java:PostgreDS

              in the server log it bound to java:/PostgreDS
              [PostgreDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/PostgreDS'

              • 4. Re: Please help for Datasource not bound error
                davidjencks

                your jndi properties you are setting in code are preventing you from finding anything bound in the java: context which is in vm only. Including localhost port 1099 forces the lookup to go outside the vm so java:/ cannot be found.

                • 5. Re: Please help for Datasource not bound error
                  soemoe

                  I did with or without the properties.
                  Can you tell me how I can achieve the goal?

                  • 6. Re: Please help for Datasource not bound error
                    anfo

                    I have been having the same problem with Sybase, I tried 3.0.4 and 3.0.6 with tomcat and about... a billion variations on the sybase-service.xml and associated config files.

                    I just downloaded Jboss 3.0.6 with JbossWeb vs. tomcat, changed the ip/port/uname&pw in sybase-service.xml and put it in server/all/deploy, started jboss and it worked.. it just worked. I think it is something in the tomcat setup/version that is causing all of these "not bound" errors (but this is only my 1st experience with jboss, so take it for what its worth).