I'm at the beginning stages of using Hibernate JCA (2.0.1) in WebLogic 8.1.
I did have one (easily fixed) issue with the current implementation of JCASessionFactoryImpl.
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-325.
The other change I had to make was to set the <license-required> attribute in ra.xml to false when packaging hibernate.rar. Weblogic would not deploy with it unset.
I had one more problem that required me to either:
- add my mapping files to the application class path, or
- make a small change to
ManagedConnectionFactoryImpl
(see
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-330).
Other than that, hibernate JCA worked fine (although I'm not entirely satisfied yet with my deployment.)
I'll summarize my goals and how I ended up deploying, since I'd be interested if anyone has comments or if I'm being bone-headed about anything.
My goal was a deployment with the following:
(1) An
unconfigured Hibernate Resource Adapter (packaged as a .rar): This is akin to an unconfigured Datasource.
(2) The
actual connection factories deployed as
configurations of that single resource adapter. The configuration values are specified in
weblogic-ra.xml (including a
<ra-link-ref> to the hibernate resource adapter). (See
http://edocs.bea.com/wls/docs81/jconnector/dtdappen.html#1013713). The mapping files are
packaged in the .rar for that connection factory's deployment.
(3) As little extension to the server classpath as possible.
For goal (3), I couldn't figure out a way to avoid adding the hibernate jars to the application server class path since my application components interact with
net.sf.hibernate.Session. I had hoped to just put hibernate
interfaces on the application server class path, but I couldn't figure out how to make a clean separation of hibernate interfaces and implementation. I'll put those issues in another posting.
For (1), I was originally going to package
net.sf.hibernate.jca and the hibernate
implementation in a rar. But, due to my interface problems, I ended up just putting
net.sf.hibernate.jca,
ra.xml in the
.rar. WebLogic also turned out to be a bit annoying because it seems like the unconfigured Hibernate Resource Adapter still has to be packaged with a
weblogic-ra.xml configuration which forced be to add it to JNDI.
To accomplish (2) I had to make a change to
ManagedConnectionFactoryImpl discussed in the JIRA posting. The change made sense to me, but I'm not 100% sure of it yet.
Some other weblogic related issues I experienced:
- I believe that when binding/rebinding hierarchical names to JNDI in Weblogic, it requires "." as a separator instead of "/". (Lookup seems to work for me using either "." or "/" as a separator.)
- While JBoss binds connection factories/datasources to JDNI using a "java:" prefix, WebLogic doesn't (and won't allow it). So the hibernate configuration of the datasource (and the JNDI lookup of a JCA hibernate factory) is different in the two servers.