I have a servlet LoginFormProcess that invoke the method userAuthenticate to a remote 
server (in reality is local) called UPAMImpl whose remote interface is UPAM; the 
method userAuthenticate invoke other 2 methods to another remote server (also local) 
called UPMDataManagerImpl. The two servers work fine with a test client but if I use 
the LoginFormProcess as a client I obtain the following error:


Error: 500
Location: /Progetto/LoginFormProcess
Internal Servlet Error:

java.lang.NoClassDefFoundError: UserIDPasswordException
 at java.lang.Class.getDeclaredConstructors0(Native Method)
 at java.lang.Class.privateGetDeclaredConstructors(Class.java:1576)
 at java.lang.Class.getConstructor0(Class.java:1748)
 at java.lang.Class.newInstance0(Class.java:266)
 at java.lang.Class.newInstance(Class.java:249)
 at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:268)
 at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
 at org.apache.tomcat.core.Handler.service(Handler.java:254)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
 at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
 at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
 at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
 at java.lang.Thread.run(Thread.java:536)

where UserIDPasswordException is one of my own exception defined for the server 
UPAMImpl. That exception is thrown correctly using a test client without using RMI.
The following is the code for LoginFormProcess and the ConnectionServlet for the 
lookup to the RMI registry:

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

public class ConnectionServlet extends HttpServlet {

String registry;

UPAM upam;

public void init(ServletConfig config) throws ServletException {
 super.init(config);
 registry = config.getInitParameter("registry");
 if (registry == null) registry = "//localhost";

 try {

     String name = registry + "/upam";
     upam = (UPAM)Naming.lookup(name);

     }
     catch (Exception e) {
                 e.printStackTrace();

                          }


        }
 }
--------------------------------------------------------------------

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


public class LoginFormProcess extends ConnectionServlet {




  public void doPost (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {


     HttpSession session = request.getSession(true);
    //  String url;
      String userName = request.getParameter("userID");
     // String user = getDefinition(userName);
      String userPassword = request.getParameter("password");
  // String password = getDefinition(userPassword);
 //boolean check;

 String sessionID = session.getID();
 System.out.println("SessionID= "+sessionID);

 try {

   //UPAM upam = (UPAM)Naming.lookup("rmi://localhost/upam");

     if(upam.userAuthenticate("sip:"+userName,userPassword,"aknadsnoasd")){

   //response.setContentType("text/html");

   // url ="/MainMenu.html";

    RequestDispatcher dispatcher = 
getServletContext().getRequestDispatcher("/MainMenu.html");
    dispatcher.forward(request, response);

    //session.setAttribute("sessionID",sessionID);
 }


 // controllo con il db
      //if (userName.equals("administrator") && userPassword.equals("ziopino")) {
   //  check = true;

      //   }

      //else   {
         //   check = false;
          //  url="/ErrorLogin.html";
          //  }

      //session.setAttribute("nomechetepareate", check);


  //    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
  //  dispatcher.forward(request, response);
      }
 //catch(NotBoundException nbe) {
  //nbe.printStackTrace();
 // System.out.println("Client: Not Bound Exception");
 //}

 catch(java.net.MalformedURLException mue) {
  //mue.printStackTrace();
  System.out.println("Client: Malformed URL Exception");
 }

 catch(java.rmi.RemoteException re) {
  // re.printStackTrace();
  System.out.println("Client: Remote Exception");
 }
 catch(SystemFailureException sfe) {
  //mue.printStackTrace();
  //System.out.println("Client: SystemFailureException");

  //response.setContentType("text/html");

  //url="/ErrorDB.html";
    //System.out.println("Client: UserIDPasswordException");
    RequestDispatcher dispatcher = 
getServletContext().getRequestDispatcher("/ErrorDB.html");
       dispatcher.forward(request, response);

 }
 catch(UserIDPasswordException upe) {
 // re.printStackTrace();

 //res.setContentType("text/html");

  //url="/ErrorLogin.html";
 System.out.println("Client: UserIDPasswordException");
  RequestDispatcher dispatcher = 
getServletContext().getRequestDispatcher("/ErrorLogin.html");
    dispatcher.forward(request, response);

 }

  }
}

Everything in Tomcat is well configured as well as the Login html form.
For this 2 files I used the documentation in:

 http://developer.java.sun.com/developer/technicalArticles/RMI/rmi/

Hope to find an help,
Best regards,
             Roberto Vallorani

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to