[jboss-jira] [JBoss JIRA] Commented: (JBAS-9198) Cannot store reference to a stateful session bean in the HTTP session

Andrig Miller (JIRA) jira-events at lists.jboss.org
Thu Mar 31 09:18:37 EDT 2011


    [ https://issues.jboss.org/browse/JBAS-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592956#comment-12592956 ] 

Andrig Miller commented on JBAS-9198:
-------------------------------------

I had changed web.xml, but apparently I didn't save it or something, as it is distributable.  My mistake.

> Cannot store reference to a stateful session bean in the HTTP session
> ---------------------------------------------------------------------
>
>                 Key: JBAS-9198
>                 URL: https://issues.jboss.org/browse/JBAS-9198
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Web (Tomcat) service
>    Affects Versions: 7.0.0.Beta1
>            Reporter: Andrig Miller
>            Assignee: Remy Maucherat
>             Fix For: 7.0.0.Beta2
>
>
> I have ported an application from AS 5/EAP 5.1 to AS 7 (a snapshot of Beta 2 actually), and in that application I am looking up a reference to a stateful session bean, to store it in the HTTP session, and the actual storage of the reference, gets the following:
> javax.servlet.ServletException: java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute sfsbOrderInquiry
> 	services.web.OrderInquiryServlet.doGet(OrderInquiryServlet.java:78)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
> root cause
> java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute sfsbOrderInquiry
> 	org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1289)
> 	org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1250)
> 	org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:130)
> 	services.web.OrderInquiryServlet.doGet(OrderInquiryServlet.java:74)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
> It's saying that my attribute is not serializable, but the OrderInquiryBean in the lookup implements Serializable.
> The code in the servlet is as such, and it fails on the session.setAttribute("sfsbOrderInquiry", orderInquiry):
> HttpSession session = request.getSession();
> 		OrderInquiry orderInquiry = (OrderInquiry) session.getAttribute("sfsbOrderInquiry");
> 		if (orderInquiry == null) {
> 			InitialContext context = null;
> 			try {
> 				context = new InitialContext();
> 				orderInquiry = (OrderInquiry) context.lookup("java:app/OrderManagerEJB/OrderInquiryBean!services.ejb.OrderInquiry");
> 				session.setAttribute("sfsbOrderInquiry", orderInquiry);
> 			} catch(Exception lookupError) {
> 				logger.log(Level.ERROR, lookupError.getStackTrace().toString());
> 				response.setStatus(500);
> 				throw new ServletException(lookupError);
> 			}
> 		}
> The top of OrderInquireBean looks like:
> @Stateful
> public class OrderInquiryBean implements OrderInquiry, Serializable {
>    
>    
>    /** The serialVersionUID */
>    private static final long serialVersionUID = -9113338082170911949L

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list