Hi,

I'm going to turn crazy in trying to implements the full stack.

By now, it's seems done, but when I run into a service, I have a
"Attempting to execute an operation on a closed EntityManager".
I use the integration sample from 
http://blog.yanivkessler.com/2010/05/wicket-and-guice-alternate-route.html
and I need help, please, I don't understand why this append.

Here is my web.xml :
        <filter>
                <filter-name>guiceFilter</filter-name>
                
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
        </filter>
        <filter-mapping>
                <filter-name>guiceFilter</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>
        <listener>
                <listener-class>mypackage.bootstrap.Bootstrap</listener-class>
        </listener>

The bootstrap :
public class Bootstrap extends GuiceServletContextListener {
        @Override
        protected Injector getInjector() {
                return Guice.createInjector(new WebModule());
        }
}

The WebModule :
public class WebModule extends ServletModule {

        @Override
        protected void configureServlets() {
                install(new JpaPersistModule("lbx"));
                filter("/*").through(PersistFilter.class);

                
bind(WebApplication.class).toProvider(WicketGuiceAppProvider.class);

                Map<String, String> params = new HashMap<String, String>();
                params.put(WicketFilter.FILTER_MAPPING_PARAM, "/*");
                params.put("configuration", "development");

                filter("/*").through(WicketGuiceFilter.class, params);

        
bind(AuthenticationService .class).to(AuthenticationServiceImpl .class);
}

And my service :
public class AuthenticationServiceImpl extends AbstractBusinessService
implements AuthenticationService {
        private final EntityManager m_entityManager;

        @Inject
        public AuthenticationServiceImpl(EntityManager entityManager) {
                m_entityManager = entityManager;
        }

        /* (non-Javadoc)
         * @see
lm.lbx.business.services.impl.AuthenticationService#authenticate(java.lang.String,
java.lang.String)
         */
        @Override
        public Integer authenticate(String login, String password) {
                Query query = m_entityManager
                                .createQuery("select u.id FROM User u WHERE 
u.login=:login AND
u.password=:password");
                query.setParameter("login", login);
                query.setParameter("password", password);
                return (Integer) getFirstResult(query);
        }
}

I can provide more info if needed, I stepped in debug in
PersistFilter, and unitOfWork.begin() is correctly run before wicket
filtering... So I really need help to understand what happend.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to