1 Reply Latest reply on Feb 5, 2013 3:03 PM by wdfink

    Connecting DataSource in JBOSS 6 from outside the container or standalone java client

    samir.patil

      Hi All,

       

      We are using JBOSS 6, and Spring 3.0.8 and Hibernate.  We are using following configuration to connect to database with war application file for connecting to database.  The below works fine

      <jee:jndi-lookup id="dataSource" jndi-name="jboss/clrt"/>.

       

      But now we have a requirement which requires standalone program to be run as client which need to connect datasource through jndi. We are unable to connect to database with above configuration.  We tried some of the below configuration but that too didn't work. It gives error java.net.sockettimeoutexception receive timed out while connecting to datasource.

       

      Please can anyone help us to resolve this issue. Also can any one confirm are we using right configuration of jndi i/p and port address for connecting datasource configured with jboss.

       

      <jee:jndi-lookup id="dataSource" jndi-name="jboss/clrt">
      <jee:environment>
      java.naming.provider.url=jnp://localhost:4447
      java.naming.factory.url.pkgs=org.jnp.interfaces:org.jboss.naming
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      </jee:environment>
      </jee:jndi-lookup>

       

      <jee:jndi-lookup id="dataSource" jndi-name="jboss/clrt">
      <jee:environment>
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jnp.interfaces:org.jboss.naming
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      </jee:environment>
      </jee:jndi-lookup>

       

      Thanks