Have you seen any problem on the way I'm using replication?
I am suposed to keep the ejb references on the servlet httpSession , right?


----- Original Message -----
From: "Joao Clemente" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 4:22 PM
Subject: Re: [JBoss-user] NoSuchObjectException: Could not activate;
failedto recover session


>
> ----- Original Message -----
> From: "Scott M Stark" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 16, 2003 3:11 PM
>
> > This shows that the call is not going through the HA aware proxy. It is
> going
> > through the local invoker and bypassing the HA aware proxy because of
the
> > collocation of the caller and callee. The problem is occuring in the
> stateful
> > session cache replication though. How is the serverlet session and
> reference to
> > the stateful session bean being maintained across the server restart?
>
> As I suspected, a problem related with collocation...
>
> Well, the servlet is replicated because it's deployed with
<distributable/>
> and Jetty replication is enabled.
> The references to ejb's is kept in httpSession. I'll show you the relevant
> code:
>
>
>
> public class web_counter extends HttpServlet {
>
> protected void processRequest(HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException, IOException {
>   HttpSession sessao = request.getSession();
>
>   if (sessao.isNew()) { // Ainda nao ha contadores nem ligacao ao EJB.
>   /* Lets create a remote reference to the bean I want to access. */
>   try { InitialContext jndiContext = new InitialContext();
>   Object ref1 = jndiContext.lookup("contador/ContadorStateless");
>   ContadorHome home1 = (ContadorHome) PortableRemoteObject.narrow(ref1,
> ContadorHome.class);
>   Contador contadorStateless = home1.create();
>   Object ref2 = jndiContext.lookup("contador/ContadorStatefull");
>   ContadorHome home2 = (ContadorHome) PortableRemoteObject.narrow(ref2,
> ContadorHome.class);
>   Contador contadorStatefull = home2.create();
>
>   /* Keeping references to remote counters in a session atribute */
>
>   sessao.setAttribute("contadorStateless", contadorStateless);
>   sessao.setAttribute("contadorStatefull", contadorStatefull);
> }
> catch(Exception e)
> {
> System.out.println("Servlet: OOPS! Apanhei excepcao na inicializacao dos
> EJB's: " + e.toString());
> }
> }
>
>  // Every time the servlet runs, this code is executed.
>
>   Contador contadorStateless = (Contador)
> sessao.getAttribute("contadorStateless");
>   Contador contadorStatefull = (Contador)
> sessao.getAttribute("contadorStatefull");
>
>   // Invoque EJB's.
>   try {
>   // [SNIP] get a value that was also store inside httpSession and call is
> "counter"
>   System.out.println("Servlet: StatelessEJB: Add 2 +
"+counter.intValue()+"
> = " + contadorStateless.CalculateAdd(2,counter.intValue()) );
>   System.out.println("Servlet: StatefullEJB: Add 2 e
"+counter.intValue()+"
> = " + contadorStatefull.CalculateAdd(2,counter.intValue()) );
>
>   RetornoContador contStateless =
> contadorStateless.incrementaContador("stateless");
>   RetornoContador contStatefull =
> contadorStatefull.incrementaContador("statefull");
>   request.setAttribute("contStateless",contStateless);
>   request.setAttribute("contStatefull",contStatefull);
> }
> catch(Exception e){ e.printStackTrace(); }
> request.getRequestDispatcher("/output.jsp").forward(request, response);
> }
>
>
> "Contador" is an EJB that is deployed both as a stateless and as a
statefull
> ejb, with the names that you can see in the jndi lookup, and both deployed
> as clustered.
> That ejb has 2 methods: a "add" method and a "increment" method.
> "RetornoContador" is a structure (a java class with no methods except for
> the constructor) that contains a int and a string.
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: VM Ware
> With VMware you can run multiple operating systems on a single machine.
> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
> same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to