You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ph...@digiatlas.org on 2008/07/25 10:55:23 UTC

Re: [T5]: Hibernate question - session is null

I'm using Eclipse. The XML config appears in target/classes and  
appears to be in the classpath.

I'm afraid I'm rather new to Tap 5 and also to Hibernate. I'm just  
following what is in the Tutorial. Unfortunately the session is still  
coming out as null.

Is there anywhere I can see that Tapestry is actually using Hibernate  
as a service?  I get the following in the console when I start my  
application:

...
             HibernateEntityPackageManager: DEFINED
                   HibernateSessionManager: DEFINED
                    HibernateSessionSource: DEFINED
             HibernateTransactionDecorator: DEFINED
...



Quoting Andreas Andreou <an...@gmail.com>:

> Perhaps hibernate.cfg.xml isn't in your runtime classpath?
> Are you sure your IDE includes it to the output?
>
> On Thu, Jul 24, 2008 at 6:09 PM,  <ph...@digiatlas.org> wrote:
>> I am following the tutorial at
>>
>> http://tapestry.apache.org/tapestry5/tutorial1/forms2.html
>>
>> but I find that the session (supposedly injected) is null. I'm not sure how
>> to proceed.
>>
>> Could someone point me to documents/better tutorials on how to use Tapestry
>> with Hibernate?
>>
>> Thanks,
>> p.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - thank you!

Posted by ph...@digiatlas.org.
Ok. Great gadzooks!  Now I see. Thanks to you and Sven.

(I knew this was going to be obvious once pointed out!)

p.


Quoting 9902468 <vi...@cerion.fi>:

>
> Yep, Injection works only in page and component classes that live the
> ordinary Page or component lifecycle, and are requested from the web. :)
>
> Move the session to a real page and have that util to take the session as
> parameter, or even better move your logic to service that a page can use.
> (SecurityService perhaps?)
>
>  - 99
>
>
> Sven Homburg wrote:
>>
>> its look like, that your Security class is only a helper class
>> and no page component.
>>
>> in such classes the @Inject annotation doesnt work
>>
>> 2008/7/28 <ph...@digiatlas.org>
>>
>>> Ok, I have just checked. I have mysql-connector-java-5.1.5.jar in the
>>> maven
>>> repository.
>>>
>>>
>>> Code is:
>>> -----------------------------------------
>>> package uk.bl.dlportal.pages.util;
>>>
>>> import java.util.List;
>>>
>>> import org.apache.tapestry5.ioc.annotations.Inject;
>>> import org.hibernate.Criteria;
>>> import org.hibernate.Query;
>>> import org.hibernate.Session;
>>>
>>>
>>> import uk.bl.dlportal.entities.User;
>>>
>>>
>>> public class Security
>>> {
>>>        @Inject
>>>    private Session session;
>>>
>>>        private final static Security security = new Security();
>>>
>>>
>>>        public User authenticate(String userName, String password)
>>>        {
>>>                System.out.println("SESSION ************************
>>> "+session);
>>>
>>>                Criteria c = session.createCriteria(User.class);
>>>
>>>                List result = c.list();
>>>
>>>                System.out.println("SESSION ************************
>>> "+session);
>>>
>>>                return null;
>>>        }
>>>
>>>        public static Security getSecurity()
>>>        {
>>>                return security;
>>>        }
>>> }
>>>
>>>
>>> Stack trace is:
>>> ------------------------------------
>>> 84.73% unrealized services (111/131)
>>>
>>> [INFO] mortbay.log Started SelectChannelConnector@0.0.0.0:8080
>>> [DEBUG] AppModule.TimingFilter Creating service 'TimingFilter'.
>>> [DEBUG] AppModule.TimingFilter Invoking method
>>> uk.bl.dlportal.services.AppModule.buildTimingFilter(Logger) (at
>>> AppModule.java:71).
>>> [INFO] AppModule.TimingFilter Request time: 4846 ms
>>> [INFO] AppModule.TimingFilter Request time: 0 ms
>>> [INFO] AppModule.TimingFilter Request time: 16 ms
>>> SESSION ************************ null
>>> [INFO] AppModule.TimingFilter Request time: 251 ms
>>> [ERROR] TapestryModule.RequestExceptionHandler Processing of request
>>> failed
>>> with uncaught
>>> exception: org.apache.tapestry5.runtime.ComponentEventException
>>> org.apache.tapestry5.runtime.ComponentEventException [at
>>> context:Index.tml,
>>> line 7,
>>> column 28]
>>>        at
>>>
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:67)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
>>>        at
>>>
>>> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>>>        at
>>> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
>>>        at
>>>
>>> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>>>        at
>>> org.apache.tapestry5.services.TapestryModule$37.handle(TapestryModule.java:1987)
>>>        at
>>>
>>> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>>>        at
>>>
>>> $ComponentEventRequestHandler_11b68bd500b.handle($ComponentEventRequestHandler_11b68bd500b.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:135)
>>>        at $Dispatcher_11b68bd500e.dispatch($Dispatcher_11b68bd500e.java)
>>>        at $Dispatcher_11b68bd5000.dispatch($Dispatcher_11b68bd5000.java)
>>>        at
>>> org.apache.tapestry5.services.TapestryModule$12.service(TapestryModule.java:938)
>>>        at uk.bl.dlportal.services.AppModule$1.service(AppModule.java:84)
>>>        at
>>> $RequestFilter_11b68bd4fff.service($RequestFilter_11b68bd4fff.java)
>>>        at
>>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
>>>        at
>>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>>        at
>>> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:586)
>>>        at
>>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>>>        at
>>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79)
>>>        at
>>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
>>>        at
>>>
>>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
>>>        at
>>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>>        at
>>> $RequestHandler_11b68bd4ff8.service($RequestHandler_11b68bd4ff8.java)
>>>        at
>>> org.apache.tapestry5.services.TapestryModule$11.service(TapestryModule.java:918)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>>>        at
>>>
>>> $HttpServletRequestFilter_11b68bd4ff7.service($HttpServletRequestFilter_11b68bd4ff7.java)
>>>        at
>>>
>>> $HttpServletRequestHandler_11b68bd4ff9.service($HttpServletRequestHandler_11b68bd4ff9.java)
>>>        at
>>>
>>> $HttpServletRequestHandler_11b68bd4ff6.service($HttpServletRequestHandler_11b68bd4ff6.java)
>>>        at
>>> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:168)
>>>        at
>>>
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>>        at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>>>        at
>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>>        at
>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>>        at
>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
>>>        at
>>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:404)
>>>        at
>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>>>        at org.mortbay.jetty.Server.handle(Server.java:324)
>>>        at
>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>>        at
>>> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
>>>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
>>>        at
>>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>>        at
>>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>>        at
>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>>        at
>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>>> Caused by: org.apache.tapestry5.runtime.ComponentEventException [at
>>> context:Index.tml,
>>> line 7, column 28]
>>>        at
>>>
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
>>>        at
>>>
>>> org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:182)
>>>        at
>>> org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:351)
>>>        at
>>>
>>> org.apache.tapestry5.corelib.components.Form$onAction$invocation_11b68bd8243.invokeAdvisedMethod(Form$onAction$invocation_11b68bd8243.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
>>>        at
>>> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
>>>        at
>>> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
>>>        at
>>>
>>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
>>>        at
>>> org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
>>>        at
>>> org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:872)
>>>        at
>>>
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
>>>        ... 50 more
>>> Caused by: java.lang.NullPointerException
>>>        at
>>> uk.bl.dlportal.pages.util.Security.authenticate(Security.java:26)
>>>        at uk.bl.dlportal.pages.Index.onSubmitFromLoginForm(Index.java:27)
>>>        at uk.bl.dlportal.pages.Index.dispatchComponentEvent(Index.java)
>>>        at
>>>
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:864)
>>>        at
>>>
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
>>>        ... 61 more
>>>
>>>
>>>
>>>
>>> Quoting 9902468 <vi...@cerion.fi>:
>>>
>>> [Hide Quoted Text]
>>>
>>>
>>> Check also that you have the mysql-connector-java-5.1.6.jar or similar in
>>> your libraries.
>>>
>>> I have the following list:
>>> FieldValidatorSource: DEFINED
>>>                                  FormDAO: DEFINED
>>>                              FormSupport: DEFINED
>>>                        FreeMarkerService: DEFINED
>>>                           FulfillmentDAO: DEFINED
>>>                         GoogleMapService: DEFINED
>>>            HibernateEntityPackageManager: DEFINED
>>>                  HibernateSessionManager: DEFINED
>>>                   HibernateSessionSource: DEFINED
>>>            HibernateTransactionDecorator: DEFINED
>>>                 HiddenFieldLocationRules: DEFINED
>>>                                 HiveMind: DEFINED
>>>                       HttpServletRequest: DEFINED
>>>                HttpServletRequestHandler: VIRTUAL
>>>                       IgnoredPathsFilter: DEFINED
>>>
>>> So that one should be ok. Is the page that you are testing with _really_
>>> calling session.something? Tapestry lazy loads everything so Hibernate is
>>> not really initialized without the call. Can we have the stack trace?
>>>
>>> - 99
>>>
>>>
>>>
>>> photos-4 wrote:
>>>
>>> Quoting 9902468 <vi...@cerion.fi>:
>>>
>>> Is the hibernate service initialized at all? When Tapestry starts it
>>> lists
>>> all known services, is Hibernate in that list?
>>>
>>> - 99
>>>
>>> It looks like it:
>>>
>>> ...
>>>                    FieldValidationSupport: DEFINED
>>>               FieldValidatorDefaultSource: DEFINED
>>>                      FieldValidatorSource: DEFINED
>>>                               FormSupport: DEFINED
>>>             HibernateEntityPackageManager: DEFINED
>>>                   HibernateSessionManager: DEFINED
>>>                    HibernateSessionSource: DEFINED
>>>             HibernateTransactionDecorator: DEFINED
>>>                  HiddenFieldLocationRules: DEFINED
>>>                        HttpServletRequest: DEFINED
>>>                 HttpServletRequestHandler: VIRTUAL
>>>                        IgnoredPathsFilter: DEFINED
>>>                         InjectionProvider: DEFINED
>>>                    InternalRequestGlobals: VIRTUAL
>>>                               LinkFactory: DEFINED
>>> ...
>>>
>>>
>>> I still haven't figured out what is going on. I see no evidence of
>>> Hibernate ever being called. Are any Hibernate services missing from
>>> the above list?
>>>
>>> p.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18685754.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>> --
>> with regards
>> Sven Homburg
>> http://tapestry5-components.googlecode.com
>> http://chenillekit.googlecode.com
>>
>>
>> -----
>> best regards
>> Sven
>>
>
> --
> View this message in context:   
> http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18686443.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by 9902468 <vi...@cerion.fi>.
Yep, Injection works only in page and component classes that live the
ordinary Page or component lifecycle, and are requested from the web. :)

