7 Replies Latest reply on Oct 30, 2004 10:17 PM by beyarecords

    Hibernate.har into .ear...HowTo?

    beyarecords Novice

      I have a hibernate.har which works fine. I wish to take advantage of 'EJBs which mange the transactions (JTA)'. How do I configure a .Ear to use my hibernate.har file?

      many thanks


        • 1. Re: Hibernate.har into .ear...HowTo?
          beyarecords Novice

          just to add that I am running JBoss version 4.0.



          • 2. Re: Hibernate.har into .ear...HowTo?
            Dave Smith Newbie

            add in your .har file in the ear. In application.xml add hibernate har

            • 3. Re: Hibernate.har into .ear...HowTo?
              beyarecords Novice

              I have decleared my ear as follows:

              ----all my *.class & *.hbm.xml

              How do I configure my application.xml (the syntax for JBoss 4.0) in this case as I have defined my jboss-app.xml as? :

              <?xml version="1.0"?>




              many thanks


              • 4. Re: Hibernate.har into .ear...HowTo?
                beyarecords Novice

                I have specified my jboss-app.xml file as:

                <?xml version="1.0"?>


                I am having trouble declaring my hibernate.har in application.xml. How do I declare the application.xml file? If I have added hibernate.har in the application.xml file do I still need the jboss-app.xml file as well?

                many thanks


                • 5. Re: Hibernate.har into .ear...HowTo?
                  beyarecords Novice

                  I am getting the following error message in the logs:

                  Incompletely deployed packages:
                  org.jboss.deployment.DeploymentInfo@71fa8d34 { url=file:/Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/ }
                  deployer: org.jboss.deployment.EARDeployer@2b25e6
                  status: null
                  state: FAILED
                  watch: file:/Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/
                  altDD: null
                  lastDeployed: 1099165264240
                  lastModified: 1099150867000

                  I have specified my application.xml file as:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" >


                  Is this the correct way to specify the application.xml file?

                  many thanks


                  • 6. Re: Hibernate.har into .ear...HowTo?
                    beyarecords Novice

                    I have now declared my application.xml file as:

                    <?xml version="1.0" encoding="UTF-8"?>


                    <connector hibernate.har </connector


                    In the logs I now get the following:

                    01:48:46,377 INFO [EARDeployer] Init J2EE application: file:/Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/
                    01:48:50,273 INFO [EARDeployer] Started J2EE application: file:/Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/

                    But what I do not get is any log information regarding the status of Hibernate! I presume application.xml file is incorrect?

                    • 7. Re: Hibernate.har into .ear...HowTo?
                      beyarecords Novice

                      I am now at the stage whereby I am getting the following messagein the logs:

                      02:03:33,611 INFO [EARDeployer] Init J2EE application: file:/Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/
                      02:03:33,820 INFO [Environment] Hibernate 2.1.5
                      02:03:33,830 INFO [Environment] hibernate.properties not found
                      02:03:33,835 INFO [Environment] using CGLIB reflection optimizer
                      02:03:33,859 INFO [Configuration] Mapping file: /Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/hibernate.har/test/Artist.hbm.xml
                      02:03:34,037 INFO [Binder] Mapping class: test.Artist -> artisttbl
                      02:03:34,249 INFO [Configuration] Mapping file: /Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/hibernate.har/test/ArtistImages.hbm.xml
                      02:03:34,265 INFO [Binder] Mapping class: test.ArtistImages -> artistimagestbl
                      02:03:34,272 INFO [Configuration] Mapping file: /Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/hibernate.har/test/Order.hbm.xml
                      02:03:34,297 INFO [Binder] Mapping class: test.Order -> orderstbl
                      02:03:34,345 INFO [Configuration] Mapping file: /Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/hibernate.har/test/OrderItem.hbm.xml
                      02:03:34,376 INFO [Binder] Mapping class: test.OrderItem -> orderitemstbl
                      02:03:34,378 INFO [Configuration] Mapping file: /Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/hibernate.har/test/Stock.hbm.xml
                      02:03:34,399 INFO [Binder] Mapping class: test.Stock -> stocktbl
                      02:03:34,408 INFO [Configuration] Mapping file: /Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/hibernate.har/test/StockImages.hbm.xml
                      02:03:34,422 INFO [Binder] Mapping class: test.StockImages -> stockimagestbl
                      02:03:34,423 INFO [Configuration] Mapping file: /Library/jboss-4.0.0/server/default/deploy/myHibernateEar.ear/hibernate.har/test/User.hbm.xml
                      02:03:34,461 INFO [Binder] Mapping class: test.User -> usertbl
                      02:03:34,467 INFO [Binder] Mapping collection: test.User.ArtistChoice -> choicetbl
                      02:03:34,468 INFO [Configuration] processing one-to-many association mappings
                      02:03:34,469 INFO [Binder] Mapping collection: test.Order.OrderItems -> orderitemstbl
                      02:03:34,470 INFO [Binder] Mapping collection: test.Stock.StockImages -> stockimagestbl
                      02:03:34,472 INFO [Configuration] processing one-to-one association property references
                      02:03:34,472 INFO [Configuration] processing foreign key constraints
                      02:03:34,567 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
                      02:03:34,572 INFO [SettingsFactory] Use outer join fetching: true
                      02:03:34,587 INFO [NamingHelper] JNDI InitialContext properties:{}
                      02:03:34,596 INFO [DatasourceConnectionProvider] Using datasource: java:/PostgresDS
                      02:03:34,600 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
                      02:03:34,602 INFO [NamingHelper] JNDI InitialContext properties:{}
                      02:03:34,606 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
                      02:03:34,607 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
                      02:03:34,608 INFO [NamingHelper] JNDI InitialContext properties:{}
                      02:03:34,610 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
                      02:03:34,611 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
                      02:03:34,774 INFO [SettingsFactory] Use scrollable result sets: true
                      02:03:34,774 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
                      02:03:34,775 INFO [SettingsFactory] Optimize cache for minimal puts: false
                      02:03:34,775 INFO [SettingsFactory] echoing all SQL to stdout
                      02:03:34,776 INFO [SettingsFactory] Query language substitutions: {}
                      02:03:34,776 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
                      02:03:34,786 INFO [Configuration] instantiating and configuring caches
                      02:03:34,824 WARN [Configurator] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/Library/jboss-4.0.0/server/default/lib/ehcache-1.0.jar!/ehcache-failsafe.xml

                      But when I runs the following code:

                      InitialContext ctx = new InitialContext();
                      transaction = (UserTransaction)ctx.lookup("java:/UserTransaction");

                      session = HibernateContext.getSession("java:/hibernate/SessionFactory");
                      //Get User details
                      query = session.createQuery("from test.User as user where user.UserName=:username and user.UserPassword=:password")
                      user = (User) query.uniqueResult();


                      I now get the following error message in the logs:

                      02:05:17,430 WARN [QueryTranslator] no persistent classes found for query class: from test.User as user where user.UserName=:username and user.UserPassword=:password

                      As I already have a test/*.class, test/*.hbm.xml defined in the ear document, as can be seen in the log read out, what am I missing here?