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
    <bean id="sessionFactory" 
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
...
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="use_sql_comments">${use_sql_comments}</prop>
                <prop
key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="hibernate.cache.use_query_cache">
${hibernate.cache.use_query_cache} </prop>
                <prop
key="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>
                <prop key="hibernate.cache.region.factory_class">
${hibernate.cache.region.factory_class}</prop>
                <prop key="hibernate.cache.use_second_level_cache">
${hibernate.cache.use_second_level_cache}</prop>
                <prop
key="hibernate.query.factory_class">${hibernate.query.factory_class}</prop>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop
key="hibernate.auto_close_session">${hibernate.auto_close_session}</prop>
                <prop
key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
                <prop
key="hibernate.max_fetch_depth">${hibernate.max_fetch_depth}</prop>
            </props>
        </property>
    </bean>

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

Reply via email to