Move the session to a real page and have that util to take the session as
parameter, or even better move your logic to service that a page can use.
(SecurityService perhaps?)

 - 99


Sven Homburg wrote:
> 
> its look like, that your Security class is only a helper class
> and no page component.
> 
> in such classes the @Inject annotation doesnt work
> 
> 2008/7/28 <ph...@digiatlas.org>
> 
>> Ok, I have just checked. I have mysql-connector-java-5.1.5.jar in the
>> maven
>> repository.
>>
>>
>> Code is:
>> -----------------------------------------
>> package uk.bl.dlportal.pages.util;
>>
>> import java.util.List;
>>
>> import org.apache.tapestry5.ioc.annotations.Inject;
>> import org.hibernate.Criteria;
>> import org.hibernate.Query;
>> import org.hibernate.Session;
>>
>>
>> import uk.bl.dlportal.entities.User;
>>
>>
>> public class Security
>> {
>>        @Inject
>>    private Session session;
>>
>>        private final static Security security = new Security();
>>
>>
>>        public User authenticate(String userName, String password)
>>        {
>>                System.out.println("SESSION ************************
>> "+session);
>>
>>                Criteria c = session.createCriteria(User.class);
>>
>>                List result = c.list();
>>
>>                System.out.println("SESSION ************************
>> "+session);
>>
>>                return null;
>>        }
>>
>>        public static Security getSecurity()
>>        {
>>                return security;
>>        }
>> }
>>
>>
>> Stack trace is:
>> ------------------------------------
>> 84.73% unrealized services (111/131)
>>
>> [INFO] mortbay.log Started SelectChannelConnector@0.0.0.0:8080
>> [DEBUG] AppModule.TimingFilter Creating service 'TimingFilter'.
>> [DEBUG] AppModule.TimingFilter Invoking method
>> uk.bl.dlportal.services.AppModule.buildTimingFilter(Logger) (at
>> AppModule.java:71).
>> [INFO] AppModule.TimingFilter Request time: 4846 ms
>> [INFO] AppModule.TimingFilter Request time: 0 ms
>> [INFO] AppModule.TimingFilter Request time: 16 ms
>> SESSION ************************ null
>> [INFO] AppModule.TimingFilter Request time: 251 ms
>> [ERROR] TapestryModule.RequestExceptionHandler Processing of request
>> failed
>> with uncaught
>> exception: org.apache.tapestry5.runtime.ComponentEventException
>> org.apache.tapestry5.runtime.ComponentEventException [at
>> context:Index.tml,
>> line 7,
>> column 28]
>>        at
>>
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
>>        at
>>
>> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:67)
>>        at
>>
>> org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
>>        at
>>
>> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>>        at
>> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
>>        at
>>
>> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>>        at
>> org.apache.tapestry5.services.TapestryModule$37.handle(TapestryModule.java:1987)
>>        at
>>
>> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>>        at
>>
>> $ComponentEventRequestHandler_11b68bd500b.handle($ComponentEventRequestHandler_11b68bd500b.java)
>>        at
>>
>> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:135)
>>        at $Dispatcher_11b68bd500e.dispatch($Dispatcher_11b68bd500e.java)
>>        at $Dispatcher_11b68bd5000.dispatch($Dispatcher_11b68bd5000.java)
>>        at
>> org.apache.tapestry5.services.TapestryModule$12.service(TapestryModule.java:938)
>>        at uk.bl.dlportal.services.AppModule$1.service(AppModule.java:84)
>>        at
>> $RequestFilter_11b68bd4fff.service($RequestFilter_11b68bd4fff.java)
>>        at
>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>        at
>>
>> org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
>>        at
>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>        at
>> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:586)
>>        at
>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>        at
>>
>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>>        at
>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>        at
>>
>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79)
>>        at
>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>        at
>>
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
>>        at
>>
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
>>        at
>>
>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
>>        at
>>
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
>>        at
>> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>>        at
>> $RequestHandler_11b68bd4ff8.service($RequestHandler_11b68bd4ff8.java)
>>        at
>> org.apache.tapestry5.services.TapestryModule$11.service(TapestryModule.java:918)
>>        at
>>
>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>>        at
>>
>> $HttpServletRequestFilter_11b68bd4ff7.service($HttpServletRequestFilter_11b68bd4ff7.java)
>>        at
>>
>> $HttpServletRequestHandler_11b68bd4ff9.service($HttpServletRequestHandler_11b68bd4ff9.java)
>>        at
>>
>> $HttpServletRequestHandler_11b68bd4ff6.service($HttpServletRequestHandler_11b68bd4ff6.java)
>>        at
>> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:168)
>>        at
>>
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>        at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>>        at
>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>        at
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>        at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
>>        at
>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:404)
>>        at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>>        at org.mortbay.jetty.Server.handle(Server.java:324)
>>        at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>        at
>> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
>>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
>>        at
>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>        at
>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>        at
>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>>        at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>> Caused by: org.apache.tapestry5.runtime.ComponentEventException [at
>> context:Index.tml,
>> line 7, column 28]
>>        at
>>
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
>>        at
>>
>> org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:182)
>>        at
>> org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:351)
>>        at
>>
>> org.apache.tapestry5.corelib.components.Form$onAction$invocation_11b68bd8243.invokeAdvisedMethod(Form$onAction$invocation_11b68bd8243.java)
>>        at
>>
>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
>>        at
>> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
>>        at
>> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
>>        at
>>
>> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
>>        at
>> org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
>>        at
>> org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
>>        at
>>
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:872)
>>        at
>>
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
>>        ... 50 more
>> Caused by: java.lang.NullPointerException
>>        at
>> uk.bl.dlportal.pages.util.Security.authenticate(Security.java:26)
>>        at uk.bl.dlportal.pages.Index.onSubmitFromLoginForm(Index.java:27)
>>        at uk.bl.dlportal.pages.Index.dispatchComponentEvent(Index.java)
>>        at
>>
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:864)
>>        at
>>
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
>>        ... 61 more
>>
>>
>>
>>
>> Quoting 9902468 <vi...@cerion.fi>:
>>
>> [Hide Quoted Text]
>>
>>
>> Check also that you have the mysql-connector-java-5.1.6.jar or similar in
>> your libraries.
>>
>> I have the following list:
>> FieldValidatorSource: DEFINED
>>                                  FormDAO: DEFINED
>>                              FormSupport: DEFINED
>>                        FreeMarkerService: DEFINED
>>                           FulfillmentDAO: DEFINED
>>                         GoogleMapService: DEFINED
>>            HibernateEntityPackageManager: DEFINED
>>                  HibernateSessionManager: DEFINED
>>                   HibernateSessionSource: DEFINED
>>            HibernateTransactionDecorator: DEFINED
>>                 HiddenFieldLocationRules: DEFINED
>>                                 HiveMind: DEFINED
>>                       HttpServletRequest: DEFINED
>>                HttpServletRequestHandler: VIRTUAL
>>                       IgnoredPathsFilter: DEFINED
>>
>> So that one should be ok. Is the page that you are testing with _really_
>> calling session.something? Tapestry lazy loads everything so Hibernate is
>> not really initialized without the call. Can we have the stack trace?
>>
>> - 99
>>
>>
>>
>> photos-4 wrote:
>>
>> Quoting 9902468 <vi...@cerion.fi>:
>>
>> Is the hibernate service initialized at all? When Tapestry starts it
>> lists
>> all known services, is Hibernate in that list?
>>
>> - 99
>>
>> It looks like it:
>>
>> ...
>>                    FieldValidationSupport: DEFINED
>>               FieldValidatorDefaultSource: DEFINED
>>                      FieldValidatorSource: DEFINED
>>                               FormSupport: DEFINED
>>             HibernateEntityPackageManager: DEFINED
>>                   HibernateSessionManager: DEFINED
>>                    HibernateSessionSource: DEFINED
>>             HibernateTransactionDecorator: DEFINED
>>                  HiddenFieldLocationRules: DEFINED
>>                        HttpServletRequest: DEFINED
>>                 HttpServletRequestHandler: VIRTUAL
>>                        IgnoredPathsFilter: DEFINED
>>                         InjectionProvider: DEFINED
>>                    InternalRequestGlobals: VIRTUAL
>>                               LinkFactory: DEFINED
>> ...
>>
>>
>> I still haven't figured out what is going on. I see no evidence of
>> Hibernate ever being called. Are any Hibernate services missing from
>> the above list?
>>
>> p.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18685754.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> -- 
> with regards
> Sven Homburg
> http://tapestry5-components.googlecode.com
> http://chenillekit.googlecode.com
> 
> 
> -----
> best regards
> Sven
> 

