3 Replies Latest reply on Jun 16, 2005 6:23 PM by Christian Gaege

    Problems with Hot Deployment

    Christian Gaege Newbie

      Hello,

      I´ve got some Problems with Hot Deployment on JBoss. I wrote a SessionBean StudentSessionFacade and an EntityBean StudentEntity (cmp) and packed them with ant in MOVE.jar.
      When I copy MOVE.jar into ~/jboss-4.0.1sp1/server/default/deploy/
      before I start jboss everything works fine

      [...]
      12:24:14,196 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=MySqlDS to JNDI name 'java:MySqlDS'
      12:24:15,904 INFO [EjbModule] Deploying StudentEntity
      12:24:17,294 INFO [EjbModule] Deploying StudentSessionFacade
      12:24:27,090 INFO [EJBDeployer] Deployed: file:/home/christian/jboss-4.0.1sp1/server/default/deploy/MOVE.jar
      12:24:27,728 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/home/christian/jboss-4.0.1sp1/server/default/deploy/jmx-console.war/
      12:24:28,809 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/home/christian/jboss-4.0.1sp1/server/default/deploy/management/web-console.war/
      12:24:33,953 INFO [TomcatDeployer] deploy, ctxPath=/struts-move, warUrl=file:/home/christian/jboss-4.0.1sp1/server/default/tmp/deploy/tmp64674struts-move.war/
      12:24:38,023 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
      12:24:38,494 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8009
      12:24:38,505 INFO [JkMain] Jk running ID=0 time=0/71 config=null
      12:24:38,530 INFO [Server] JBoss (MX MicroKernel) [4.0.1sp1 (build: CVSTag=JBoss_4_0_1_SP1 date=200502160314)] Started in 1m:41s:46ms
      
      
      



      When I hot deploy MOVE.jar I get the following error:

      12:24:38,530 INFO [Server] JBoss (MX MicroKernel) [4.0.1sp1 (build: CVSTag=JBoss_4_0_1_SP1 date=20050216 0314)] Started in 1m:41s:46ms
      12:27:47,210 INFO [EJBDeployer] Undeploying: file:/home/christian/jboss-4.0.1sp1/server/default/deploy/M OVE.jar
      12:27:47,626 INFO [EjbModule] Undeployed StudentSessionFacade
      12:27:47,660 INFO [EjbModule] Undeployed StudentEntity
      12:27:48,403 WARN [verifier] EJB spec violation:
      Bean : StudentSessionFacade
      Method : public abstract boolean deleteStudent(String) throws RemoteException
      Section: 7.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.
      
      12:27:48,405 WARN [verifier] EJB spec violation:
      Bean : StudentSessionFacade
      Method : public abstract Student getStudent(String) throws RemoteException
      Section: 7.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.
      
      12:27:48,406 WARN [verifier] EJB spec violation:
      Bean : StudentSessionFacade
      Method : public abstract ArrayList getAllStudents() throws RemoteException
      Section: 7.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.
      
      12:27:48,407 WARN [verifier] EJB spec violation:
      Bean : StudentSessionFacade
      Method : public abstract ArrayList getStudentsByBetreuer(String) throws RemoteException
      Section: 7.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.
      
      12:27:48,408 ERROR [MainDeployer] could not create deployment: file:/home/christian/jboss-4.0.1sp1/server /default/deploy/MOVE.jar
      org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error me ssages.
       at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:553)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
      
      



      I can't find the error. The above mentioned methods in the bean class exist. Any Ideas? Here ist the code of the Session Bean an the Remote Interface:

      Bean Class
      /*
       * Created on 31.05.2005 by Christian Gaege
       */
      package de.gaege.session.facade.ejb;
      
      import java.rmi.RemoteException;
      import java.util.*;
      
      import javax.ejb.EJBException;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;
      import javax.naming.InitialContext;
      
      import de.gaege.student.interfaces.StudentEntityLocal;
      import de.gaege.student.interfaces.StudentEntityLocalHome;
      import de.gaege.student.interfaces.StudentEntityPK;
      import de.gaege.datenobjekte.*;
      
      /**
       * @ejb.bean name="StudentSessionFacade"
       * display-name=" StudentSessionFacade"
       * description="Session Bean fuer den Umgang mit der StudentEntityBean"
       * jndi-name="ejb/StudentSessionFacade"
       * type="Stateless"
       * view-type="remote"
       */
      public class StudentSessionFacade implements SessionBean {
      
       /**
       *
       */
       public StudentSessionFacade() {
       super();
       // TODO Auto-generated constructor stub
       }
      
       /* (non-Javadoc)
       * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
       */
       public void setSessionContext(SessionContext arg0)
       throws EJBException,
       RemoteException {
       // TODO Auto-generated method stub
      
       }
      
       /* (non-Javadoc)
       * @see javax.ejb.SessionBean#ejbRemove()
       */
       public void ejbRemove() throws EJBException, RemoteException {
       // TODO Auto-generated method stub
      
       }
      
       /* (non-Javadoc)
       * @see javax.ejb.SessionBean#ejbActivate()
       */
       public void ejbActivate() throws EJBException, RemoteException {
       // TODO Auto-generated method stub
      
       }
      
       /* (non-Javadoc)
       * @see javax.ejb.SessionBean#ejbPassivate()
       */
       public void ejbPassivate() throws EJBException, RemoteException {
       // TODO Auto-generated method stub
      
       }
      
       /**
       * Business method
       * @ejb.interface-method view-type = "remote"
       * legt einen neuen Studenten an
       */
       public boolean createStudent(Student s) {
      
       // TODO Auto-generated method stub
       System.out.println("createStudent(Student s) wurde aufgerufen");
      
       try {
      
       // Student s in seine Bestandteile zerlegen
       String vorname = s.getVorname();
       String nachname = s.getNachname();
       String kontakt = s.getKontakt();
       String matrikelnummer = s.getMatrikelnummer();
       String semester = s.getSemester();
       String thema = s.getThema();
       String betreuer = s.getBetreuer();
       String kommentar = s.getKommentar();
      
       boolean vb1 = s.isVb1();
       boolean vb2 = s.isVb2();
       boolean nb = s.isNb();
       boolean sa = s.isSa();
       boolean vertrag = s.isVertrag();
       boolean zeugnis = s.isZeugnis();
      
       InitialContext ctx = new InitialContext(System.getProperties());
       // Local Home Interface der Entity Bean holen
       StudentEntityLocalHome localHome = (StudentEntityLocalHome) ctx
       .lookup(StudentEntityLocalHome.JNDI_NAME);
       // Local Interface holen
       StudentEntityLocal student = localHome.create(
       vorname,
       nachname,
       kontakt,
       matrikelnummer,
       semester,
       thema,
       betreuer,
       kommentar,
       vb1,
       vb2,
       nb,
       sa,
       vertrag,
       zeugnis);
      
       // Statusinformationen ausgeben
       System.out.println("EntityBean wurde aufgerufen");
       } catch (Exception e) {
       System.err.println(e.getMessage());
       return false;
       }
      
       return true;
       }
       /**
       * Business method
       * @ejb.interface-method view-type = "remote"
       * aendert die Daten eines Studenten
       */
       public boolean updateStudent(de.gaege.datenobjekte.Student s) {
       // TODO Auto-generated method stub
       System.out.println("updateStudent(Student s) wurde aufgerufen");
      
       // Student s in seine Bestandteile zerlegen
       String vorname = s.getVorname();
       String nachname = s.getNachname();
       String kontakt = s.getKontakt();
       String matrikelnummer = s.getMatrikelnummer();
       String semester = s.getSemester();
       String thema = s.getThema();
       String betreuer = s.getBetreuer();
       String kommentar = s.getKommentar();
      
       boolean vb1 = s.isVb1();
       boolean vb2 = s.isVb2();
       boolean nb = s.isNb();
       boolean sa = s.isSa();
       boolean vertrag = s.isVertrag();
       boolean zeugnis = s.isZeugnis();
      
       try {
       InitialContext ctx = new InitialContext(System.getProperties());
       // Local Home Interface der Entity Bean holen
       StudentEntityLocalHome localHome = (StudentEntityLocalHome) ctx
       .lookup(StudentEntityLocalHome.JNDI_NAME);
       // Local Interface holen
       StudentEntityLocal student = localHome
       .findByPrimaryKey(new StudentEntityPK(matrikelnummer));
      
       // Student modifizieren
       student.setVorname(vorname);
       student.setNachname(nachname);
       student.setKontakt(kontakt);
       // matrikelnummer darf nicht geandert werden, da sie Primaerschluessel ist
       student.setBetreuer(betreuer);
       student.setThema(thema);
       student.setSemester(semester);
       student.setKommentar(kommentar);
      
       student.setVb1(new Boolean(vb1));
       student.setVb2(new Boolean(vb2));
       student.setNb(new Boolean(nb));
       student.setSa(new Boolean(sa));
       student.setVertrag(new Boolean(vertrag));
       student.setZeugnis(new Boolean(zeugnis));
       } catch (Exception e) {
       System.err.println(e.getMessage());
       return false;
       }
      
       return true;
       }
       /**
       * Business method
       * @ejb.interface-method view-type = "remote"
       * loescht einen Studenten
       */
       public boolean deleteStudent(String matrikelnummer) {
       // TODO Auto-generated method stub
       System.out.println("deleteStudent(Student s) wurde aufgerufen");
      
       try {
       InitialContext ctx = new InitialContext(System.getProperties());
       // Local Home Interface der Entity Bean holen
       StudentEntityLocalHome localHome = (StudentEntityLocalHome) ctx
       .lookup(StudentEntityLocalHome.JNDI_NAME);
       // Local Interface holen
       StudentEntityLocal student = localHome
       .findByPrimaryKey(new StudentEntityPK(matrikelnummer));
       // Studenten loeschen
       student.remove();
       } catch (Exception e) {
       System.err.println(e.getMessage());
       return false;
       }
       return true;
       }
       /**
       * Business method
       * @ejb.interface-method view-type = "remote"
       * liefert einen bestimmten Studenten anhand seiner Matrikelnummer
       */
       public de.gaege.datenobjekte.Student getStudent(String matrikelnummer) {
       try {
       InitialContext ctx = new InitialContext(System.getProperties());
       // Local Home Interface der Entity Bean holen
       StudentEntityLocalHome localHome = (StudentEntityLocalHome) ctx
       .lookup(StudentEntityLocalHome.JNDI_NAME);
       // Local Interface holen
       StudentEntityLocal student = localHome
       .findByPrimaryKey(new StudentEntityPK(matrikelnummer));
      
       // Neuen Studenten zusammenbauen
       Student s = new Student();
       s.setVorname(student.getVorname());
       s.setNachname(student.getNachname());
       s.setKontakt(student.getKontakt());
       s.setMatrikelnummer(student.getMatrikelnummer());
       s.setSemester(student.getSemester());
       s.setThema(student.getThema());
       s.setBetreuer(student.getBetreuer());
       s.setKommentar(student.getKommentar());
       s.setVb1(student.getVb1().booleanValue());
       s.setVb2(student.getVb2().booleanValue());
       s.setNb(student.getNb().booleanValue());
       s.setSa(student.getSa().booleanValue());
       s.setVertrag(student.getVertrag().booleanValue());
       s.setZeugnis(student.getZeugnis().booleanValue());
      
       // den Studenten zurueckgeben
       return s;
      
       } catch (Exception e) {
       System.err.println(e.getMessage());
       return null;
       }
      
       }
       /**
       * Business method
       * @ejb.interface-method view-type = "remote"
       * gibt eine ArrayList aller Studenten zurueck
       */
       public ArrayList getAllStudents() {
       // TODO Auto-generated method stub
       ArrayList studentenListe = null;
      
       try {
       InitialContext ctx = new InitialContext(System.getProperties());
       // Local Home Interface der Entity Bean holen
       StudentEntityLocalHome localHome = (StudentEntityLocalHome) ctx
       .lookup(StudentEntityLocalHome.JNDI_NAME);
       // Collection aller Studenten ueber das LocalHomeInterface holen
       Collection c = localHome.findAll();
       // Collection in ArrayList umwandeln
       studentenListe = convertToArrayList(c);
       // Liste der Studenten zurueck geben
       return studentenListe;
      
       } catch (Exception e) {
       System.err.println(e.getMessage());
       return null;
       }
      
       }
       /**
       * Business method
       * @ejb.interface-method view-type = "remote"
       * Gibt alle Studenten eines Betreuers zurueck
       */
       public ArrayList getStudentsByBetreuer(String betreuer) {
       // TODO Auto-generated method stub
       ArrayList studentenListe = null;
       try {
       InitialContext ctx = new InitialContext(System.getProperties());
       // Local Home Interface der Entity Bean holen
       StudentEntityLocalHome localHome = (StudentEntityLocalHome) ctx.lookup(StudentEntityLocalHome.JNDI_NAME);
       // Collection aller Studenten des Betreuers ueber das LocalHomeInterface holen
       Collection c = localHome.findByBetreuer(betreuer);
       // Collection in ArrayList umwandeln
       studentenListe = convertToArrayList(c);
       // Liste der Studenten des Betreuers zurueck geben
       return studentenListe;
       }
       catch(Exception e){
       System.out.println(e.getMessage());
       return null;
       }
       }
      
       // Collection der EntityBean in eine ArrayList aus Studenten umwandeln
       private static ArrayList convertToArrayList(Collection c) {
       // ArrayList anlegen
       ArrayList list = new ArrayList();
       // Iterator fuer die Collection holen
       Iterator iterator = c.iterator();
       while(iterator.hasNext()) {
       StudentEntityLocal currentLocal= (StudentEntityLocal)iterator.next();
       // Neuen Studenten erstellen
       Student s = new Student();
       s.setVorname(currentLocal.getVorname());
       s.setNachname(currentLocal.getNachname());
       s.setKontakt(currentLocal.getKontakt());
       s.setMatrikelnummer(currentLocal.getMatrikelnummer());
       s.setSemester(currentLocal.getSemester());
       s.setThema(currentLocal.getThema());
       s.setBetreuer(currentLocal.getBetreuer());
       s.setKommentar(currentLocal.getKommentar());
       s.setVb1(currentLocal.getVb1().booleanValue());
       s.setVb2(currentLocal.getVb2().booleanValue());
       s.setNb(currentLocal.getNb().booleanValue());
       s.setSa(currentLocal.getSa().booleanValue());
       s.setVertrag(currentLocal.getVertrag().booleanValue());
       s.setZeugnis(currentLocal.getZeugnis().booleanValue());
      
       // Student in die ArrayList eintragen
       list.add(s);
       }
      
       // ArrayList mit Studenten zurueck geben
       return list;
       }
      
      
      
      }



      Remote Interface

      /*
       * Generated by XDoclet - Do not edit!
       */
      package de.gaege.session.facade.interfaces;
      
      /**
       * Remote interface for StudentSessionFacade.
       * @xdoclet-generated at ${TODAY}
       * @copyright The XDoclet Team
       * @author XDoclet
       * @version ${version}
       */
      public interface StudentSessionFacade
       extends javax.ejb.EJBObject
      {
       /**
       * Business method
       */
       public boolean createStudent( de.gaege.datenobjekte.Student s )
       throws java.rmi.RemoteException;
      
       /**
       * Business method
       */
       public boolean updateStudent( de.gaege.datenobjekte.Student s )
       throws java.rmi.RemoteException;
      
       /**
       * Business method
       */
       public boolean deleteStudent( java.lang.String matrikelnummer )
       throws java.rmi.RemoteException;
      
       /**
       * Business method
       */
       public de.gaege.datenobjekte.Student getStudent( java.lang.String matrikelnummer )
       throws java.rmi.RemoteException;
      
       /**
       * Business method
       */
       public java.util.ArrayList getAllStudents( )
       throws java.rmi.RemoteException;
      
       /**
       * Business method
       */
       public java.util.ArrayList getStudentsByBetreuer( java.lang.String betreuer )
       throws java.rmi.RemoteException;
      
      }
      



      Can anyone help me?

      Thanks, in advance

      Christian