hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Marcus.Schu...@bmw.ch>
Subject RE: Acquiring session not in a tapestry page error
Date Wed, 06 Dec 2006 09:33:23 GMT
Dear Henry, 

replying inline:

> -----Original Message-----
> From: Henry Tong [mailto:henrytong.pi@gmail.com] 
> Sent: Wednesday, December 06, 2006 10:19 AM
> To: user@hivemind.apache.org
> Subject: RE: Acquiring session not in a tapestry page error
> 
> 
> 1. Create two session service
>     <service-point id='HibernateWebSession'
> interface='org.hibernate.Session'>
>         <invoke-factory service-id='MySessionFactory' 
> model='threaded'/>
>     </service-point>
>

You can continue to use the pre-configured Honeycomb-Session for the
Web-Requests.
You should only need to add the EagerLoadSession

> 
>     <service-point id='HibernateEagerLoadSession'
> interface='org.hibernate.Session'>
>         <invoke-factory service-id='MySessionFactory' 
> model='threaded'/>
>     </service-point>
> 
> 2. Create one session factory only (we use
> createCoreServiceImplementation(...) to create session)
>     <service-point id='MySessionFactory' parameters-occurs="none" 
>     	interface='org.apache.hivemind.ServiceImplementationFactory'>
>         <invoke-factory model='singleton'>
>             <construct class='MySessionFactory'>
>                 <set-service property='hibernateSessionFactory'
>                    
> service-id='honeycomb.hibernate.HibernateSessionFactory'/>            
>             </construct>
>         </invoke-factory>
>     </service-point>
> 

Again, you should be fine with the pre-configured session-factory -
unless you want to override something anyway. It seems, you're using
your own implementation of a
session-factory which delegates to the Honeycomb-Session-Factory. There
may be a good reason for that, but I don't think it's necessary for the
problem you described in this thread.

> 3. The Data Upload Service use the HiberateEagerLoadSession Service. 
> 
> We are using honeycomb AbstractPersistenceService to update 
> data in the database in the web app project. Can we use 
> AbstractPersistenceService in the data upload service?

Yes, you can. Just configure a separate instance in HiveMind using your
EagerLoad-HIbernateService.