-- 
View this message in context: http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18686443.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by Sven Homburg <ho...@googlemail.com>.
its look like, that your Security class is only a helper class
and no page component.

in such classes the @Inject annotation doesnt work

2008/7/28 <ph...@digiatlas.org>

> Ok, I have just checked. I have mysql-connector-java-5.1.5.jar in the maven
> repository.
>
>
> Code is:
> -----------------------------------------
> package uk.bl.dlportal.pages.util;
>
> import java.util.List;
>
> import org.apache.tapestry5.ioc.annotations.Inject;
> import org.hibernate.Criteria;
> import org.hibernate.Query;
> import org.hibernate.Session;
>
>
> import uk.bl.dlportal.entities.User;
>
>
> public class Security
> {
>        @Inject
>    private Session session;
>
>        private final static Security security = new Security();
>
>
>        public User authenticate(String userName, String password)
>        {
>                System.out.println("SESSION ************************
> "+session);
>
>                Criteria c = session.createCriteria(User.class);
>
>                List result = c.list();
>
>                System.out.println("SESSION ************************
> "+session);
>
>                return null;
>        }
>
>        public static Security getSecurity()
>        {
>                return security;
>        }
> }
>
>
> Stack trace is:
> ------------------------------------
> 84.73% unrealized services (111/131)
>
> [INFO] mortbay.log Started SelectChannelConnector@0.0.0.0:8080
> [DEBUG] AppModule.TimingFilter Creating service 'TimingFilter'.
> [DEBUG] AppModule.TimingFilter Invoking method
> uk.bl.dlportal.services.AppModule.buildTimingFilter(Logger) (at
> AppModule.java:71).
> [INFO] AppModule.TimingFilter Request time: 4846 ms
> [INFO] AppModule.TimingFilter Request time: 0 ms
> [INFO] AppModule.TimingFilter Request time: 16 ms
> SESSION ************************ null
> [INFO] AppModule.TimingFilter Request time: 251 ms
> [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed
> with uncaught
> exception: org.apache.tapestry5.runtime.ComponentEventException
> org.apache.tapestry5.runtime.ComponentEventException [at context:Index.tml,
> line 7,
> column 28]
>        at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
>        at
>
> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:67)
>        at
>
> org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
>        at
>
> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>        at
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
>        at
>
> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>        at
> org.apache.tapestry5.services.TapestryModule$37.handle(TapestryModule.java:1987)
>        at
>
> $ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
>        at
>
> $ComponentEventRequestHandler_11b68bd500b.handle($ComponentEventRequestHandler_11b68bd500b.java)
>        at
>
> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:135)
>        at $Dispatcher_11b68bd500e.dispatch($Dispatcher_11b68bd500e.java)
>        at $Dispatcher_11b68bd5000.dispatch($Dispatcher_11b68bd5000.java)
>        at
> org.apache.tapestry5.services.TapestryModule$12.service(TapestryModule.java:938)
>        at uk.bl.dlportal.services.AppModule$1.service(AppModule.java:84)
>        at
> $RequestFilter_11b68bd4fff.service($RequestFilter_11b68bd4fff.java)
>        at
> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>        at
>
> org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
>        at
> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>        at
> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:586)
>        at
> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>        at
>
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>        at
> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>        at
>
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79)
>        at
> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>        at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
>        at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
>        at
>
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
>        at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
>        at
> $RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
>        at
> $RequestHandler_11b68bd4ff8.service($RequestHandler_11b68bd4ff8.java)
>        at
> org.apache.tapestry5.services.TapestryModule$11.service(TapestryModule.java:918)
>        at
>
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>        at
>
> $HttpServletRequestFilter_11b68bd4ff7.service($HttpServletRequestFilter_11b68bd4ff7.java)
>        at
>
> $HttpServletRequestHandler_11b68bd4ff9.service($HttpServletRequestHandler_11b68bd4ff9.java)
>        at
>
> $HttpServletRequestHandler_11b68bd4ff6.service($HttpServletRequestHandler_11b68bd4ff6.java)
>        at
> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:168)
>        at
>
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>        at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
>        at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:404)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>        at org.mortbay.jetty.Server.handle(Server.java:324)
>        at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>        at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
>        at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
> Caused by: org.apache.tapestry5.runtime.ComponentEventException [at
> context:Index.tml,
> line 7, column 28]
>        at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
>        at
>
> org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:182)
>        at
> org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:351)
>        at
>
> org.apache.tapestry5.corelib.components.Form$onAction$invocation_11b68bd8243.invokeAdvisedMethod(Form$onAction$invocation_11b68bd8243.java)
>        at
>
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
>        at
> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
>        at
> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
>        at
>
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
>        at org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
>        at
> org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
>        at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:872)
>        at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
>        ... 50 more
> Caused by: java.lang.NullPointerException
>        at uk.bl.dlportal.pages.util.Security.authenticate(Security.java:26)
>        at uk.bl.dlportal.pages.Index.onSubmitFromLoginForm(Index.java:27)
>        at uk.bl.dlportal.pages.Index.dispatchComponentEvent(Index.java)
>        at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:864)
>        at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
>        ... 61 more
>
>
>
>
> Quoting 9902468 <vi...@cerion.fi>:
>
> [Hide Quoted Text]
>
>
> Check also that you have the mysql-connector-java-5.1.6.jar or similar in
> your libraries.
>
> I have the following list:
> FieldValidatorSource: DEFINED
>                                  FormDAO: DEFINED
>                              FormSupport: DEFINED
>                        FreeMarkerService: DEFINED
>                           FulfillmentDAO: DEFINED
>                         GoogleMapService: DEFINED
>            HibernateEntityPackageManager: DEFINED
>                  HibernateSessionManager: DEFINED
>                   HibernateSessionSource: DEFINED
>            HibernateTransactionDecorator: DEFINED
>                 HiddenFieldLocationRules: DEFINED
>                                 HiveMind: DEFINED
>                       HttpServletRequest: DEFINED
>                HttpServletRequestHandler: VIRTUAL
>                       IgnoredPathsFilter: DEFINED
>
> So that one should be ok. Is the page that you are testing with _really_
> calling session.something? Tapestry lazy loads everything so Hibernate is
> not really initialized without the call. Can we have the stack trace?
>
> - 99
>
>
>
> photos-4 wrote:
>
> Quoting 9902468 <vi...@cerion.fi>:
>
> Is the hibernate service initialized at all? When Tapestry starts it
> lists
> all known services, is Hibernate in that list?
>
> - 99
>
> It looks like it:
>
> ...
>                    FieldValidationSupport: DEFINED
>               FieldValidatorDefaultSource: DEFINED
>                      FieldValidatorSource: DEFINED
>                               FormSupport: DEFINED
>             HibernateEntityPackageManager: DEFINED
>                   HibernateSessionManager: DEFINED
>                    HibernateSessionSource: DEFINED
>             HibernateTransactionDecorator: DEFINED
>                  HiddenFieldLocationRules: DEFINED
>                        HttpServletRequest: DEFINED
>                 HttpServletRequestHandler: VIRTUAL
>                        IgnoredPathsFilter: DEFINED
>                         InjectionProvider: DEFINED
>                    InternalRequestGlobals: VIRTUAL
>                               LinkFactory: DEFINED
> ...
>
>
> I still haven't figured out what is going on. I see no evidence of
> Hibernate ever being called. Are any Hibernate services missing from
> the above list?
>
> p.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> --
> View this message in context:
> http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18685754.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
http://chenillekit.googlecode.com

