-->
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.  [ 15 posts ] 
Author Message
 Post subject: Hibernate JCA and weblogic; Anyone?
PostPosted: Fri Sep 05, 2003 6:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Just wondering if anyone is currently using Hibernate as a JCA/managed-resource in weblogic 6.1 or 8.1?


Top
 Profile  
 
 Post subject: Re: Hibernate JCA and weblogic; Anyone?
PostPosted: Mon Sep 15, 2003 8:14 am 
Newbie

Joined: Mon Sep 15, 2003 8:06 am
Posts: 8
Not currently yet, but want to start in a couple of days (if possible).

Concerning this subject (well... more or less), the hibernate site
contains this sentence :
'WebLogic Server's JNDI implementation is known to be incompatible with Hibernate. Questions regarding this issue should be directed to BEA, since it it due to their lack of support for a fairly non-exotic part of the JNDI spec.'

Thought this meant that hibernate could not be used in WebLogic.
Does your question imply that this is no longer the case ?
Do I need special version/patch of WebLogic and/or Hibernate in
order to make them work together ?

Thanks in advance.

Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 8:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Thought this meant that hibernate could not be used in WebLogic.


Hibernate can certainly be used in WebLogic. You just might not be able to fetch the session from JNDI. A minor problem, really.

P.S. I believe that this actually can be made to work - but don't ask me how.

There is an issue in JIRA that shows Hibernate JCA to be incompatible with WebLogic.

Actually, the JCA implementation is still quite experimental and neither Daniel nor Igor have really been actively working on it. I will expend some effort on this in the 2.2 timeline.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 9:59 am 
Beginner
Beginner

Joined: Tue Aug 26, 2003 1:02 pm
Posts: 34
Location: Akron, OH
I haven't had any problems fetching a SessionFactory from JNDI using 6.1.


Top
 Profile  
 
 Post subject: Hibernate JCA and Weblogic 8.1
PostPosted: Tue Sep 16, 2003 4:16 pm 
Newbie

Joined: Tue Sep 16, 2003 2:36 pm
Posts: 6
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 4:18 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A great place for this information would be the wiki Community Area. On the forum it will be lost in a couple of days otherwise...

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 5:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Cool. Thanks alot for the info. We are looking to moving to 8.1 in the very near furture.


Top
 Profile  
 
 Post subject: JCA and weblogic
PostPosted: Thu Sep 18, 2003 1:24 pm 
Newbie

Joined: Thu Sep 18, 2003 1:21 pm
Posts: 4
Is JCA what I would need to be able to remove all transaction-related code from a Stateless Session bean that uses Hibernate? My goal is to use the transaction properties from the EJB's descriptor file and let the container commit the transaction based on those. Is this possible? (Only) with JCA ?

Many thanks,
T Sanidas


Top
 Profile  
 
 Post subject: Re: JCA and weblogic
PostPosted: Thu Sep 18, 2003 4:27 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
sandman_cp wrote:
Is JCA what I would need to be able to remove all transaction-related code from a Stateless Session bean that uses Hibernate? My goal is to use the transaction properties from the EJB's descriptor file and let the container commit the transaction based on those. Is this possible? (Only) with JCA ?

You don't have to do it with JCA.
See hibernate reference guide sctn 2.4 and 2.5.6 to allow transaction delegation to JTA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 18, 2003 5:35 pm 
Newbie

Joined: Thu Sep 18, 2003 1:21 pm
Posts: 4
Quote:
See hibernate reference guide sctn 2.4 and 2.5.6 to allow transaction delegation to JTA


Thanks. I reviewed that, plus section 14.1 ("Configurations, Sessions and Factories"). I'm having trouble when using Hibernate in my stateless session bean, as described in that section. My method saves a new User object to my USERS table, then returns. However, I don't see the new rows in the db. Here's some snippets from the stateless session bean, then the hibernate.cfg.xml:

Code:
           // Find Hibernate session fact using JNDI
           //  Bound using a Servlet that calls configure(), then buildSessionFactory()
     SessionFactory sf = (SessionFactory)
                 getInitialContext().lookup("hibernate_session");
            Session session = sf.openSession();

            // Testing new instance
            User user = new User();
            user.setUsername(id);
            user.setName(name);
            user.setCountry("USA");
            session.save(user);

             // Some collection stuff added here, thus the flush()
            session.flush();

            System.out.println("New user: " + user.getUsername()
                + " id " + user.getId() );
            // This prints the new sequence # as expected

            System.out.println("*** CLOSING SESSION ***");
            session.close();
            System.out.println("*** RETURNING ***");
            // This statement reached



Notice no commit, per Hibernate doc, section 14.1.


