4 Replies Latest reply on Mar 19, 2004 8:57 AM by juha

    ClassNotFound exception finding Home interface

    zagarol

      Dear all,

      I am quite new using JBoss (Been using it since june 2003) I have been deploying ejbs with no problems since then until Thursday of last week when I tried to deploy an EJB.

      The jar is called wizard.jar
      the Home interface is RetailWebSystem.WizardHome
      the Remote interface is RetailWebSystem.Wizard
      the Bean implementation is RetailWebSystem.WizardBean

      I have included all of the class files in my jar along with the following ejb-jar.xml and jboss.xml:

      ejb-jar.xml:
      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "ejb-jar_2_0.dtd">
      
      <ejb-jar>
       <enterprise-beans>
       <session >
       <description>Wizard Bean</description>
       <ejb-name>WizardEJB</ejb-name>
       <home>RetailWebSystem.WizardHome</home>
       <remote>RetailWebSystem.Wizard</remote>
       <ejb-class>RetailWebSystem.WizardBean</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
       <reentrant>False</reentrant>
       <resource-ref >
       <res-ref-name>java:/RegencyDataSource</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
       </session>
       </enterprise-beans>
      </ejb-jar>
      
      jboss.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
      
      <jboss>
      
       <enterprise-beans>
       <session>
       <ejb-name>WizardEJB</ejb-name>
       <local-jndi-name>local.WizardEJB</local-jndi-name>
       <resource-ref>
       <res-ref-name>java:/RegencyDataSource</res-ref-name>
       <jndi-name>java:/RegencyDataSource</jndi-name>
       </resource-ref>
       </session>
       </enterprise-beans>
      
       <resource-managers>
       </resource-managers>
      
      </jboss>


      The jar is picked up and deployed fine when i drop it into the server deploy directory but when I try to retrieve the home interface on the client machine I get a CommunicationException with Root cause being ClassNotFoundException RetailWebSystem.WizardHome.

      All the files build ok the paths are fine so I am slightly confused.

      Has anyone got any ideas how to proceed.

      any help would be much appreciated.

      Shane Preater.

        • 1. Re: ClassNotFound exception finding Home interface
          zagarol

          Additionally I have got the complete stacktrace for the error which is listed below:

          javax.naming.CommunicationException. Root exception is java.lang.ClassNotFoundException: RetailWebSystem.WizardHome
          at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
          at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:219)
          at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:707)
          at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651)
          at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588)
          at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:639)
          at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:309)
          at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:241)
          at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1469)
          at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1432)
          at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
          at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
          at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
          at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
          at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:550)
          at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
          at javax.naming.InitialContext.lookup(InitialContext.java:354)
          at RetailWebSystem.EJBHomeFactory.narrowFromJNDI(EJBHomeFactory.java:65)
          at RetailWebSystem.EJBHomeFactory.getHome(EJBHomeFactory.java:108)
          at CustomerServlet.processRequest(CustomerServlet.java:81)
          at CustomerServlet.doGet(CustomerServlet.java:405)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
          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.access$0(ApplicationFilterChain.java:197)
          at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
          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.valves.CertificatesValve.invoke(CertificatesValve.java:246)
          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:2347)
          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:1027)
          at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
          at java.lang.Thread.run(Thread.java:534)


          • 2. Re: ClassNotFound exception finding Home interface
            kevinhanna

            your JSP needs to have a copy of the class too, you should include it in your .war.

            • 3. Re: ClassNotFound exception finding Home interface
              zagarol

              Thanks for the info.

              I have checked and the servlet which is calling the EJB does have access to all the correct classes so I am pretty sure this is not the case.

              In the enviroment I am using Tomcat is housed in a different place to the JBoss server so its quite a simple test to ensure that I have got the right interface classes available.

              Could it be something in the class loader of JBoss?

              • 4. Re: ClassNotFound exception finding Home interface

                Make sure you've packaged the class correctly, the directory hierarchy must reflect the java package structure. Also make sure the class package declaration matches what you think it should be.