1 Reply Latest reply on Aug 15, 2002 3:25 AM by Kenneth Petersen

    Tomcat 4.0.4 client setup / JBoss 3.0.1

    Kenneth Petersen Newbie

      I am trying to run Tomcat and JBoss in two different VM?s.

      I have written a session bean that does nothing but add two integers, and I have written a java client of this session bean:

      package test;
      import javax.naming.*;
      import javax.rmi.PortableRemoteObject;
      import java.util.Properties;
      import test.Adder;
      import test.AdderHome;

      public class BeanClient {

      public static void main(String[] args) {
      // preparing properties for constructing an InitialContext object
      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.PROVIDER_URL, "localhost:1099");
      properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

      try {
      // Get an initial context
      InitialContext jndiContext = new InitialContext(properties);
      System.out.println("Got context");

      // Get a reference to the Bean
      Object ref = jndiContext.lookup("Adder");
      System.out.println("Got reference");

      // Get a reference from this to the Bean's Home interface
      AdderHome home = (AdderHome)
      PortableRemoteObject.narrow (ref, AdderHome.class);

      // Create an Adder object from the Home interface
      Adder adder = home.create();
      System.out.println ("2 + 5 = " + adder.add(2, 5));
      }
      catch(Exception e) {
      System.out.println(e.toString());
      }
      }
      }


      This test client is as far as I can tell functional.

      To test the connection between Tomcat and JBoss I have written the following jsp page:

      <%@ page import="test.BeanClient"%>
      <%
      BeanClient.main(null);
      %>


      When accessing this page I get the following error:

      java.lang.NoClassDefFoundError: javax/ejb/EJBHome
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1631)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:926)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1243)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:195)
      at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:183)
      at java.io.ObjectInputStream.inputProxyClassDescriptor(ObjectInputStream.java:982)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
      at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
      at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:454)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:434)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at test.BeanClient.main(BeanClient.java:23)
      at org.apache.jsp.test2$jsp._jspService(test2$jsp.java:62)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
      at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
      at java.lang.Thread.run(Thread.java:484)


      Aside from a jar containing the test session bean, I have placed the following jar files in the lib-folder of Tomcat:

      j2ee.jar
      jasper-compiler.jar
      jasper-runtime.jar
      jboss-client.jar
      jboss-common.jar
      jbosscx-client.jar
      jnet.jar
      jnp-client.jar
      log4j.jar
      naming-factory.jar


      I would very much appreciate some help.

      Best Regards
      Kenneth Petersen