Re: [T5]: Hibernate question - session is null

Posted by ph...@digiatlas.org.
Ok, I have just checked. I have mysql-connector-java-5.1.5.jar in the  
maven repository.


Code is:
-----------------------------------------
package uk.bl.dlportal.pages.util;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;


import uk.bl.dlportal.entities.User;


public class Security
{
         @Inject
     private Session session;

         private final static Security security = new Security();


         public User authenticate(String userName, String password)
         {
                 System.out.println("SESSION ************************  
"+session);

                 Criteria c = session.createCriteria(User.class);

                 List result = c.list();

                 System.out.println("SESSION ************************  
"+session);

                 return null;
         }

         public static Security getSecurity()
         {
                 return security;
         }
}


Stack trace is:
------------------------------------
84.73% unrealized services (111/131)

[INFO] mortbay.log Started SelectChannelConnector@0.0.0.0:8080
[DEBUG] AppModule.TimingFilter Creating service 'TimingFilter'.
[DEBUG] AppModule.TimingFilter Invoking method
uk.bl.dlportal.services.AppModule.buildTimingFilter(Logger) (at  
AppModule.java:71).
[INFO] AppModule.TimingFilter Request time: 4846 ms
[INFO] AppModule.TimingFilter Request time: 0 ms
[INFO] AppModule.TimingFilter Request time: 16 ms
SESSION ************************ null
[INFO] AppModule.TimingFilter Request time: 251 ms
[ERROR] TapestryModule.RequestExceptionHandler Processing of request  
failed with uncaught
exception: org.apache.tapestry5.runtime.ComponentEventException
org.apache.tapestry5.runtime.ComponentEventException [at  
context:Index.tml, line 7,
column 28]
         at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
         at
org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:67)
         at
org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
         at
$ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
         at  
org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
         at
$ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
         at  
org.apache.tapestry5.services.TapestryModule$37.handle(TapestryModule.java:1987)
         at
$ComponentEventRequestHandler_11b68bd5062.handle($ComponentEventRequestHandler_11b68bd5062.java)
         at
$ComponentEventRequestHandler_11b68bd500b.handle($ComponentEventRequestHandler_11b68bd500b.java)
         at
org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:135)
         at $Dispatcher_11b68bd500e.dispatch($Dispatcher_11b68bd500e.java)
         at $Dispatcher_11b68bd5000.dispatch($Dispatcher_11b68bd5000.java)
         at  
