You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Guillaume Rousse <Gu...@univ-reunion.fr> on 2000/04/15 23:28:54 UTC

ClassNotFound exception

Hi.
I use EJB and JSP. In my application, i have a init servlet, loaded at startup,
locating session beans remote interfaces and storing them in context, like this:
public class Init extends HttpServlet {

  public void init(ServletConfig config) throws ServletException {
    super.init(config);
    Properties props = new java.util.Properties();
    Enumeration enum = getInitParameterNames();
    while (enum.hasMoreElements()) {
      String name = (String)enum.nextElement();
      String value = getInitParameter(name);
      props.setProperty(name, value);
    };
    ServletContext application=getServletContext();
    try {
      InitialContext ctx = new InitialContext(props);
      BiblioHome bibHome = (BiblioHome)PortableRemoteObject.narrow(ctx.lookup("BiblioHome"),BiblioHome.class);
      LoginHome logHome = (LoginHome)PortableRemoteObject.narrow(ctx.lookup("LoginHome"),LoginHome.class);
      application.setAttribute("bibHome",bibHome);
      application.setAttribute("logHome",logHome);
    } catch (NamingException e) {
      System.out.println("Impossible de trouver le contexte initial");
	System.out.println(e);
    }
Problem is always have a ClassNotFoundException at startup:
javax.naming.NamingException: registry context error: look up [Root exception is java.rmi.MarshalException: error during marshalling/unmarshalling by stub; nested exception is:
        java.lang.ClassNotFoundException: ppf.ejb.JOnASBiblioBeanBiblioHome_Stub]   
altough JOnASBiblioBeanBiblioHome_Stub.class is present in
WEB-INF/classes/ppf/ejb/ directory.
When rmiregistry is not launched, i have "connection refused". When EJBServer is
not launched, i got "Name not bound", so i guess this is a pure classpath
problem. But my servlet class, located in WEB-INF/classes/ppf/servlet
directory, is found !!! So, what is the problem ?

-- 
 Guillaume Rousse
Iremia - Universit� de la R�union

Sleep doesn't exists. Just lack of cafeine.

Re: ClassNotFound exception

Posted by ma...@mjwilcox.com.
I think this is a known bug that has been fixed in the latest builds 
of Tomcat 3.1

If the binaries on the website still don't fix it, download the latest 
source from CVS and build.

Mark

On 16 Apr 00, at 1:28, Guillaume Rousse wrote:

> Hi.
> I use EJB and JSP. In my application, i have a init servlet, loaded at startup,
> locating session beans remote interfaces and storing them in context, like this:
> public class Init extends HttpServlet {
> 
>   public void init(ServletConfig config) throws ServletException {
>     super.init(config);
>     Properties props = new java.util.Properties();
>     Enumeration enum = getInitParameterNames();
>     while (enum.hasMoreElements()) {
>       String name = (String)enum.nextElement();
>       String value = getInitParameter(name);
>       props.setProperty(name, value);
>     };
>     ServletContext application=getServletContext();
>     try {
>       InitialContext ctx = new InitialContext(props);
>       BiblioHome bibHome = (BiblioHome)PortableRemoteObject.narrow(ctx.lookup("BiblioHome"),BiblioHome.class);
>       LoginHome logHome = (LoginHome)PortableRemoteObject.narrow(ctx.lookup("LoginHome"),LoginHome.class);
>       application.setAttribute("bibHome",bibHome);
>       application.setAttribute("logHome",logHome);
>     } catch (NamingException e) {
>       System.out.println("Impossible de trouver le contexte initial");
> 	System.out.println(e);
>     }
> Problem is always have a ClassNotFoundException at startup:
> javax.naming.NamingException: registry context error: look up [Root exception is java.rmi.MarshalException: error during marshalling/unmarshalling by stub; nested exception is:
>         java.lang.ClassNotFoundException: ppf.ejb.JOnASBiblioBeanBiblioHome_Stub]   
> altough JOnASBiblioBeanBiblioHome_Stub.class is present in
> WEB-INF/classes/ppf/ejb/ directory.
> When rmiregistry is not launched, i have "connection refused". When EJBServer is
> not launched, i got "Name not bound", so i guess this is a pure classpath
> problem. But my servlet class, located in WEB-INF/classes/ppf/servlet
> directory, is found !!! So, what is the problem ?
> 
> -- 
>  Guillaume Rousse
> Iremia - Université de la Réunion
> 
> Sleep doesn't exists. Just lack of cafeine.
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
> 
> 
>