1 Reply Latest reply on Dec 30, 2004 2:29 PM by Miles Thomason

    EJB spec violation  when deploying CMP at Jboss 3.2.5.HELP P

    euclides Newbie

      Hy guys,
      i am trying to deploy an EJB since last week, but it is always a failure. I always get these 3 warning message:

      11:04:10,406 WARN [verifier] EJB spec violation:Bean : Empregado
      Bean : Empregado
      Section: 16.2
      Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods.

      11:04:10,406 WARN [verifier] EJB spec violation:
      Bean : Empregado
      Section: 16.2
      Warning: The Bean Provider must specify the fully-qualified name of the enterprise bean's home interface in the home element.

      11:04:10,406 WARN [verifier] EJB spec violation:
      Bean : Empregado
      Section: 9.4.7.2
      Warning: At least one field in the primary key class must be non-static.

      11:04:10,406 ERROR [MainDeployer] could not create deployment: file:/C:/jboss-3.2.5/server/default/deploy/Empregado.jar

      As follow, you can see the 4 main files:

      EJB FILE:
      <?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_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <ejb-name>Empregado</ejb-name>
      empregado.EmpregadoHome
      empregado.Empregado
      <ejb-class>empregado.EmpregadoBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      <prim-key-field>nome</prim-key-field>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>EmpregadoBean</abstract-schema-name>
      <cmp-field>
      <field-name>nome</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>sobrenome</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>salario</field-name>
      </cmp-field>

      </enterprise-beans>
      </ejb-jar>

      JBOSS.XML FILE
      <?xml version="1.0" ?>

      <enterprise-beans>

      <ejb-name>Empregado</ejb-name>
      <jndi-name>empregado.Empregado</jndi-name>

      </enterprise-beans>


      JBOSSCMP-JDBC.XML FILE
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC
      "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
      <jbosscmp-jdbc>

      java:/DefaultDS
      <datasource-mapping>Hypersonic SQL</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>true</remove-table>

      <enterprise-beans>

      <ejb-name>Empregado</ejb-name>
      <table-name>Empregado</table-name>
      <cmp-field>
      <field-name>nome</field-name>
      <column-name>NOME</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>sobrenome</field-name>
      <column-name>SOBRENOME</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>salario</field-name>
      <column-name>SALARIO</column-name>
      </cmp-field>

      </enterprise-beans>
      </jbosscmp-jdbc>

      EJB CLASS FILE

      package empregado.ejb;
      import java.rmi.RemoteException;
      import javax.ejb.*;

      public abstract class EmpregadoBean implements EntityBean{

      /*public String nome;
      public String sobrenome;
      public Double salario; */
      public EntityContext context;

      /* public EmpregadoBean()
      {
      } */

      public Empregado ejbCreate( String nome, String sobrenome, Double salario)
      throws CreateException
      {
      System.out.println("ejb empregado chamado!");
      setNome(nome);
      setSobreNome(sobrenome);
      setSalario(salario);
      return null;
      }

      public void ejbPostCreate( String nome )
      {
      System.out.println("ejbPostCreate empregado chamado!");
      }

      public void setEntityContext(EntityContext ctx) {
      context = ctx;
      }

      public void ejbRemove() {
      System.out.println("ejbRemove()");
      }

      public void ejbActivate() {
      System.out.println("ejbActivate()");
      }

      public void ejbPassivate() {
      System.out.println("ejbPassivate()");
      }

      /* (non-Javadoc)
      * @see javax.ejb.EntityBean#ejbLoad()
      */
      public void ejbLoad() throws EJBException {
      // TODO Auto-generated method stub

      }

      /* (non-Javadoc)
      * @see javax.ejb.EntityBean#ejbStore()
      */
      public void ejbStore() throws EJBException {
      // TODO Auto-generated method stub
      }
      public void unsetEntityContext() throws EJBException {
      this.context = null;
      }

      public abstract String getNome();

      public abstract void setNome(String nome);

      public abstract String getSobreNome();

      public abstract void setSobreNome(String sobrenome);

      public abstract Double getSalario();

      public abstract void setSalario(Double salario);
      }


      Finally, the jar file contains 2 directories: one (META-INF) for the 3 xml files above, and the another, called empregado, which contains the class above, the HOME INTERFACE "public interface EmpregadoHome extends EJBLocalHome" and the LOCAL INTERFACE "public interface Empregado extends EJBLocalObject";
      Any help will be appreciated!
      Thanks in advance, Euclides.