[EJB 3.0] - Re: trouble getting correct SFSB-instance in WAR-deployment
by axismundi
"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
18 years, 8 months
[JBoss Seam] - Re: seam-gen is not a solution worth trying for existing EJB
by mortena
Hi Max
Sorry about the tone. I wasn't meant to be rude. I've just been fighting with these thing for a while now without much luck.
My frustrations is actually more a result of a lack of help and documentation regarding these matters. (Like why do I have to use something found in a jira containing a few attachments but no intro).
It seams like the sources of information is spread into too many places:
- This forum
- Michael Yuan's blog
- Hibernate Tools' website
- in.relation.to
- various articles and blogs online
- Some slideshows presented at various conferences etc.
Why not set up a wiki / confluence or something similar where users can contribute to a gathered documentation.
1) If you want specific features in the generated code then please contribute it - its just a matter of adding/fixing the templates.
I would gladly do that but how do I start when I can't figure out what the status of the various projects / subprojects are?
2) seam-gen as it is in the ant scripts is just done via reverse engineering but hibenate tools supports using existing entities just fine and there are even a jira for it to be applied - someone just need to pick that up and get it applied properly. It's described at http://jira.jboss.com/jira/browse/JBSEAM-843 and even with a patch you can easily try out if you want.
I've seen the Jira, but it is not very well documented or described. I've tried downloading the build-jpa.xml and adding a generate-ui target in the build.xml file, but it gives me some errors like: "view/extension not found." How to use the .patch files I don't know.
3) Just to prove it works - then In JBoss Tools you have two options when you choose seam generate entities you have the option of selecting Reverse Engineer from database OR Use exiting entities.
That is great. I'll give it another shot. Starting from JBoss Tools I think...
Please let me know if there's anything I can contribute with making seam the success it should be.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103412#4103412
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103412
18 years, 8 months