5 Replies Latest reply on Oct 14, 2005 6:51 AM by henderson_mk

    datasources and jboss seam

    henderson_mk

      Hi folks,
      I'm a bit of newbie to the jboss world and have been playing with seam.
      I'm having some problems with the datasource aspect of it.

      I've created a turn-around-ds.xml that looks like:

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>propertyDatasource</jndi-name>
       <connection-url>jdbc:hsqldb:.</connection-url>
       <driver-class>org.hsqldb.jdbcDriver</driver-class>
       <user-name>sa</user-name>
       <password></password>
       </local-tx-datasource>
      </datasources>
      


      and then referenced this in the hibernate config:
      <!DOCTYPE hibernate-configuration PUBLIC
       "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
       "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      
      <hibernate-configuration>
       <session-factory name="propertyDatabase">
       <property name="show_sql">true</property>
       <property name="connection.datasource">java:propertyDatasource</property>
       <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
       <property name="hbm2ddl.auto">create-drop</property>
       <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
       <property name="transaction.flush_before_completion">true</property>
       <property name="connection.release_mode">after_statement</property>
       <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
       <mapping class="org.mhenderson.turnaround.domain.Property"/>
       </session-factory>
      </hibernate-configuration>
      


      so.. I dropped the datasource config into the /default/deploy directory and got this:
      09:04:36,176 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=propertyDatasource' to JNDI name 'java:propertyDatasource'
      


      but then on dropping the war file into the /default/deploy directory I got this:
      09:05:44,788 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
      09:05:44,838 INFO [Configuration] Configured SessionFactory: propertyDatabase
      09:05:45,209 INFO [Configuration] processing extends queue
      09:05:45,209 INFO [Configuration] processing collection mappings
      09:05:45,209 INFO [Configuration] processing association property references
      09:05:45,209 INFO [Configuration] processing foreign key constraints
      09:05:45,419 INFO [NamingHelper] JNDI InitialContext properties:{}
      09:05:45,429 ERROR [[/turn-around]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener org.hibernate.HibernateException: Could not find datasource: java:propertyDatasource
       at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:59)
      


      any help would be really appreciated... thanks.

      Marty

        • 1. Re: datasources and jboss seam
          jaikiran

           

          "henderson_mk" wrote:
          <property name="connection.datasource">java:propertyDatasource</property>


          Change this to:

          <property name="connection.datasource">java:/propertyDatasource</property>


          Observe the '/' in java:/propertyDatasource was missing earlier

          I think this should work

          • 2. Re: datasources and jboss seam
            henderson_mk

            Hi jaikiran, thanks for replying...

            changed that in the hibernate config and now getting:

            10:17:10,784 ERROR [[/turn-around]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
            org.hibernate.HibernateException: Could not find datasource: java:/propertyDatasource


            argh.... how frustrating is this... I also tried to map the hibernate config to the DefaultDS as at least I can be pretty sure that its setup properly (maybe..?) but no joy either...

            • 3. Re: datasources and jboss seam
              jaikiran

              Try out the following:

              http://localhost:8080/jmx-console

              In this search for : service=JNDIView. Click on it. Then on the page that gets displayed, click on Invoke button beside the list method.

              In the java: Namespace check whether you can find:
              propertyDatasource.

              This is to confirm that your datasource has been deployed

              • 4. Re: datasources and jboss seam
                jaikiran

                Are you sure you have place the turn-around-ds.xml in /default/deploy
                directory?

                • 5. Re: datasources and jboss seam
                  henderson_mk

                  yea... I had indeed.

                  got it sorted though... I stripped the war file right down... as it was including some other jboss jars in the web-inf/lib directory... and lo and behold it all seems to be working now... winner!

                  cheers for your help dude!