4 Replies Latest reply on Jan 16, 2009 5:59 AM by Urs Rothenhäusler

    Server JVM, Client JVM, JNDI & Workaround

    Urs Rothenhäusler Newbie


      I'm running an .ear-Application on JBoss 4.2.2 containing jBPM. The Swing-Client running on the client machine works fine when connecting to the application server with the .ear-Application which uses a datasource in the java:-namespace.

      However, if I start a certain part of the application which uses jBPM/Hibernate I get an error:
      org.hibernate.HibernateException: Could not find datasource, Caused by: javax.naming.NameNotFoundException: No object bound for java:InformixDS

      I think it's because I'm using the datasource in hibernate.cfg.xml. But I want to use the datasource, which works in the rest of the application. It works fine as long as I use not the datasource and put in the database-parameters directly in hibernate.cfg.xml.

      As I read in the forum and internet, it's probably because of a local (client) and server JVM.

      So what can I do as a workaround/solution (use-java-context is no solution for me).

      Thanks for an answer.

        • 1. Re: Server JVM, Client JVM, JNDI & Workaround
          jaikiran pai Master

          More details please, like the exception stacktrace. You mention that you are using the datasource in hibernate.cfg.xml, which i believe is on the server side (the same server where datasource is present). So i don't think there should have been a problem.

          While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.

          • 2. Re: Server JVM, Client JVM, JNDI & Workaround
            Urs Rothenhäusler Newbie


            yes, hibernate.cfg.xml is on serverside (in .ear-file). The stacktrace is as follows:

            org.hibernate.HibernateException: Could not find datasource
             at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
             at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
             at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
             at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
             at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
             at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
             at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
             at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
             at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
             at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
             at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:341)
             at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
             at org.jbpm.JbpmContext.newProcessInstance(JbpmContext.java:408)
            Caused by: javax.naming.NameNotFoundException: No object bound for java:InformixDS
             at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)
             at javax.naming.InitialContext.lookup(Unknown Source)
             at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
             ... 50 more


            • 3. Re: Server JVM, Client JVM, JNDI & Workaround
              jaikiran pai Master


              at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)

              This class looks suspicious. Do you have any jndi.properties packaged in your application, which might have an incorrect entry about the naming context factory? Or maybe your hibernate configuration file has some incorrect jndi configuration information. Please post that file.

              • 4. Re: Server JVM, Client JVM, JNDI & Workaround
                Urs Rothenhäusler Newbie


                the only changes I made in hibernate.cfg.xml look like this:

                <property name="hibernate.dialect">org.hibernate.dialect.InformixDialect</property>
                <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
                 <!-- DataSource properties (begin) -->
                 <property name="hibernate.connection.datasource">java:InformixDS</property>
                 <!-- DataSource properties (end) -->

                and I used the (default) jndi.properties for the client: