3 Replies Latest reply on Sep 27, 2003 9:08 PM by vashistvishal

    JBoss and EJB 2.0

    du-it

      I'm just doing my first steps using JBoss and EJB 2.0.

      I have implemented a bean called PersonBean with the corresponding home and remote interfaces.

      After jaring the classes JBoss throws some exceptions during deploying the EJB telling me that the bean class MUST be declared public and abstract.
      OK but the bean IS ALREADY declared public and abstract as you can see from the code below.

      What's the mistake I did??

      Here are the files that I put into the Person.jar file using:
      jar -cfv Person.jar META-INF/ de/

      1. the bean class:
      abstract public class PersonBean implements EntityBean
      {
      }

      2. the remote interface:
      public interface Person extends EJBObject
      {
      //public void setLastname(String name) throws RemoteException;
      //public void setFirstname(String name) throws RemoteException;

      //public String getFirstname() throws RemoteException;
      //public String getLastname() throws RemoteException;
      }

      3. the home interface:
      public interface PersonHome extends EJBHome
      {
      Person create(String firstname, String lastname) throws CreateException, RemoteException;
      }

      4. the primary key class:
      public class PersonPK implements Serializable
      {
      public Integer Person_ID;

      public PersonPK(){}
      }//end class PersonPK

      5. the ejb-jar.xml:
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
      "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar>
      <enterprise-beans>

      <ejb-name>PersonBean</ejb-name>
      de.duit.ejb.PersonHome
      de.duit.ejb.Person
      <ejb-class>de.duit.ejb.PersonBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>de.duit.ejb.PersonPK</prim-key-class>
      False
      <resource-ref>
      <res-ref-name>EjbTest</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      <cmp-version>2.x</cmp-version>
      <!--
      <cmp-field>
      <field-name>firstName</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>lastName</field-name>
      </cmp-field>
      -->

      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>PersonBean</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      6. jboss.xml (as I read in in this forum):
      <?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">


      <enterprise-beans>

      <ejb-name>PersonBean</ejb-name>
      <jndi-name>ejb/Person</jndi-name>

      </enterprise-beans>
      <resource-managers>
      </resource-managers>


      7. jaws.xml (as I read it somewhere else and a DB will be used later, of course):
      <!DOCTYPE jaws PUBLIC "-//du-it">

      <?xml version="1.0"?>

      <enterprise-beans>

      <ejb-name>Person</ejb-name>
      <table-name>BDM_Person</table-name>
      <create-table>false</create-table>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>Person_ID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>firstname</field-name>
      <column-name>firstname</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>lastname</field-name>
      <column-name>lastname</column-name>
      </cmp-field>

      </enterprise-beans>




      Hope, somebody can help me soon.

      Thanks a lot.

      Dirk