-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
 Post subject: How can I integrate Hibernate 2.1 with JBoss 3.2.x via JCA ?
PostPosted: Mon Apr 26, 2004 11:27 am 
Newbie

Joined: Mon Apr 26, 2004 11:01 am
Posts: 12
Location: France
Hello,

I'd like to use Hibernate 2.1 with JBoss via JCA.
I wonder how can I configure JBoss to do it. I don't want to use the way via JMX.

So I put the file hibernate2.rar in the /deploy folder.
What should I do after ?

I post a question on the JBoss Forum and Adrian told me to write a configuration file hibernate-ds.xml like this :

Code:
<connection-factories>
   <tx-connection-factory>

      <adapter-display-name>{The <display-name> from hibernate2.rar/META-INF/ra.xml}</adapter-display-name>

       <!-- Other config goes here -->

   </tx-connection-factory>
</connection-factories>


I tried to put the parameters as the ones used for integrating Hibernate with JBoss via JMX but I send me an error.

Does anybody try to do this ?

Regards

_________________
Xavier MOGHRABI
http://www.enstimac.fr/~moghrabi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2004 2:36 pm 
Newbie

Joined: Thu Apr 22, 2004 3:21 pm
Posts: 15
See: http://www.hibernate.org/66.html.

I would not recomend doing this though! You are limiting you ability to test, hurting portablility... I would look at how springframework does this for you!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 8:54 am 
Newbie

Joined: Mon Apr 26, 2004 11:01 am
Posts: 12
Location: France
Thank you for your quick answer mlavwilson.

In read carefully the document you had mentionned.
I was a bit disappointed when I read it. In fact, I understood that I've to build a SAR file "which will include all the entity objects, mapping XML files, and the JBoss service XML file itself". This solution doesn't please a lot. By this way I put a part of my own application into the SAR file.

I wanted Hibernate to be as an other system that my own application use it to manage persistent objects. Is that possible ?

I wonder if the solution can managed multiple accesses and cache sharing.

_________________
Xavier MOGHRABI
http://www.enstimac.fr/~moghrabi


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 8:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is currently not practically possible. You currently need one hibernate sar per application. We are working on making this more convenient with the new Hibernate Deployer structure.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 10:31 am 
Newbie

Joined: Fri Sep 26, 2003 3:29 am
Posts: 3
Does this solution eliminate the dublicate deployment of my data files and their mappings? What is the status? Something coming up soon, or for the moment not a solution?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 10:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well, duplicate deployment can already be avoided in its current state by a proper packagin structure. But I agree that this has to be documented more clearly, and I hope I find time soon to work over the JBoss integration docs.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 11:43 am 
Newbie

Joined: Mon Apr 26, 2004 11:01 am
Posts: 12
Location: France
I try to use Hibernate deployed as a SAR in a JBoss application (EAR).

So all the libraries needed have been put into the $JBoss_home/server/all/lib. I build the Sar and the Jar. The 2 archives are correct because I can use them well when they are not deployed in the same EAR.

When I try to pack them in a EAR, it doesn't work well. I got the following ERROR :

17:06:26,250 ERROR [STDERR] javax.naming.NameNotFoundException: hibernate not bound

In fact my hibernate SAR is not deployed. I don't understand why.

Here is the composition of my EAR :

Hibernate.ear :
/Hibernate.jar
/hibernate.sar
/META-INF/application.xml
/META-INF/jboss-app.xml
/META-INF/Manifest.mf

Here is my file application.xml :

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
                             "http://java.sun.com/dtd/application_1_3.dtd">
<application>
    <display-name>Hibernate</display-name>
    <module>
        <ejb>Hibernate.jar</ejb>
    </module>
</application>




Here's my jboss-app.xml :

Code:
<?xml version="1.0"?>
  <jboss-app>
  <loader-repository>hibernate:loader=Hibernate.ear</loader-repository>

  <module>
    <service>hibernate.sar</service>
  </module>

</jboss-app>




Does someone look at something wrong ?

_________________
Xavier MOGHRABI
http://www.enstimac.fr/~moghrabi


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 12:31 pm 
Newbie

Joined: Mon Apr 26, 2004 11:01 am
Posts: 12
Location: France
I succeed to make it work.
I don't know exactly how in fact. I named META-INF in minuscules. When I renamed it with Capital Letters it's worked fine.

_________________
Xavier MOGHRABI
http://www.enstimac.fr/~moghrabi


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 5:05 pm 
Beginner
Beginner

Joined: Wed Feb 18, 2004 1:28 pm
Posts: 20
Location: Rovereto - Italy
And the hot deploy works fine for you or you have to restart jboss when you have a new deploy?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 3:51 am 
Newbie

Joined: Mon Apr 26, 2004 11:01 am
Posts: 12
Location: France
The Hot deploy works fine I do not need to restart JBoss.

_________________
Xavier MOGHRABI
http://www.enstimac.fr/~moghrabi


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 4:41 am 
Beginner
Beginner

Joined: Wed Feb 18, 2004 1:28 pm
Posts: 20
Location: Rovereto - Italy
My hot deploy don't works.

I've tried to add the line:
<loader-repository>hibernate:loader=Hibernate.ear</loader-repository>

in my jboss-app.xml

but now don't work the deploy and I've received this exception:
10:34:37,571 ERROR [LazyInitializer] CGLIB Enhancement failed
net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:206)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:330)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:246)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:406)
at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:74)

...

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:373)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:193)
... 78 more
Caused by: java.lang.NoClassDefFoundError: eg/MyClass
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.lang.ClassLoader.defineClass(ClassLoader.java:382)
... 83 more
10:34:37,587 INFO [HibernateServiceMBean] Could not build SessionFactory using the MBean classpath - will try again using client classpath: CGLIB Enhancement failed
10:34:37,587 DEBUG [HibernateServiceMBean] Error was
net.sf.hibernate.HibernateException: CGLIB Enhancement failed
at net.sf.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:84)
at net.sf.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:36)

The class eg/MyClass is present in sar and in jar....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.