4 Replies Latest reply on Jan 21, 2003 11:34 AM by Joyce Stack

    Absoulte Newbie - HelloWorld example +

    Joyce Stack Newbie

      Hello,

      Why do I get this exception in my jboss window ? I am using Ant to build and generate my interface classes below. I using the Ant file to JAR up my Client jar and also to create my deployment jar file (I encluded all files except the client class this goes into another jar file as is expected). I cannot upload all the files as I keep getting errors when I upload so all classes are below.......


      17:10:49,140 WARN [ServiceController] Problem creating service jboss.j2ee:jndiName=ejb/helloworld/HelloWorld,service=EJB
      java.lang.NoSuchMethodException
      at java.lang.Class.getMethod0(Native Method)
      at java.lang.Class.getMethod(Class.java:888)
      at org.jboss.ejb.StatelessSessionContainer.setupHomeMapping(StatelessSessionContainer.java:457)
      at org.jboss.ejb.StatelessSessionContainer.create(StatelessSessionContainer.java:165)
      at org.jboss.ejb.Container.invoke(Container.java:752)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy5.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:315)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy20.create(Unknown Source)
      at org.jboss.ejb.EjbModule.createService(EjbModule.java:386)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:136)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy5.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:315)
      at org.jboss.system.ServiceController.create(ServiceController.java:243)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy9.create(Unknown Source)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:377)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:760)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:620)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:435)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:656)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:225)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:202)
      17:10:49,261 INFO [EjbModule] Created
      17:10:49,261 INFO [EjbModule] Starting
      17:10:49,271 INFO [EjbModule] Started
      17:10:49,271 INFO [MainDeployer] Deployed package: file:/E:/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/HelloJAR.jar
      17:10:49,281 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean operation 'checkIncompleteDeployments()'
      Cause: Incomplete Deployment listing:
      Packages waiting for a deployer:

      Incompletely deployed packages:

      MBeans waiting for classes:

      MBeans waiting for other MBeans:
      [ObjectName: jboss.j2ee:jndiName=ejb/helloworld/HelloWorld,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: java.lang.NoSuchMethodException]
      .



      My Client class

      package helloworld.client;

      import javax.naming.Context;
      import javax.naming.InitialContext;
      import java.util.Hashtable;
      import java.util.Properties;
      import helloworld.interfaces.*;

      public class HelloClient
      {
      public static void main(String[] args)
      {


      Hashtable prop = new Hashtable();
      prop.put ("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      prop.put ("java.naming.provider.url","jnp://localhost:1099");
      prop.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");


      try
      {
      Context ctx = new InitialContext(prop);
      Object obj = ctx.lookup("ejb/HelloWorld");
      HelloWorldHome home = (HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloWorldHome.class);
      HelloWorld helloWorld = home.create();


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






      My EJB class with XDoclet tags



      package helloworld.session;

      import java.rmi.RemoteException;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;

      /** @ejb.bean name="HelloWorld"
      * description="My Business Logic"
      * type="Stateless"
      * transaction-type="Bean"
      * jndi-name="ejb/helloworld/HelloWorld"
      */


      public class HelloWorldBean implements SessionBean
      {

      private javax.ejb.SessionContext m_ctx = null;

      public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException {
      System.out.println("********** HelloWorldBean -- ejbActivate called");
      }

      public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException {
      System.out.println("********** HelloWorldBean -- ejbPassivate called");
      }

      /** Removes the beans instance.
      * @ejb.home-method
      */
      public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException {
      System.out.println("********** HelloWorldBean -- ejbRemove called");
      }

      public void setSessionContext(javax.ejb.SessionContext sessionContext) throws javax.ejb.EJBException, java.rmi.RemoteException {
      m_ctx = sessionContext;
      }

      public HelloWorldBean() {
      System.out.println("********** HelloWorldBean CStor called ");
      }

      public void ejbCreate(){
      System.out.println("********** HelloWorldBean -- ejbCreate called");
      }

      /**
      * Says Hello
      * @ejb.interface-method view-type="remote"
      */
      public String sayHelloEJB(String name){
      System.out.println("***HelloWorldBean -- sayHelloEJB called ");
      String theString = "From HelloWorldBean -- \n HelloClients request "+name;
      return theString;
      }

      }





      Interfaces are generated


      /*
      * Generated file - Do not edit!
      */
      package helloworld.interfaces;

      import java.lang.*;
      import java.rmi.RemoteException;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;

      /**
      * Home interface for HelloWorld. Lookup using {1}
      * @xdoclet-generated at Jan 20, 2003 4:48:33 PM
      */
      public interface HelloWorldHome
      extends javax.ejb.EJBHome
      {
      public static final String COMP_NAME="java:comp/env/ejb/HelloWorld";
      public static final String JNDI_NAME="ejb/helloworld/HelloWorld";

      public helloworld.interfaces.HelloWorld create() throws javax.ejb.CreateException, java.rmi.RemoteException;

      /**
      * Removes the beans instance.
      */
      public void remove() throws javax.ejb.EJBException, java.rmi.RemoteException;

      }





      /*
      * Generated file - Do not edit!
      */
      package helloworld.interfaces;

      import java.lang.*;
      import java.rmi.RemoteException;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;

      /**
      * Remote interface for HelloWorld.
      * @xdoclet-generated at Jan 20, 2003 4:48:34 PM
      */
      public interface HelloWorld
      extends javax.ejb.EJBObject
      {
      /**
      * Says Hello
      */
      public java.lang.String sayHelloEJB( java.lang.String name ) throws java.rmi.RemoteException;

      }








      jboss.xml




      <?xml version="1.0" encoding="UTF-8"?>




      <enterprise-beans>


      <ejb-name>HelloWorld</ejb-name>
      <jndi-name>ejb/helloworld/HelloWorld</jndi-name>


      </enterprise-beans>

      <resource-managers>
      </resource-managers>








      ejb-jar file



      <?xml version="1.0" encoding="UTF-8"?>


      <ejb-jar >

      No Description.
      <display-name>Generated by XDoclet</display-name>

      <enterprise-beans>

      <!-- Session Beans -->

      [CDATA[No Description.]]

      <ejb-name>HelloWorld</ejb-name>

      helloworld.interfaces.HelloWorldHome
      helloworld.interfaces.HelloWorld
      <ejb-class>helloworld.session.HelloWorldBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>




      </enterprise-beans>



      </ejb-jar>



      Also here is my classpath
      CLASSPATH=.;E:\jboss-3.0.4_tomcat-4.1.12\server\default\deploy\HelloJAR.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jboss-j2
      ee.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jboss-common-client.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jboss-client.jar;
      E:\jboss-3.0.4_tomcat-4.1.12\client\jnp-client.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jbosssx-client.jar;E:\jboss-3.0.4
      _tomcat-4.1.12\client\j2ee.jar



      Thanks again for your help. This is my second post and I just cant seem to get it working. Has it something to do with my EJBs, interfaces, clients etc being in different packages.....


      Thanks

      Joyce