org.apache.tapestry5.services.TapestryModule$12.service(TapestryModule.java:938)
         at uk.bl.dlportal.services.AppModule$1.service(AppModule.java:84)
         at $RequestFilter_11b68bd4fff.service($RequestFilter_11b68bd4fff.java)
         at  
$RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
         at
org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
         at  
$RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
         at  
org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:586)
         at  
$RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
         at
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
         at  
$RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
         at
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79)
         at  
$RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
         at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
         at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
         at
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
         at
org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
         at  
$RequestHandler_11b68bd5001.service($RequestHandler_11b68bd5001.java)
         at  
$RequestHandler_11b68bd4ff8.service($RequestHandler_11b68bd4ff8.java)
         at  
org.apache.tapestry5.services.TapestryModule$11.service(TapestryModule.java:918)
         at
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
         at
$HttpServletRequestFilter_11b68bd4ff7.service($HttpServletRequestFilter_11b68bd4ff7.java)
         at
$HttpServletRequestHandler_11b68bd4ff9.service($HttpServletRequestHandler_11b68bd4ff9.java)
         at
$HttpServletRequestHandler_11b68bd4ff6.service($HttpServletRequestHandler_11b68bd4ff6.java)
         at  
org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:168)
         at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
         at  
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
         at  
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
         at  
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
         at  
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
         at  
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:404)
         at  
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
         at org.mortbay.jetty.Server.handle(Server.java:324)
         at  
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
         at  
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
         at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
         at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
         at  
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
         at  
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
Caused by: org.apache.tapestry5.runtime.ComponentEventException [at  
context:Index.tml,
line 7, column 28]
         at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
         at
org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:182)
         at  
org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:351)
         at
org.apache.tapestry5.corelib.components.Form$onAction$invocation_11b68bd8243.invokeAdvisedMethod(Form$onAction$invocation_11b68bd8243.java)
         at
org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
         at  
org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
         at  
org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
         at
org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
         at org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
         at  
org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
         at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:872)
         at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
         ... 50 more
Caused by: java.lang.NullPointerException
         at uk.bl.dlportal.pages.util.Security.authenticate(Security.java:26)
         at uk.bl.dlportal.pages.Index.onSubmitFromLoginForm(Index.java:27)
         at uk.bl.dlportal.pages.Index.dispatchComponentEvent(Index.java)
         at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:864)
         at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1025)
         ... 61 more




Quoting 9902468 <vi...@cerion.fi>:

[Hide Quoted Text]

Check also that you have the mysql-connector-java-5.1.6.jar or similar in
your libraries.

I have the following list:
FieldValidatorSource: DEFINED
                                   FormDAO: DEFINED
                               FormSupport: DEFINED
                         FreeMarkerService: DEFINED
                            FulfillmentDAO: DEFINED
                          GoogleMapService: DEFINED
             HibernateEntityPackageManager: DEFINED
                   HibernateSessionManager: DEFINED
                    HibernateSessionSource: DEFINED
             HibernateTransactionDecorator: DEFINED
                  HiddenFieldLocationRules: DEFINED
                                  HiveMind: DEFINED
                        HttpServletRequest: DEFINED
                 HttpServletRequestHandler: VIRTUAL
                        IgnoredPathsFilter: DEFINED

So that one should be ok. Is the page that you are testing with _really_
calling session.something? Tapestry lazy loads everything so Hibernate is
not really initialized without the call. Can we have the stack trace?

- 99



photos-4 wrote:

Quoting 9902468 <vi...@cerion.fi>:

Is the hibernate service initialized at all? When Tapestry starts it
lists
all known services, is Hibernate in that list?

- 99

It looks like it:

