1. Is there an easy way to search list archives that I don't know
   about, as I suspect this question to have been asked before.

2. I have two instances of jboss, one on each machine, clustering
   is setup, and works as far as *I* can tell.  However, how do I
   test this more convincingly?


I can test each machine by going to http://localhost/test/servlet/TestServlet
and it seems to work fine.  How can I start putting the clustering to work
and testing it now?

Any and all hints/methodologies welcome!

I have put in my clustered tags, and this is my Test Servlet code, do
I need to change anything?



package test;

import java.io.*;
import java.util.*;
import javax.naming.*;
import javax.rmi.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class UserManagerServlet extends HttpServlet
{
   private UserManagerHome userManagerHome = null;
   
   public void init() throws ServletException
   {
      String refString = "java:comp/env/ejb/UserManager";
      try
      {
         // Get a naming context
         InitialContext jndiContext = new InitialContext();
         // Get a reference to the Interest Bean
         Object ref  = jndiContext.lookup(refString);      
         // Get a reference from this to the Bean's Home interface
         userManagerHome = (UserManagerHome) PortableRemoteObject.narrow(ref, 
UserManagerHome.class);
      }
      catch(Exception e)
      {
         throw new ServletException("Failed to lookup " + refString, e);
      }
   }

   public void doPost(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException
   {
      performTask(request, response);
   }
   
   public void doGet(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException
   {
      performTask(request, response);
   }
   
   public void performTask(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException
   {
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();
      out.println("<HTML><HEAD><TITLE>UserManager EJB Tester</TITLE></HEAD><BODY>");
      out.println("<H2>Calling EJB...</H2>");

      try
      {
         UserManager bean = userManagerHome.create();
         String toOut = bean.getString("Hi!");
         System.out.println(toOut);
         out.println(toOut);
         bean.remove();
      }
      catch (Exception e)
      {
         out.println(e.toString());
         StringWriter sWriter = new StringWriter();
         PrintWriter writer = new PrintWriter(sWriter);
         e.printStackTrace(writer);
         out.println("<BR><BR>" + sWriter.toString());
         writer.close();
      }
      finally
      {
         out.println("</BODY></HTML>");
         out.close();
      }
   }
}


-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to