1 Reply Latest reply on Jan 31, 2003 1:38 AM by mohan

    CMP deployment problem

    mohan Newbie

      Hi all,

      The following message is flushed by JBoss when I try to deploy the following files.

      ----------
      2003-01-31 09:06:38,700 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/jboss3.0/server/default/deploy/ProductEJB.jar
      2003-01-31 09:06:39,080 INFO [org.jboss.ejb.EJBDeployer]
      Bean : Product
      Section: 9.2.2
      Warning: The entity bean class must not be defined as abstract.

      2003-01-31 09:06:39,080 INFO [org.jboss.ejb.EJBDeployer]
      Bean : Product
      Method : public abstract Product ejbFindByPrimaryKey(String) throws FinderException, RemoteException
      Section: 9.2.8
      Warning: Each method defined in the entity bean's home interface must be either create or finder method.

      2003-01-31 09:06:39,080 INFO [org.jboss.ejb.EJBDeployer]
      Bean : Product
      Section: 9.4.7.1
      Warning: The primkey-field element must name a public field in the bean implementation class.

      2003-01-31 09:06:39,080 INFO [org.jboss.ejb.EjbModule] Creating
      2003-01-31 09:06:39,140 INFO [org.jboss.ejb.EjbModule] Deploying Product
      2003-01-31 09:06:39,360 WARN [org.jboss.system.ServiceController] Problem creating service jboss.j2ee:jndiName=Product,service=EJB
      org.jboss.deployment.DeploymentException: Could not find matching method for public abstract ejbProduct.Product ejbProduct.ProductHome.ejbFindByPrimaryKey(java.lang.String) throws javax.ejb.FinderException,java.rmi.RemoteException
      at org.jboss.ejb.EntityContainer.setupHomeMappingImpl(EntityContainer.java:835)
      at org.jboss.ejb.EntityContainer.setupHomeMapping(EntityContainer.java:847)
      at org.jboss.ejb.EntityContainer.create(EntityContainer.java:321)
      at org.jboss.ejb.Container.invoke(Container.java:752)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      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 $Proxy37.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)
      2003-01-31 09:06:39,470 INFO [org.jboss.ejb.EjbModule] Created
      2003-01-31 09:06:39,470 INFO [org.jboss.ejb.EjbModule] Starting
      2003-01-31 09:06:39,470 INFO [org.jboss.ejb.EjbModule] Started
      2003-01-31 09:06:39,470 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/jboss3.0/server/default/deploy/ProductEJB.jar
      2003-01-31 09:06:39,470 ERROR [org.jboss.deployment.scanner.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=Product,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: org.jboss.deployment.DeploymentException: Could not find matching method for public abstract ejbProduct.Product ejbProduct.ProductHome.ejbFindByPrimaryKey(java.lang.String) throws javax.ejb.FinderException,java.rmi.RemoteException]

      -------------------------
      package ejbProduct;

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

      public interface ProductHome extends EJBHome
      {
      public Product create(String ProductId, String Name, double Price)throws CreateException, RemoteException;
      public Product ejbFindByPrimaryKey(String ProductId)throws FinderException, RemoteException;
      public java.util.Collection findByName(String Name)throws FinderException, RemoteException;
      public java.util.Collection findByPrice(double Price)throws FinderException, RemoteException;
      public java.util.Collection findExpensiveProducts(double minprice)throws FinderException, RemoteException;
      public java.util.Collection findCheapProducts(double maxprice)throws FinderException, RemoteException;
      public java.util.Collection findAllProducts()throws FinderException, RemoteException;
      }
      ------------------------

      package ejbProduct;

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

      public interface Product extends EJBObject
      {
      public String getName() throws RemoteException;
      public void setName(String Name) throws RemoteException;

      public double getPrice() throws RemoteException;
      public void setPrice(double Price) throws RemoteException;

      public String getProductId() throws RemoteException;
      }

      -------------------

      package ejbProduct;

      import javax.ejb.*;
      import javax.naming.*;
      import java.rmi.*;

      public abstract class ProductBean implements EntityBean
      {
      protected EntityContext ctx;

      public ProductBean()
      {
      }

      public abstract String getName();
      public abstract void setName(String Name);

      public abstract double getPrice();
      public abstract void setPrice(double Price);

      public abstract String getProductId();
      public abstract void setProductId(String ProductId);

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

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

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

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

      public void setEntityContext(EntityContext ctx)
      {
      this.ctx = ctx;
      System.out.println("setEntityContext("+ctx+") called");
      }

      public void unsetEntityContext()
      {
      this.ctx = null;
      System.out.println("unsetEntityContext() called");
      }

      public void ejbPostCreate(String ProductId, String Name, double Price)
      {
      System.out.println("ejbPostCreate() called");
      }

      //public ProductPK ejbCreate(String productId, String name, double price) throws CreateException
      public String ejbCreate(String ProductId, String Name, double Price) throws CreateException
      {
      System.out.println ("ejbCreate() caled");
      setProductId(ProductId);
      setName(Name);
      setPrice(Price);
      //return(new ProductPK(productId));
      return(ProductId);
      }
      }

      -----------------------

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

      <ejb-jar>
      <enterprise-beans>

      <ejb-name>Product</ejb-name>
      ejbProduct.ProductHome
      ejbProduct.Product
      <ejb-class>ejbProduct.ProductBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False

      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>ProductBean</abstract-schema-name>
      <cmp-field><field-name>ProductId</field-name></cmp-field>
      <cmp-field><field-name>Name</field-name></cmp-field>
      <cmp-field><field-name>Price</field-name></cmp-field>
      <primkey-field>ProductId</primkey-field>

      <query-method>
      <method-name>findByName</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[WHERE Name = ?1]]>
      </ejb-ql>


      <query-method>
      <method-name>findByPrice</method-name>
      <method-params>
      <method-param>double</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[WHERE Price = ?1]]>
      </ejb-ql>


      <query-method>
      <method-name>findExpensiveProducts</method-name>
      <method-params>
      <method-param>double</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[WHERE Price > ?1]]>
      </ejb-ql>


      <query-method>
      <method-name>findCheapestProducts</method-name>
      <method-params>
      <method-param>double</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[WHERE Price < ?1]]>
      </ejb-ql>


      <query-method>
      <method-name>findAllProducts</method-name>
      <method-params>
      </method-params>
      </query-method>
      <ejb-ql>
      <![CDATA[WHERE ProductID IS NOT NULL]]>
      </ejb-ql>


      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>Product</ejb-name>
      <method-intf>Remote</method-intf>
      <method-name>*</method-name>

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

      --------------------

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


      <enterprise-beans>

      <ejb-name>Product</ejb-name>
      <jndi-name>Product</jndi-name>
      <local-jndi-name>ProductLocal</local-jndi-name>

      </enterprise-beans>


      -----------------

      <?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>Product</ejb-name>
      <table-name>Products</table-name>
      <cmp-field>
      <field-name>ProductId</field-name>
      <column-name>ProductId</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>Name</field-name>
      <column-name>Name</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>Price</field-name>
      <column-name>Price</column-name>
      </cmp-field>

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

        • 1. Re: CMP deployment problem
          mohan Newbie

          Hi again,

          I've rectified most of the errors. only error now left out is

          Starting
          2003-01-31 12:10:57,010 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Product] Table 'PRODUCTS' already exists
          2003-01-31 12:10:57,070 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=RemoteProductHome,service=EJB
          org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "Price" at line 1, column 46.
          Was expecting one of:
          "NOT" ...
          "(" ...
          <COLLECTION_VALUED_PATH> ...
          <STRING_VALUED_PATH> ...
          "CONCAT" ...
          "SUBSTRING" ...
          <BOOLEAN_VALUED_PATH> ...
          <DATETIME_VALUED_PATH> ...
          <ENTITY_VALUED_PATH> ...
          <IDENTIFICATION_VARIABLE> ...
          <NUMERIC_VALUED_PATH> ...
          "LENGTH" ...
          "LOCATE" ...
          "ABS" ...
          "SQRT" ...
          "+" ...
          "-" ...
          <INTEGER_LITERAL> ...
          <FLOATING_POINT_LITERAL> ...
          <NUMERIC_VALUED_PARAMETER> ...
          )

          pls suggest me a soln
          Thanx in advance

          Mohan