...
                     FieldValidationSupport: DEFINED
                FieldValidatorDefaultSource: DEFINED
                       FieldValidatorSource: DEFINED
                                FormSupport: DEFINED
              HibernateEntityPackageManager: DEFINED
                    HibernateSessionManager: DEFINED
                     HibernateSessionSource: DEFINED
              HibernateTransactionDecorator: DEFINED
                   HiddenFieldLocationRules: DEFINED
                         HttpServletRequest: DEFINED
                  HttpServletRequestHandler: VIRTUAL
                         IgnoredPathsFilter: DEFINED
                          InjectionProvider: DEFINED
                     InternalRequestGlobals: VIRTUAL
                                LinkFactory: DEFINED
...


I still haven't figured out what is going on. I see no evidence of
Hibernate ever being called. Are any Hibernate services missing from
the above list?

p.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



--
View this message in context:
http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18685754.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by 9902468 <vi...@cerion.fi>.
Check also that you have the mysql-connector-java-5.1.6.jar or similar in
your libraries.

I have the following list:
FieldValidatorSource: DEFINED
                                  FormDAO: DEFINED
                              FormSupport: DEFINED
                        FreeMarkerService: DEFINED
                           FulfillmentDAO: DEFINED
                         GoogleMapService: DEFINED
            HibernateEntityPackageManager: DEFINED
                  HibernateSessionManager: DEFINED
                   HibernateSessionSource: DEFINED
            HibernateTransactionDecorator: DEFINED
                 HiddenFieldLocationRules: DEFINED
                                 HiveMind: DEFINED
                       HttpServletRequest: DEFINED
                HttpServletRequestHandler: VIRTUAL
                       IgnoredPathsFilter: DEFINED

So that one should be ok. Is the page that you are testing with _really_
calling session.something? Tapestry lazy loads everything so Hibernate is
not really initialized without the call. Can we have the stack trace?

 - 99



photos-4 wrote:
> 
> Quoting 9902468 <vi...@cerion.fi>:
> 
>>
>> Is the hibernate service initialized at all? When Tapestry starts it
>> lists
>> all known services, is Hibernate in that list?
>>
>>  - 99
> 
> 
> It looks like it:
> 
> ...
>                     FieldValidationSupport: DEFINED
>                FieldValidatorDefaultSource: DEFINED
>                       FieldValidatorSource: DEFINED
>                                FormSupport: DEFINED
>              HibernateEntityPackageManager: DEFINED
>                    HibernateSessionManager: DEFINED
>                     HibernateSessionSource: DEFINED
>              HibernateTransactionDecorator: DEFINED
>                   HiddenFieldLocationRules: DEFINED
>                         HttpServletRequest: DEFINED
>                  HttpServletRequestHandler: VIRTUAL
>                         IgnoredPathsFilter: DEFINED
>                          InjectionProvider: DEFINED
>                     InternalRequestGlobals: VIRTUAL
>                                LinkFactory: DEFINED
> ...
> 
> 
> I still haven't figured out what is going on. I see no evidence of  
> Hibernate ever being called. Are any Hibernate services missing from  
> the above list?
> 
> p.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18685754.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by ph...@digiatlas.org.
Quoting 9902468 <vi...@cerion.fi>:

>
> Is the hibernate service initialized at all? When Tapestry starts it lists
> all known services, is Hibernate in that list?
>
>  - 99


It looks like it:

...
                    FieldValidationSupport: DEFINED
               FieldValidatorDefaultSource: DEFINED
                      FieldValidatorSource: DEFINED
                               FormSupport: DEFINED
             HibernateEntityPackageManager: DEFINED
                   HibernateSessionManager: DEFINED
                    HibernateSessionSource: DEFINED
             HibernateTransactionDecorator: DEFINED
                  HiddenFieldLocationRules: DEFINED
                        HttpServletRequest: DEFINED
                 HttpServletRequestHandler: VIRTUAL
                        IgnoredPathsFilter: DEFINED
                         InjectionProvider: DEFINED
                    InternalRequestGlobals: VIRTUAL
                               LinkFactory: DEFINED
...


I still haven't figured out what is going on. I see no evidence of  
Hibernate ever being called. Are any Hibernate services missing from  
the above list?

p.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by 9902468 <vi...@cerion.fi>.
Is the hibernate service initialized at all? When Tapestry starts it lists
all known services, is Hibernate in that list?

 - 99


photos-4 wrote:
> 
> Thanks for your help, but so far no joy:
> 
> Quoting 9902468 <vi...@cerion.fi>:
> 
>> And of course, check that you have Hibernate and hibernate  
>> annotation in your >libraries, they are NOT included automatically  
>> by maven if maven is used.
> 
> The libraries appear in my repository and appear under "sources" in  
> the Eclipse Run Configuration.
> 
> 
>>
>> Tapestry should be quite verbose about hibernate if tapestry is
>> configured to
>> run in debug mode:
>>
>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html
>>
>> add:
>>
> 
> I placed -Dtapestry.production-mode=false on the command line, which,  
> according to the docs, does the same thing.
> 
> I see no output about Hibernate at all. It never gets mentioned...
> 
> 
>> Also see that your entities are in correct place (same root package as
>> pages
>> and components, in entities package.)
> 
> src/main/java/uk.bl.dlportal.entities
> src/main/java/uk.bl.dlportal.components
> src/main/java/uk.bl.dlportal.pages
> 
> looks ok to me.
> 
> 
>> Also perhaps use org.hibernate.dialect.MySQLInnoDBDialect to support
>> foreign
>> keys? (Change to hibernate config.)
>>
>> You should be able to see that Hibernate starts in the logs and maps User
>> etc. classes.
>>
>> Remember to configure your Log4J or what ever logging u use to debug.
> 
> I added some lines to log4j.properties to turn on hibernate logging  
> ("debug"), but I see no output - just the usual Tapestry debug output  
> that I've seen before.
> 
> I'm really stumped... :-(  Hibernate never gets called and yet  
> everything appears to be in place.
> 
> p.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18684648.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by Mark Weissenberg <mw...@startext.de>.
Hi,

I also had some trouble configuring hibernate, my session was also null.

After searching for a while I found this tutorial:
http://linuxboy.javaeye.com/blog/68311


Since I dont use a DAO, my code looks something like the following.


my db entity:
...

import org.hibernate.Session;

@Entity
@Table(name = "EVENT")
public class EventDBEntity {
    public EventDBEntity() {}
    public EventDBEntity(Session session) {_session = session;}
    @Transient
    private Session _session;
    // more stuff here.. methods to access the db
...


in my appmodule.java:

...

    public static void bind(ServiceBinder binder)
    {
        binder.bind(TourDBEntity.class);
    }
...


then I call an @Inject on the db-entity:
...
    // db entity object
    @Inject
    private EventDBEntity _dbEntity;