hibernate.cfg.xml:
Code:
      <session-factory name="hibernate_session">
         <!-- JNDI section -->
            <!-- property name="session_factory_name">hibernate</property -->
            <property name="jndi.url">t3://localhost:7007</property>
            <property name="jndi.class">weblogic.jndi.WLInitialContextFactory</property>

         <property name="show_sql">true</property>
         <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
         <property name="connection.datasource">contribModelDS</property>
         <property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
         <property name="jta.UserTransaction">javax/transaction/UserTransaction</property>
         <property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.WeblogicTransactionManagerLookup</property>
         <!-- Mapping files -->
            <mapping resource="com/cpships/contribmodel/user/User.hbm.xml" />
      </session-factory>   


I'm trying to use a data source set up in Weblogic 8.1 against an Oracle 9.0.x db while using the Oracle "XA" thin driver. Hibernate's logging says that the transaction is complete, but still no commit at the db level?
Have I missed something?

Thanks,
T Sanidas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 18, 2003 9:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Is your session bean configured to use container managed transactions?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 19, 2003 8:45 am 
Newbie

Joined: Thu Sep 18, 2003 1:21 pm
Posts: 4
Hi,
I'm using container-managed transactions. I've marked this bean's trans-attribute as "Required". Also, I left out that my Hibernate version is 2.0.3.
Thanks,
T Sanidas


Top
 Profile  
 
 Post subject: EUREKA
PostPosted: Fri Sep 19, 2003 12:19 pm 
Newbie

Joined: Thu Sep 18, 2003 1:21 pm
Posts: 4
Hello all,
Thanks for your help, but I've discovered the problem. Rest assured, it is not Hibernate-related.

As a warning to others, I'll post the solution here. Weblogic 8.1 comes with the Oracle driver for 9.2 more or less hard-wired into its classpath. I copied my "classes12.zip" from my Oracle server, changed the startweblogic script to prepend my classes12.zip onto the classpath (before the WL_CLASSPATH) and it all cleared up.
The moral of this story is to ALWAYS use the same jdbc driver that comes with the Oracle db server in your app server (in my experience).

-T Sanidas,
again a happy Hibernate newbie


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 09, 2004 5:23 pm 
Newbie

Joined: Thu Dec 09, 2004 5:00 pm
Posts: 1
Hi,

My hibernate application is working fine with resin, it is simple web application. We are migrating to Weblogic 8.1, I didn't define any datasource or connection pools to weblogic as hibernate manage its own connection pool.

When I try to access a lazy set from a JSP I got the following error, as you notice the session is created before the error and closed after any help:

2004-12-09 15:33:41,053 DEBUG com.bluespark.db.HibernateSession - *********** hibernate session created ***********
2004-12-09 15:33:41,063 ERROR net.sf.hibernate.LazyInitializationException - Failed to lazily initialize a collection - no Session
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no Session
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:213)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:69)
at net.sf.hibernate.collection.Set.iterator(Set.java:131)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:360)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:238)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:172)
at javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:262)
at org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:105)
at jsp_servlet._secure._company.__home._jspService(home.jsp:283)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.util.AnalyticsFilter.doFilter(AnalyticsFilter.java:44)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.db.PersistentFilter.doFilter(PersistentFilter.java:55)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.security.AbstractSecurityFilter.doFilter(AbstractSecurityFilter.java:54)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:628)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:412)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._layouts.__vboxlayout._jspService(vboxLayout.jsp:29)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.util.AnalyticsFilter.doFilter(AnalyticsFilter.java:44)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.db.PersistentFilter.doFilter(PersistentFilter.java:55)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:628)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:412)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._layouts.__securetemplate._jspService(secureTemplate.jsp:83)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.util.AnalyticsFilter.doFilter(AnalyticsFilter.java:44)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.db.PersistentFilter.doFilter(PersistentFilter.java:55)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:316)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.util.AnalyticsFilter.doFilter(AnalyticsFilter.java:44)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.db.PersistentFilter.doFilter(PersistentFilter.java:55)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.util.NumberFormatFilter.doFilter(NumberFormatFilter.java:129)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.security.AbstractSecurityFilter.doFilter(AbstractSecurityFilter.java:54)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.mgt.tools.HistoryFilter.doFilter(HistoryFilter.java:42)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.mgt.tools.TimerFilter.doFilter(TimerFilter.java:44)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:316)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:320)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.util.AnalyticsFilter.doFilter(AnalyticsFilter.java:44)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.db.PersistentFilter.doFilter(PersistentFilter.java:55)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.util.NumberFormatFilter.doFilter(NumberFormatFilter.java:129)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.security.AbstractSecurityFilter.doFilter(AbstractSecurityFilter.java:54)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.mgt.tools.HistoryFilter.doFilter(HistoryFilter.java:42)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bluespark.mgt.tools.TimerFilter.doFilter(TimerFilter.java:44)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6458)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
2004-12-09 15:33:41,063 DEBUG com.bluespark.db.HibernateSession - *********** hibernate session closed ***********


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 1:22 pm 
Newbie

Joined: Fri Sep 10, 2004 3:10 pm
Posts: 4
May I ask, what is the advantage of having Hibernate as a JCA?

Thanks.

Sheldon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 15 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.