3 Replies Latest reply on Dec 30, 2002 4:00 PM by Mark

    Error 'FROM not found' in the CMP 2.0 Entity Bean from Maste

    Mark Newbie

      I use the Mastering Enterprise JavaBeans Book written by Ed Roman - Second Edition. At the moment I'm trying to deploy the Product Entity Bean from the Book on the JBOSS Server. But I can't figure out how to set up right. I attached the sources and would appreciate any help.

      I use the following configuration:
      OS: MS Win2k 5.00.2195
      MySQL: mysql-3.23.53-win
      ConnectorJ: mysql-connector-java-2.0.14
      JBOSS: jboss-3.0.3_tomcat-4.1.12
      Ant: 1.5.1

      The JBOSS server log reports the following error:
      2002-12-29 18:50:31,375 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Java/jboss-3.0.3_tomcat-4.1.12/server/default/deploy/ProductEJB.jar
      2002-12-29 18:50:31,465 INFO [org.jboss.ejb.EJBDeployer]
      Bean : Product
      Method : public String ejbCreate(String, String, String, double)
      Section: 10.6.4
      Warning: The throws clause must define the javax.ejb.CreateException.

      2002-12-29 18:50:31,475 INFO [org.jboss.ejb.EjbModule] Creating
      2002-12-29 18:50:31,495 INFO [org.jboss.ejb.EjbModule] Deploying Product
      2002-12-29 18:50:31,615 INFO [org.jboss.ejb.EjbModule] Created
      2002-12-29 18:50:31,625 INFO [org.jboss.ejb.EjbModule] Starting
      2002-12-29 18:50:32,887 INFO [org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.Product] Table 'PRODUCT' already exists
      2002-12-29 18:50:33,037 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=Product,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: FROM not found)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:44)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:218)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:463)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:369)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
      at org.jboss.ejb.Container.invoke(Container.java:756)
      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:976)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:397)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      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 $Proxy23.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      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:976)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:397)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      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.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:394)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
      at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      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:427)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:648)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:499)
      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)
      Caused by: org.jboss.ejb.plugins.cmp.ejbql.ParseException: FROM not found
      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.parse(EJBQLParser.java:38)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler.compileEJBQL(JDBCEJBQLCompiler.java:144)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:40)
      ... 54 more
      2002-12-29 18:50:33,047 INFO [org.jboss.ejb.EjbModule] Started
      2002-12-29 18:50:33,047 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Java/jboss-3.0.3_tomcat-4.1.12/server/default/deploy/ProductEJB.jar
      2002-12-29 18:50:33,057 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: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: FROM not found)]

        • 1. Re: Error 'FROM not found' in the CMP 2.0 Entity Bean from M
          Mark Newbie

          ...the attached files

          • 2. Re: Error 'FROM not found' in the CMP 2.0 Entity Bean from M
            Mark Newbie

            I'm proud to report some progress in setting up the bean. After modification of the finder methods in ejb-jar.xml the application works fine.
            here is the source:

            --------------
            <?xml version="1.0"?>

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

            <ejb-jar>
            <enterprise-beans>

            <ejb-name>Product</ejb-name>
            examples.ProductHome
            examples.Product
            <ejb-class>examples.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>description</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>basePrice</field-name>
            </cmp-field>

            <primkey-field>productID</primkey-field>

            <resource-ref>
            <res-ref-name>jdbc/TestDataSource</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>

            <security-identity>

            <use-caller-identity></use-caller-identity>
            </security-identity>


            <query-method>
            <method-name>findByName</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[
            SELECT OBJECT(a)
            FROM ProductBean a
            WHERE a.name = ?1
            ]]></ejb-ql>



            <query-method>
            <method-name>findByDescription</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[
            SELECT OBJECT(a)
            FROM ProductBean a
            WHERE a.description = ?1
            ]]></ejb-ql>



            <query-method>
            <method-name>findByBasePrice</method-name>
            <method-params>
            <method-param>double</method-param>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[
            SELECT OBJECT(a)
            FROM ProductBean a
            WHERE a.basePrice = ?1
            ]]></ejb-ql>



            <query-method>
            <method-name>findExpensiveProducts</method-name>
            <method-params>
            <method-param>double</method-param>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[
            SELECT OBJECT(a)
            FROM ProductBean a
            WHERE a.basePrice > ?1
            ]]></ejb-ql>



            <query-method>
            <method-name>findCheapProducts</method-name>
            <method-params>
            <method-param>double</method-param>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[
            SELECT OBJECT(a)
            FROM ProductBean a
            WHERE a.basePrice < ?1
            ]]></ejb-ql>



            <query-method>
            <method-name>findAllProducts</method-name>
            <method-params>
            </method-params>
            </query-method>
            <ejb-ql><![CDATA[
            SELECT OBJECT(a)
            FROM ProductBean a
            WHERE a.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>

            • 3. After shutting down the database the CMP entity bean still w
              Mark Newbie

              After some testing I found that the application still works after shutting down the database. How can persistence work after shutting down the database? I guess there is no "magic" going on here but setting in the entity tag in jbosscmp-jdbc.xml is not allowed. Any help would be appreciated.

              Regards,
              Zaphod