2 Replies Latest reply on Mar 15, 2006 8:35 AM by JBoss Developer

    jboss-4.0.3SP1 - Hibernate SAR data source, please help

    JBoss Developer Newbie

      Hi Folks,

      If you can get me past this exception I would be greatful.

      Thanks


      006-03-14 23:31:29,776 INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
      2006-03-14 23:31:31,188 INFO [org.jboss.mq.server.jmx.Queue.A] Bound to JNDI name: queue/A
      2006-03-14 23:31:31,188 INFO [org.jboss.mq.server.jmx.Queue.B] Bound to JNDI name: queue/B
      2006-03-14 23:31:31,208 INFO [org.jboss.mq.server.jmx.Queue.C] Bound to JNDI name: queue/C
      2006-03-14 23:31:31,208 INFO [org.jboss.mq.server.jmx.Queue.D] Bound to JNDI name: queue/D
      2006-03-14 23:31:31,208 INFO [org.jboss.mq.server.jmx.Queue.ex] Bound to JNDI name: queue/ex
      2006-03-14 23:31:31,458 INFO [org.jboss.mq.server.jmx.Topic.testTopic] Bound to JNDI name: topic/testTopic
      2006-03-14 23:31:31,468 INFO [org.jboss.mq.server.jmx.Topic.securedTopic] Bound to JNDI name: topic/securedTopic
      2006-03-14 23:31:31,478 INFO [org.jboss.mq.server.jmx.Topic.testDurableTopic] Bound to JNDI name: topic/testDurableTopic
      2006-03-14 23:31:31,498 INFO [org.jboss.mq.server.jmx.Queue.testQueue] Bound to JNDI name: queue/testQueue
      2006-03-14 23:31:31,798 INFO [org.jboss.mq.il.uil2.UILServerILService] JBossMQ UIL service available at : /0.0.0.0:8093
      2006-03-14 23:31:32,069 INFO [org.jboss.mq.server.jmx.Queue.DLQ] Bound to JNDI name: queue/DLQ
      2006-03-14 23:31:32,960 INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
      2006-03-14 23:31:33,411 INFO [org.hibernate.jmx.HibernateServiceMBean] starting service at JNDI name: HibernateSessionFactory
      2006-03-14 23:31:33,411 INFO [org.hibernate.jmx.HibernateServiceMBean] service properties: {hibernate.session_factory_name=HibernateSessionFactory, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup, hibernate.transaction.auto_close_session=true, hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:MySQLDataSource, hibernate.transaction.flush_before_completion=true}
      2006-03-14 23:31:33,801 INFO [org.hibernate.cfg.Environment] Hibernate 3.1
      2006-03-14 23:31:33,851 INFO [org.hibernate.cfg.Environment] loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=false, hibernate.cache.provider_class=org.hibernate.cache.TreeCacheProvider, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=20, hibernate.connection.username=webapps, hibernate.connection.datasource=java:/MySQLDataSource, hibernate.connection.url=jdbc:mysql://localhost/roster, hibernate.show_sql=true, hibernate.connection.password=****}
      2006-03-14 23:31:33,851 INFO [org.hibernate.cfg.Environment] using java.io streams to persist binary types
      2006-03-14 23:31:33,851 INFO [org.hibernate.cfg.Environment] using JDK 1.4 java.sql.Timestamp handling
      2006-03-14 23:31:34,723 INFO [org.hibernate.cfg.Configuration] processing extends queue
      2006-03-14 23:31:34,723 INFO [org.hibernate.cfg.Configuration] processing collection mappings
      2006-03-14 23:31:34,733 INFO [org.hibernate.cfg.Configuration] processing association property references
      2006-03-14 23:31:34,733 INFO [org.hibernate.cfg.Configuration] processing foreign key constraints
      2006-03-14 23:31:34,813 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
      2006-03-14 23:31:34,943 FATAL [org.hibernate.connection.DatasourceConnectionProvider] Could not find datasource: java:MySQLDataSource
      javax.naming.NameNotFoundException: MySQLDataSource not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
      



      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
       <mbean code="org.hibernate.jmx.HibernateService"
       name="jboss.jca:service=HibernateSessionFactory,name=HibernateSessionFactory">
      
       <!-- Required services -->
       <depends>jboss.jca:service=RARDeployer</depends>
       <depends>jboss.jca:service=LocalTxCM,name=MySQLDataSource</depends>
      
       <!-- Bind the Hibernate service to JNDI -->
       <attribute name="JndiName">HibernateSessionFactory</attribute>
      
       <!-- Datasource settings -->
       <attribute name="Datasource">java:MySQLDataSource</attribute>
       <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
      
       <!-- Transaction integration -->
       <attribute name="TransactionStrategy">
       org.hibernate.transaction.JTATransactionFactory</attribute>
       <attribute name="TransactionManagerLookupStrategy">
       org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
       <attribute name="FlushBeforeCompletionEnabled">true</attribute>
       <attribute name="AutoCloseSessionEnabled">true</attribute>
      
       <!-- Fetching options -->
       <attribute name="MaximumFetchDepth">5</attribute>
      
       <!-- Second-level caching -->
       <attribute name="SecondLevelCacheEnabled">true</attribute>
       <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
       <attribute name="QueryCacheEnabled">true</attribute>
      
       <!-- Logging -->
       <attribute name="ShowSqlEnabled">true</attribute>
       </mbean>
      
      </server>
      




        • 1. Re: jboss-4.0.3SP1 - Hibernate SAR data source, please help
          JBoss Developer Newbie

          here is the datasource

          <?xml version="1.0" encoding="UTF-8"?>
          
          <datasources>
           <local-tx-datasource>
           <jndi-name>MySQLDataSource</jndi-name>
           <connection-url>jdbc:mysql://localhost:3306/roster</connection-url>
           <driver-class>com.mysql.jdbc.Driver</driver-class>
           <user-name>webapps</user-name>
           <password>webapps</password>
          
           <metadata>
           <type-mapping>mySQL</type-mapping>
           </metadata>
           <min-pool-size>5</min-pool-size>
           <max-pool-size>20</max-pool-size>
          
           <idle-timeout-minutes>5</idle-timeout-minutes>
           <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
           <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
          
           </local-tx-datasource>
          </datasources>
          
          


          • 2. Re: jboss-4.0.3SP1 - Hibernate SAR data source, please help
            JBoss Developer Newbie

            Well... the solution is hidden in the log files... the way they cache their resources and the uniue keyes they use to identify them.

            Here is my resulting XMBean for HibernateService...
            I re-spelle out the dependencies and datasource.

            <?xml version="1.0" encoding="UTF-8"?>
            
            <server>
             <mbean code="org.hibernate.jmx.HibernateService"
             name="jboss.jca:service=HibernateSessionFactory,name=HibernateSessionFactory">
            
             <!-- Required services -->
             <depends>jboss.jca:service=RARDeployer</depends>
             <depends>jboss.jca:service=DataSourceBinding,name=MySQLDataSource</depends>
             <depends>jboss.jca:service=DataSourceBinding,name=OracleDataSource</depends>
            
             <!-- Bind the Hibernate service to JNDI -->
             <attribute name="JndiName">HibernateSessionFactory</attribute>
            
             <!-- Datasource settings -->
             <attribute name="Datasource">java:MySQLDataSource</attribute>
             <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
            
             <!-- Transaction integration -->
             <attribute name="TransactionStrategy">
             org.hibernate.transaction.JTATransactionFactory</attribute>
             <attribute name="TransactionManagerLookupStrategy">
             org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
             <attribute name="FlushBeforeCompletionEnabled">true</attribute>
             <attribute name="AutoCloseSessionEnabled">true</attribute>
            
             <!-- Fetching options -->
             <attribute name="MaximumFetchDepth">5</attribute>
            
             <!-- Second-level caching -->
             <attribute name="SecondLevelCacheEnabled">true</attribute>
             <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
             <attribute name="QueryCacheEnabled">true</attribute>
            
             <!-- Logging -->
             <attribute name="ShowSqlEnabled">true</attribute>
             </mbean>
            
            </server>
            


            Clean boot...

            Now I can finally start writing some kick ass code...