1 Reply Latest reply on Dec 7, 2004 8:44 AM by darranl

    Deployment problem with a simple EJB example

    peacemaker88

      Hi,
      I want to reproduce an EJB tutorial and want to deploy Konto.jar into JBoss 4.0.0. So, I put it into the default/deploy directoy and I got the following error message:

      13:29:33,581 WARN [verifier] EJB spec violation:
      Bean : KontoBean
      Method : public abstract double abheben(int) throws RemoteException
      Section: 6.10.5
      Warning: The methods defined in the remote interface must have a matching method
      in the bean's class with the same name and same number and types of arguments.

      13:29:33,591 WARN [verifier] EJB spec violation:
      Bean : KontoBean
      Method : public abstract void einzahlen(int) throws RemoteException
      Section: 6.10.5
      Warning: The methods defined in the remote interface must have a matching method
      in the bean's class with the same name and same number and types of arguments.

      13:29:33,611 ERROR [MainDeployer] could not create deployment: file:/D:/jboss-4.
      0.0/server/default/deploy/Konto.jar
      org.jboss.deployment.DeploymentException: Verification of Enterprise Beans faile
      d, see above for error messages.
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:553)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:889)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:745)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
      at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:119)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:131)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy8.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:305)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:481)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      doScan(AbstractDeploymentScanner.java:204)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(A
      bstractDeploymentScanner.java:277)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
      upport.java:271)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
      eanSupport.java:221)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:891)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:416)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy4.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:693)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:119)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:131)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy5.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:396)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:293)
      at org.jboss.Main.boot(Main.java:151)
      at org.jboss.Main$1.run(Main.java:405)
      at java.lang.Thread.run(Thread.java:534)
      13:29:33,991 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/D
      :/jboss-4.0.0/server/default/deploy/jmx-console.war/
      13:29:34,572 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/D
      :/jboss-4.0.0/server/default/deploy/management/web-console.war/
      13:29:36,535 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      Incompletely deployed packages:
      org.jboss.deployment.DeploymentInfo@98016448 { url=file:/D:/jboss-4.0.0/server/d
      efault/deploy/Konto.jar }
      deployer: org.jboss.ejb.EJBDeployer@f102d3
      status: Deployment FAILED reason: Verification of Enterprise Beans failed, see
      above for error messages.
      state: FAILED
      watch: file:/D:/jboss-4.0.0/server/default/deploy/Konto.jar
      altDD: null
      lastDeployed: 1102422573210
      lastModified: 1102422573180
      mbeans:

      Here is my Konto.jar file structure:
      KontoHome.class
      Konto.class
      KontoBean.class
      META-INF\MANIFEST.MF
      META-INF\ejb-jar.xml

      "ejb-jar.xml" contains:

      <?xml version="1.0"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems,
      Inc.//DTD Enterprise JavaBeans 1.1//EN"
      "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
      <ejb-jar>
       <display-name>Konto</display-name>
       <enterprise-beans>
       <session>
       <description>Ein einfaches Guthabenkonto</description>
       <ejb-name>KontoBean</ejb-name>
       <home>KontoHome</home>
       <remote>Konto</remote>
       <ejb-class>KontoBean</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
       </session>
       </enterprise-beans>
      </ejb-jar>


      "Konto.java":

      import javax.ejb.*;
      import java.rmi.RemoteException;
      
      public interface Konto extends EJBObject
      {
       public double abheben (int betrag)
       throws RemoteException;
       public void einzahlen (int betrag)
       throws RemoteException;
       public double getKontostand()
       throws RemoteException;
      }
      

      "KontoHome.java":
      import javax.ejb.*;
      import java.rmi.RemoteException;
      
      public interface KontoHome extends EJBHome
      {
       public Konto create()
       throws CreateException, RemoteException;
      }
      

      "KontoBean.java":
      import java.rmi.RemoteException;
      
      import javax.ejb.*;
      
      public class KontoBean implements SessionBean
      {
       // Globale Variablen
       private SessionContext context = null;
       private double kontostand;
      
       public void ejbCreate()
       {
       // Hier wird der Anfangskontostand (0) gesetzt.
       kontostand = 0;
       }
      
       public void ejbRemove()
       {
       System.out.println ("Bean entfernt.");
       }
      
       public void getSessionContext (SessionContext c)
       {
       // Session-Kontext vom Container entgegennehmen
       // und speichern
       context = c;
       }
       public void ejbActivate()
       {
       System.out.println ("Bean aktiviert.");
       }
      
       public void ejbPassivate()
       {
       System.out.println ("Bean passiviert.");
       }
      
       // Geschäftsmethoden
       public double abheben (double betrag)throws RemoteException
       {
       if (kontostand < betrag)
       return 0;
       kontostand -= betrag;
       return betrag;
       }
      
       public void einzahlen (double betrag)throws RemoteException
       {
       kontostand += betrag;
       }
      
       public double getKontostand()throws RemoteException
       {
       return kontostand;
       }
      
      
      public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
       this.context=arg0;
      
       }
      }
      

      I don't know what's wrong with my code. Please help me to deploy this stuff.

      Regards,
      PeaceMaker88

        • 1. Re: Deployment problem with a simple EJB example
          darranl

           

          Warning: The methods defined in the remote interface must have a matching method in the bean's class with the same name and same number and types of arguments.


          Your remote interface methods take an int as a parameter, the methods in the bean implementation take a double as the parameter.