    // now tapestry injects the hibernate session in my _dbEntity
...    
    
Hope this helps!

Greetings, Mark

-- 
Mark Weißenberg
Tel. +49 228 9599630
startext Unternehmensberatung GmbH
Kennedyallee 2, D-53175 Bonn
Geschäftsführer Paul Bantzer, HRB Bonn 2741
Sitz der Gesellschaft: Bonn

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


AW: [T5] Strange Tomcat Behavior I Can Not Explain

Posted by Martin Kersten <Ma...@mercateo.com>.
I thought that this issue was overcome by later versions. Never done
So and it worked correctly for quite some time... . Can someone verify
That this issue is still valid?


Cheers,

Martin

PS: Renat thanks for the answer, I will give it a try! :-)

-----Ursprüngliche Nachricht-----
Von: Renat Zubairov [mailto:renat.zubairov@gmail.com] 
Gesendet: Sonntag, 27. Juli 2008 12:07
An: Tapestry users
Betreff: Re: [T5] Strange Tomcat Behavior I Can Not Explain

Hi

If I remember correctly there was some tricks when T5 application is
deployed on Tomcat, namely application
classes should be put as JAR file inside the WEB-INF/lib and not to
the WEB-INF/classes

May be that's the issue.

Renat

2008/7/25 Martin Kersten <Ma...@mercateo.com>:
> Hi There,
>
>   I encounter a strange Tomcat (6.0.14) behavior. When deploying my
> Tapestry web-application (5.0.13), Tomcat tells me that pages are
> not available unless I specify the root-page without context first.
> Just an Example to be more illustrative:
>
> 1. Deploy myApp
> 2. Visit Page /myApp/view/12345 -> Tomcat: Resource not Found
>  (12345 is A document ID in this example and becomes the
> activation-context)
> 3. Visit Page /myApp/view/ -> Found
> 4. Visit Page /myApp/view/12345 again -> Found and the correct document
> is send
>
> Why do I have to use the exact page path without context to
> 'initialize'(?)
> The page before using it with context? Has anyone seen such thing
> before?
> My local tomcat does not behave this way. Any Ideas where to look at?
>
>
> Cheers,
>
> Martin (Kersten)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Best regards,
Renat Zubairov

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] Strange Tomcat Behavior I Can Not Explain

Posted by Renat Zubairov <re...@gmail.com>.
Hi

If I remember correctly there was some tricks when T5 application is
deployed on Tomcat, namely application
classes should be put as JAR file inside the WEB-INF/lib and not to
the WEB-INF/classes

May be that's the issue.

Renat

2008/7/25 Martin Kersten <Ma...@mercateo.com>:
> Hi There,
>
>   I encounter a strange Tomcat (6.0.14) behavior. When deploying my
> Tapestry web-application (5.0.13), Tomcat tells me that pages are
> not available unless I specify the root-page without context first.
> Just an Example to be more illustrative:
>
> 1. Deploy myApp
> 2. Visit Page /myApp/view/12345 -> Tomcat: Resource not Found
>  (12345 is A document ID in this example and becomes the
> activation-context)
> 3. Visit Page /myApp/view/ -> Found
> 4. Visit Page /myApp/view/12345 again -> Found and the correct document
> is send
>
> Why do I have to use the exact page path without context to
> 'initialize'(?)
> The page before using it with context? Has anyone seen such thing
> before?
> My local tomcat does not behave this way. Any Ideas where to look at?
>
>
> Cheers,
>
> Martin (Kersten)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Best regards,
Renat Zubairov

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


[T5] Strange Tomcat Behavior I Can Not Explain

Posted by Martin Kersten <Ma...@mercateo.com>.
Hi There,

   I encounter a strange Tomcat (6.0.14) behavior. When deploying my
Tapestry web-application (5.0.13), Tomcat tells me that pages are 
not available unless I specify the root-page without context first. 
Just an Example to be more illustrative:

1. Deploy myApp
2. Visit Page /myApp/view/12345 -> Tomcat: Resource not Found 
  (12345 is A document ID in this example and becomes the
activation-context)
3. Visit Page /myApp/view/ -> Found
4. Visit Page /myApp/view/12345 again -> Found and the correct document
is send

Why do I have to use the exact page path without context to
'initialize'(?)
The page before using it with context? Has anyone seen such thing
before?
My local tomcat does not behave this way. Any Ideas where to look at?


Cheers,

Martin (Kersten)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by ph...@digiatlas.org.
Thanks for your help, but so far no joy:

Quoting 9902468 <vi...@cerion.fi>:

> And of course, check that you have Hibernate and hibernate  
> annotation in your >libraries, they are NOT included automatically  
> by maven if maven is used.

The libraries appear in my repository and appear under "sources" in  
the Eclipse Run Configuration.


>
> Tapestry should be quite verbose about hibernate if tapestry is configured to
> run in debug mode:
>
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html
>
> add:
>

I placed -Dtapestry.production-mode=false on the command line, which,  
according to the docs, does the same thing.

I see no output about Hibernate at all. It never gets mentioned...


> Also see that your entities are in correct place (same root package as pages
> and components, in entities package.)

src/main/java/uk.bl.dlportal.entities
src/main/java/uk.bl.dlportal.components
src/main/java/uk.bl.dlportal.pages

looks ok to me.


> Also perhaps use org.hibernate.dialect.MySQLInnoDBDialect to support foreign
> keys? (Change to hibernate config.)
>
> You should be able to see that Hibernate starts in the logs and maps User
> etc. classes.
>
> Remember to configure your Log4J or what ever logging u use to debug.

I added some lines to log4j.properties to turn on hibernate logging  
("debug"), but I see no output - just the usual Tapestry debug output  
that I've seen before.

I'm really stumped... :-(  Hibernate never gets called and yet  
everything appears to be in place.

p.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by 9902468 <vi...@cerion.fi>.
Tapestry should be quite verbose about hibernate if tapestry is configured to
run in debug mode:

http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html

add:

 //This is the time in seconds that Tapestry waits before checking if a file
is modified
        //Use a big number in production to imporve perfomance.
        configuration.add(SymbolConstants.FILE_CHECK_INTERVAL, "1 s"); //
600 to production!

        // The factory default is true but during the early stages of an
application
        // overriding to false is a good idea. In addition, this is often
overridden
        // on the command line as -Dtapestry.production-mode=false
        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");

