Oh, sorry,
I think the Audit-Interceptor must be the culprit. I had the same
problem when adding a Message-Driven thingy into one of my projects.
You'll need to define a second instance of the SessionFactory, contrary
to what I told before, like this:
<service-point id="HibernateSessionFactory" parameters-occurs="none"
interface="org.apache.hivemind.ServiceImplementationFactory">
<invoke-factory model="singleton">
<construct autowire-services="false"
class="com.javaforge.honeycomb.hivemind.hibernate.HibernateSessionFactor
y"
initialize-method="init">
<configuration>
honeycomb.hibernate.HibernateSessionFactory
</configuration>
<service>hivemind.ShutdownCoordinator</service>
<service-id/>
<set property="updateSchema"
value="false"/>
<set property="transactionManager"
value="false"/>
</construct>
</invoke-factory>
<interceptor service-id="hivemind.LoggingInterceptor"/>
</service-point>
It's important to turn off autowiring otherwise HiveMind will
auto-inject the wrong AuditInterceptor Service. Of course, if you need
auditing, you can also configure a second instance of the interceptor
and wire it up explicitly.
hth, Marcus
> -----Original Message-----
> From: Henry Tong [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 06, 2006 11:18 AM
> To: [email protected]
> Subject: RE: Acquiring session not in a tapestry page error
>
>
> Dear Marcus,
>
> Thank you for your prompt reply. I am using Tapestry 4.0.2
> and Honeycomb 0.3.3. For testing purpose, I have changed the
> configuration file as follows.
>
> 1. Create another Hibernate Eager Load Session
> <service-point id='HibernateEagerLoadSession'
> interface='org.hibernate.Session'>
> <invoke-factory
> service-id='honeycomb.hibernate.HibernateSessionFactory'
> model='threaded'/>
> </service-point>
>
> 2. Create Dao Service (which extends
> AbstractPersistenceService) that use Hibernate EagerLoad Session
> <service-point id="GenericDbDao" interface="GenericDbDao">
> <invoke-factory>
> <construct class="impl.GenericDbDaoImpl">
>
> <service>HibernateEagerLoadSession</service>
> </construct>
> </invoke-factory>
> </service-point>
>
> 3. The web project use default honeycomb hibernate session
> and default honeycomb hibernate session factory.
>
> The same errors prompt. Any suggestions?
>
> ERROR! [Timer-0]
> org.hibernate.impl.SessionImpl.beforeTransactionCompletion(Ses
> sionImpl.java:399)
> >15> exception in interceptor beforeTransactionCompletion()
> java.lang.NullPointerException: Property 'webRequest' of
> <OuterProxy for
> tapestry.globals.RequestGlobals(org.apache.tapestry.services.R
> equestGlobals)>
> is null.
> at
> $WebRequest_10f574018b1._targetServiceProperty($WebRequest_10f
> 574018b1.java)
> at
> $WebRequest_10f574018b1.getSession($WebRequest_10f574018b1.java)
> at
> $WebRequest_10f57401872.getSession($WebRequest_10f57401872.java)
> at
> org.apache.tapestry.engine.state.SessionScopeManager.getSessio
> n(SessionScopeManager.java:48)
> at
> org.apache.tapestry.engine.state.SessionScopeManager.get(Sessi
> onScopeManager.java:64)
> at
> $StateObjectPersistenceManager_10f574018a9.get($StateObjectPer
> sistenceManager_10f574018a9.java)
> at
> org.apache.tapestry.engine.state.StateObjectManagerImpl.get(St
> ateObjectManagerImpl.java:50)
> at
> org.apache.tapestry.engine.state.ApplicationStateManagerImpl.g
> et(ApplicationStateManagerImpl.java:60)
> at
> $ApplicationStateManager_10f5740184a.get($ApplicationStateMana
> ger_10f5740184a.java)
> at
> $ApplicationStateManager_10f5740184b.get($ApplicationStateMana
> ger_10f5740184b.java)
> at
> com.javaforge.honeycomb.tapestry.ConversationManagerImpl.getCu
> rrentConversation(ConversationManagerImpl.java:59)
> at
> $ConversationManager_10f574018a0.getCurrentConversation($Conve
> rsationManager_10f574018a0.java)
> at
> $ConversationManager_10f5740189e.getCurrentConversation($Conve
> rsationManager_10f5740189e.java)
> at
> com.javaforge.honeycomb.tapestry.ConversationalClientStateStor
> age.retrieve(ConversationalClientStateStorage.java:26)
> at
> $ClientStateStorage_10f5740188f.retrieve($ClientStateStorage_1
> 0f5740188f.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(StatefulServi
> ceModel.java:211)
> at $Session_10f57401891._service($Session_10f57401891.java)
> at $Session_10f57401891.getSession($Session_10f57401891.java)
> at $Session_10f57401892.getSession($Session_10f57401892.java)
> at $Session_10f57401893.getSession($Session_10f57401893.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_10f5740188c.beforeTransactionCompletion($Intercep
> tor_10f5740188c.java)
> at
> $Interceptor_10f5740188d.beforeTransactionCompletion($Intercep
> tor_10f5740188d.java)
> at
> org.hibernate.impl.SessionImpl.beforeTransactionCompletion(Ses
> sionImpl.java:396)
> at
> org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(JDB
> CContext.java:202)
> at
> org.hibernate.transaction.JDBCTransaction.commit(JDBCTransacti
> on.java:111)
> at
> com.javaforge.honeycomb.service.AbstractPersistenceService.com
> mit(AbstractPersistenceService.java:61)
> at $GenericDao_10f5740189c.commit($GenericDao_10f5740189c.java)
> at
> pihk.pacconmini.server.service.jpop.impl.RecordUploadImpl.save
> OrUpdateRecord(RecordUploadImpl.java:78)
> at
> pihk.pacconmini.server.service.jpop.impl.RecordUploadImpl.uplo
> ad(RecordUploadImpl.java:45)
> at
> $RecordUpload_10f57401896.upload($RecordUpload_10f57401896.java)
> at
> pihk.pacconmini.server.service.jpop.impl.DataUploadImpl.startT
> oRun(DataUploadImpl.java:132)
> at
> pihk.pacconmini.server.service.jpop.impl.DataUploadImpl.run(Da
> taUploadImpl.java:73)
> at $DataUpload_10f57401818.run($DataUpload_10f57401818.java)
> at
> pihk.pacconmini.server.service.jpop.impl.DataReplicateImpl.pro
> cess(DataReplicateImpl.java:129)
> at
> pihk.pacconmini.server.service.jpop.impl.DataReplicateImpl$1.r
un(DataReplicateImpl.java:82)
> at java.util.TimerThread.mainLoop(Unknown Source)
> at java.util.TimerThread.run(Unknown Source)
>
> Henry
>
>
> Schulte Marcus wrote:
> >
> > Dear Henry,
> >
> > replying inline:
> >
> >> -----Original Message-----
> >> From: Henry Tong [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday, December 06, 2006 10:19 AM
> >> To: [email protected]
> >> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >> >> Sent: Wednesday, December 06, 2006 8:15 AM
> >> >> To: [email protected]
> >> >> 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:[EMAIL PROTECTED]
> >> >> > Sent: Wednesday, December 06, 2006 4:54 AM
> >> >> > To: [email protected]
> >> >> > 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.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Acquiring-session-not-in-a-tapestry-page
> -error-tf2765973.html#a7716730
> Sent from the Hivemind - User mailing list archive at Nabble.com.
>
>