Jboss 3 to 4 and hibernate sars x har
atorres Aug 6, 2005 10:30 AMHi.
I upgraded my jboss from 3.x to 4 series and I got a problem with my hibernate sar. My application was deployed as an EAR with a SAR inside:
app.ear
--- app.sar
------(hbm.xml files)
------meta-inf
---------jboss-service.xml (referencing classpath to external jars)
---app.war(...)
--- meta-inf (...)
But something weird started to happen. The service is registered, the jboss log does not give any error, but when I try to lookup it just returns null. It does not return a not-found error... what is strange! I see that there is a more integrated way to do this with the har archive... but I found the wiki unclear on how to use it. I just don't TRUST it! can't make it work.
is the sar deprecated for hibernate deployment? I really wanted to make my EAR JBOSS VERSION INDEPENDENT.
my jboss-service is:
<server> <classpath codebase='deploy/pettwo.ear/pettwo.war/WEB-INF/lib/' archives='*' /> <classpath codebase='deploy/pettwo.ear/' archives='*' /> <mbean code="org.hibernate.jmx.HibernateService" name="jboss.jca:service=pettwoHibernateSessionFactory"> <depends>jboss.jca:service=RARDeployer</depends> <attribute name="MapResources"> (...my files...) </attribute> <attribute name="JndiName">java:/hibernate/pettwoSessionFactory</attribute> <attribute name="Datasource">java:/jdbc/pettwo</attribute> <attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute> <attribute name="UserTransactionName">java:comp/UserTransaction</attribute> <attribute name="TransactionStrategy">org.hibernate.transaction.JTATransactionFactory</attribute> <attribute name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</attribute> </mbean> </server>
my java lookup code is:
InitialContext ic = new InitialContext(); SessionFactory _sessionFactory = (SessionFactory) ic.lookup("java:/hibernate/pettwoSessionFactory");
the jboss log:
2005-08-05 18:09:58,984 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
2005-08-05 18:09:58,984 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: hibernate/pettwoSessionFactory
2005-08-05 18:09:58,984 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=402880830588776801058877718c0000
2005-08-05 18:09:58,984 WARN [org.hibernate.impl.SessionFactoryObjectFactory] Not found: 402880830588776801058877718c0000
It worked fine on jboss 3x series.
Thanks