to your AppModule.java's public static void
contributeApplicationDefaults(MappedConfiguration<String, String>
configuration) { method.

Also see that your entities are in correct place (same root package as pages
and components, in entities package.)

Also perhaps use org.hibernate.dialect.MySQLInnoDBDialect to support foreign
keys? (Change to hibernate config.)

You should be able to see that Hibernate starts in the logs and maps User
etc. classes.

Remember to configure your Log4J or what ever logging u use to debug.

 - 99


photos-4 wrote:
> 
> 
> I'm using Eclipse. The XML config appears in target/classes and  
> appears to be in the classpath.
> 
> I'm afraid I'm rather new to Tap 5 and also to Hibernate. I'm just  
> following what is in the Tutorial. Unfortunately the session is still  
> coming out as null.
> 
> Is there anywhere I can see that Tapestry is actually using Hibernate  
> as a service?  I get the following in the console when I start my  
> application:
> 
> ...
>              HibernateEntityPackageManager: DEFINED
>                    HibernateSessionManager: DEFINED
>                     HibernateSessionSource: DEFINED
>              HibernateTransactionDecorator: DEFINED
> ...
> 
> 
> 
> Quoting Andreas Andreou <an...@gmail.com>:
> 
>> Perhaps hibernate.cfg.xml isn't in your runtime classpath?
>> Are you sure your IDE includes it to the output?
>>
>> On Thu, Jul 24, 2008 at 6:09 PM,  <ph...@digiatlas.org> wrote:
>>> I am following the tutorial at
>>>
>>> http://tapestry.apache.org/tapestry5/tutorial1/forms2.html
>>>
>>> but I find that the session (supposedly injected) is null. I'm not sure
>>> how
>>> to proceed.
>>>
>>> Could someone point me to documents/better tutorials on how to use
>>> Tapestry
>>> with Hibernate?
>>>
>>> Thanks,
>>> p.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Tapestry / Tacos developer
>> Open Source / JEE Consulting
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18651481.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by 9902468 <vi...@cerion.fi>.
Check that the 

@Inject
private Session session;

session is org.hibernate.Session.

 - 99



photos-4 wrote:
> 
> 
> I'm using Eclipse. The XML config appears in target/classes and  
> appears to be in the classpath.
> 
> I'm afraid I'm rather new to Tap 5 and also to Hibernate. I'm just  
> following what is in the Tutorial. Unfortunately the session is still  
> coming out as null.
> 
> Is there anywhere I can see that Tapestry is actually using Hibernate  
> as a service?  I get the following in the console when I start my  
> application:
> 
> ...
>              HibernateEntityPackageManager: DEFINED
>                    HibernateSessionManager: DEFINED
>                     HibernateSessionSource: DEFINED
>              HibernateTransactionDecorator: DEFINED
> ...
> 
> 
> 
> Quoting Andreas Andreou <an...@gmail.com>:
> 
>> Perhaps hibernate.cfg.xml isn't in your runtime classpath?
>> Are you sure your IDE includes it to the output?
>>
>> On Thu, Jul 24, 2008 at 6:09 PM,  <ph...@digiatlas.org> wrote:
>>> I am following the tutorial at
>>>
>>> http://tapestry.apache.org/tapestry5/tutorial1/forms2.html
>>>
>>> but I find that the session (supposedly injected) is null. I'm not sure
>>> how
>>> to proceed.
>>>
>>> Could someone point me to documents/better tutorials on how to use
>>> Tapestry
>>> with Hibernate?
>>>
>>> Thanks,
>>> p.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Tapestry / Tacos developer
>> Open Source / JEE Consulting
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18650658.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by ph...@digiatlas.org.
Quoting 9902468 <vi...@cerion.fi>:


> Check that the
>
> @Inject
> private Session session;
>
> session is org.hibernate.Session.
>
> - 99




It is.  I notice that when I switch on the mysql log that no attempt  
is ever made to
access the db. Is there any kind of logging I can switch on from  
Tapestry (or maybe
Hibernate) to tell me what is going on?  (I am quite sure the xml file  
is correct and in
the classpath, so I am running out of ideas! Although it must be  
something simple as
these things usually are). session is always null when this code is run.

Code and XML below:


package uk.bl.dlportal.pages.util;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Query;
import org.hibernate.Session;

import uk.bl.dlportal.entities.User;


public class Security
{
         @Inject
         private Session session;

         private final static Security security = new Security();


         public User authenticate(String userName, String password)
         {
                 System.out.println("SESSION ************************  
"+session);

                 List result = session.createCriteria(User.class).list();

                 return null;
         }

         public static Security getSecurity()
         {
                 return security;
         }
}



XML hibernate.cfg.xml is in src/main/resources:

<!DOCTYPE hibernate-configuration PUBLIC
         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
     <session-factory>
         <property
name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
         <property
name="hibernate.connection.url">jdbc:mysql://localhost:3306/dlportal</property>
         <property  
name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
         <property name="hibernate.connection.username">root</property>
         <property name="hibernate.connection.password">admin</property>
         <property name="hbm2ddl.auto">update</property>
         <property name="hibernate.show_sql">true</property>
         <property name="hibernate.format_sql">true</property>
     </session-factory>
</hibernate-configuration>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: Hibernate question - session is null

Posted by 9902468 <vi...@cerion.fi>.
And of course, check that you have Hibernate and hibernate annotation in your
libraries, they are NOT included automatically by maven if maven is used.

 - 99


photos-4 wrote:
> 
> 
> I'm using Eclipse. The XML config appears in target/classes and  
> appears to be in the classpath.
> 
> I'm afraid I'm rather new to Tap 5 and also to Hibernate. I'm just  
> following what is in the Tutorial. Unfortunately the session is still  
> coming out as null.
> 
> Is there anywhere I can see that Tapestry is actually using Hibernate  
> as a service?  I get the following in the console when I start my  
> application:
> 
> ...
>              HibernateEntityPackageManager: DEFINED
>                    HibernateSessionManager: DEFINED
>                     HibernateSessionSource: DEFINED
>              HibernateTransactionDecorator: DEFINED
> ...
> 
> 
> 
> Quoting Andreas Andreou <an...@gmail.com>:
> 
>> Perhaps hibernate.cfg.xml isn't in your runtime classpath?
>> Are you sure your IDE includes it to the output?
>>
>> On Thu, Jul 24, 2008 at 6:09 PM,  <ph...@digiatlas.org> wrote:
>>> I am following the tutorial at
>>>
>>> http://tapestry.apache.org/tapestry5/tutorial1/forms2.html
>>>
>>> but I find that the session (supposedly injected) is null. I'm not sure
>>> how
>>> to proceed.
>>>
>>> Could someone point me to documents/better tutorials on how to use
>>> Tapestry
>>> with Hibernate?
>>>
>>> Thanks,
>>> p.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Tapestry / Tacos developer
>> Open Source / JEE Consulting
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5-%3A-Hibernate-question-tp18634071p18651522.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org