[jboss-user] [EJB 3.0] - Re: trouble getting correct SFSB-instance in WAR-deployment

axismundi do-not-reply at jboss.com
Sat Nov 10 08:00:00 EST 2007


"ALRubinger" wrote : 
  | Try again with doing one lookup, placing that stub in the HttpSession, and paste your code if you're still having problems?
  | 
  | S,
  | ALR

I followed your advise and implemented a filter to retrieve the SFSB-proxy once the HTTP-session is created:

public void doFilter(ServletRequest request, ServletResponse response,
  | 			FilterChain chain) throws IOException, ServletException {
  | 		
  | 		HttpSession session = ((HttpServletRequest)request).getSession();
  | 		ShopTree shopTree;
  | 		if (session.isNew()) {
  | 			try {
  | 				Context context = new InitialContext();
  | 				shopTree = (ShopTree) context.lookup("app/ShopTreeBean/local");
  | 			} catch (NamingException e) {
  | 				throw new ServletException(e);
  | 			}
  | 			session.setAttribute("shopTreeBean", shopTree);
  | 		}
  | 		chain.doFilter(request, response);
  | 	}

I verified that the filter is working as expected.

But the result of the endeavor is just as before. Not surprisingly I can pick up the proxy (local IF) from the session in my ImageServlet successfully.
But once I try to access a method, at the first time Seam is complaining like this:

Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: shopTree.applicationUser
  | 

However, I have verified that the field applicationUser is available in the Seam context. Moreover, I have debugged the Seam action-method which is implemented in the same SFSB and verified that the field has already been populated on a previous request. 

At the second request to the ImageServlet, I am getting
 javax.ejb.NoSuchEJBException: Could not find stateful bean: a4i810-vbn2mr-f8u25ljn-1-f8u49lh5-12

My only explanation is that JBoss' JNDI-implementation delivers a serialized  instance (copy) of the original instance that is available in the EJB-container. However, AFAIK, this would not fit with the JBoss' specification, which says that JNDI-lookups for local IF's (in the same VM) result in a reference to the instance, not in a serialized copy.

Anymore hint for me?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103416#4103416

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103416



More information about the jboss-user mailing list