Re: Issue with REST Sessions in Wicket-Shiro-Hibernate

2016-01-26 Thread MM_at_ANO
Hi.

Thank you a lot for answering.
Your suggestion helped me in solving the problem .
I also had to add an injection call in the WicketApplication getter, as
follows:

public static WicketApplication get() {
   Application application = Application.get();
   Injector.get().inject(application); 
   return (WicketApplication) application;
}

Without it, the getter kept on returning null.
Now I can easily access Session and Session factories without problem.
Once again thank you for your quick answer.
You help is much appreciated.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Issue-with-REST-Sessions-in-Wicket-Shiro-Hibernate-tp4673417p4673439.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Issue with REST Sessions in Wicket-Shiro-Hibernate

2016-01-25 Thread MM_at_ANO
Good Morning.

I'm currently working in a Wicket 6.19.0 and Hibernate 4.3.6 project with
Shiro authentication.
The code is very high level and I'm having troubles finding a solution for
my problem.
But first of all, let me explain the problem.

In the application there is a REST API service to obtain the information
about a certain User.
In this application there is a "WicketSession" class extending the
org.apache.wicket.Session.
This class is used to inject the SessionFactory, and thus allowing the
manipulation of DAO Implementations for the database, as so:

The Class:
...
WicketSession extends WebSession implements ISessionLogInfo {
@SpringBean(name = "sessionFactory")
private SessionFactory sessionFactory;

public static WicketSession get() {
return (WicketSession) Session.get();
}
...

The Web Application Context

...


${hibernate.show_sql}
${use_sql_comments}
${hibernate.format_sql}

${hibernate.cache.use_query_cache} 
${hibernate.cache.provider_class}

${hibernate.cache.region.factory_class}

${hibernate.cache.use_second_level_cache}
${hibernate.query.factory_class}
${hibernate.dialect}
${hibernate.auto_close_session}
${hibernate.jdbc.batch_size}
${hibernate.max_fetch_depth}




The Web Service:
...
UserDaoImpl dao = new UserDaoImpl(WicketSession.get().getSessionFactory());
...

When I call the web service I get a 500 error.
This error is due to a null pointer exception in WicketSession.get(), more
precisely in RequestCycle.get() (executed inside Session.get()).
If the web service is accessed one more time (in browser only) everything
works fine and the web service returns a JSON (as it is supposed to).
Yet if there is another access I get once again the 500 error.
And so on...

I have search many different solutions but nothing worked.
Do you have any idea of what's going on? Any help would be appreciated.

Sorry for my poor English.
Best Regards, Marina.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Issue-with-REST-Sessions-in-Wicket-Shiro-Hibernate-tp4673417.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org