> 
> Henry
> 
> 
> Schulte Marcus wrote:
> > 
> > Sorry, follow-up:
> > 
> > You should get away with just defining a new hibernate 
> session service 
> > with a non-stateful service-model (say threaded), keeping the same 
> > SessionFactory.
> > 
> >> -----Original Message-----
> >> From: Marcus.Schulte@bmw.ch [mailto:Marcus.Schulte@bmw.ch]
> >> Sent: Wednesday, December 06, 2006 8:15 AM
> >> To: user@hivemind.apache.org
> >> Subject: RE: Acquiring session not in a tapestry page error
> >> 
> >> Hi Henry,
> >> 
> >> the Hibernate Session in Honeycomb is per default configure as a 
> >> "stateful" service to support session-per-conversation.
> >> That means, the service-model stores the Hibernate-Session 
> into the 
> >> conversation-context which is, in a Tapestry context, the 
> >> Web-Session. A web session is, of course, not available in your 
> >> initial load.
> >> 
> >> I'd suggest that you configure a different Hibernate 
> SessionFactory 
> >> and Session service (you can use the same 
> SessionFactory-Config-Point 
> >> to minimize redundancy) and use that one with your periodically 
> >> triggered loading service.
> >> 
> >> hth,
> >> Marcus
> >> 
> >> > -----Original Message-----
> >> > From: Henry Tong [mailto:henrytong.pi@gmail.com]
> >> > Sent: Wednesday, December 06, 2006 4:54 AM
> >> > To: user@hivemind.apache.org
> >> > Subject: Acquiring session not in a tapestry page error
> >> > 
> >> > 
> >> > Hi,
> >> > 
> >> > Our team started a tapestry / honeycomb / hivemind /
> >> hibernate web app
> >> > project. A data upload service is needed to load data to
> >> the database
> >> > and therefore a hivemind eagerload service is written to 
> run this 
> >> > periodical task. As we want to share the same honeycomb session 
> >> > factory, we inject hibernate session to the service while the 
> >> > hibernate session is getted from the honeycomb session factory.
> >> > 
> >> > When we tries to save data to the database, the data is
> >> still saved to
> >> > the database but the following exception occurs:
> >> > Property 'webRequest' of <OuterProxy for 
> >> > tapestry.globals.RequestGlobals( 
> >> > org.apache.tapestry.services.RequestGlobals)> is null.
> >> > at
> >> > $WebRequest_10f5595850c._targetServiceProperty($WebRequest_10f
> >> 5595850c.java)
> >> > at 
> $WebRequest_10f5595850c.getSession($WebRequest_10f5595850c.java)
> >> > at 
> $WebRequest_10f559584c5.getSession($WebRequest_10f559584c5.java)
> >> > at 
> org.apache.tapestry.engine.state.SessionScopeManager.getSession(
> >> > SessionScopeManager.java:48)
> >> > at org.apache.tapestry.engine.state.SessionScopeManager.get(
> >> > SessionScopeManager.java:64)
> >> > at
> >> > $StateObjectPersistenceManager_10f55958599.get($StateObjectPer
> >> sistenceManager_10f55958599.java)
> >> > at org.apache.tapestry.engine.state.StateObjectManagerImpl.get(
> >> > StateObjectManagerImpl.java:50)
> >> > at 
> >> > org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get(
> >> > ApplicationStateManagerImpl.java:60)
> >> > at
> >> > $ApplicationStateManager_10f5595849d.get($ApplicationStateMana
> >> ger_10f5595849d.java)
> >> > at
> >> > $ApplicationStateManager_10f5595849e.get($ApplicationStateMana
> >> ger_10f5595849e.java)
> >> > at
> >> > com.javaforge.honeycomb.tapestry.ConversationManagerImpl.getCu
> >> > rrentConversation
> >> > (ConversationManagerImpl.java:59)
> >> > at
> >> > $ConversationManager_10f55958590.getCurrentConversation($Conve
> >> rsationManager_10f55958590.java)
> >> > at
> >> > $ConversationManager_10f55958589.getCurrentConversation($Conve
> >> rsationManager_10f55958589.java)
> >> > at
> >> > com.javaforge.honeycomb.tapestry.ConversationalClientStateStor
> >> > age.retrieve(
> >> > ConversationalClientStateStorage.java:26)
> >> > at
> >> > $ClientStateStorage_10f5595858b.retrieve($ClientStateStorage_1
> >> 0f5595858b.java)
> >> > at
> >> > com.javaforge.honeycomb.hivemind.statefulservice.StatefulServi
> >> > ceModel.getServiceFromClientStateStorage
> >> > (StatefulServiceModel.java:241)
> >> > at
> >> > com.javaforge.honeycomb.hivemind.statefulservice.StatefulServi
> >> > ceModel.obtainPooledService
> >> > (StatefulServiceModel.java:229)
> >> > at
> >> > com.javaforge.honeycomb.hivemind.statefulservice.StatefulServi
> >> > ceModel.getServiceImplementationForCurrentThread
> >> > (StatefulServiceModel.java:211)
> >> > at $Session_10f5595858d._service($Session_10f5595858d.java)
> >> > at $Session_10f5595858d.getSession($Session_10f5595858d.java)
> >> > at $Session_10f5595858e.getSession($Session_10f5595858e.java)
> >> > at $Session_10f5595858f.getSession($Session_10f5595858f.java)
> >> > at
> >> > com.javaforge.honeycomb.hibernate.audit.AuditInterceptor.getAu
> >> > ditSession(
> >> > AuditInterceptor.java:138)
> >> > at
> >> > com.javaforge.honeycomb.hibernate.audit.AuditInterceptor.befor
> >> > eTransactionCompletion
> >> > (AuditInterceptor.java:145)
> >> > at
> >> > $Interceptor_10f559585a6.beforeTransactionCompletion($Intercep
> >> > tor_10f559585a6.java)
> >> > at
> >> > $Interceptor_10f559585a7.beforeTransactionCompletion($Intercep
> >> > tor_10f559585a7.java)
> >> > at org.hibernate.impl.SessionImpl.beforeTransactionCompletion(
> >> > SessionImpl.java:396)
> >> > at org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(
> >> > JDBCContext.java:202)
> >> > at
> >> > 
> >> 
> org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java
> >> > :111)
> >> > at
> >> com.javaforge.honeycomb.service.AbstractPersistenceService.commit(
> >> > AbstractPersistenceService.java:61)
> >> > 
> >> > As the data upload service is a hivemind service but not 
> a tapestry 
> >> > page, I do not have webRequest object. As Any suggestions?
> >> > 
> >> > Henry
> >> > --
> >> > View this message in context: 
> >> > http://www.nabble.com/Acquiring-session-not-in-a-tapestry-page
> >> > -error-tf2765973.html#a7713160
> >> > Sent from the Hivemind - User mailing list archive at Nabble.com.
> >> > 
> >> > 
> >> 
> > 
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/Acquiring-session-not-in-a-tapestry-page
> -error-tf2765973.html#a7715924
> Sent from the Hivemind - User mailing list archive at Nabble.com.
> 
> 

Mime
View raw message