0 Replies Latest reply on Nov 19, 2002 12:47 AM by Eric Chow

    Unknown problem of EJBQL ParseException ????

    Eric Chow Newbie

      Hello,

      Would you please to tell me what did I make mistake?
      When I deploy an EAR to JBoss3.0.4, some exception encountered as following:
      ================================================
      2002-11-19 12:46:49,380 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=eric/foodsunion/local/FoodMenu,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 61.
      Was expecting one of:
      <VALUE_CLASS_VALUED_PARAMETER> ...
      <VALUE_CLASS_VALUED_PATH> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.(JDBCJBossQLQuery.java:46)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createJBossQLQuery(JDBCCommandFactory.java:54)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:203)
      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:978)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:398)
      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 $Proxy21.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
      at sun.reflect.GeneratedMethodAccessor14.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.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:398)
      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 $Proxy11.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:395)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:799)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
      at sun.reflect.GeneratedMethodAccessor10.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: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.startService(AbstractDeploymentScanner.java:261)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
      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:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:398)
      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 $Proxy3.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:569)
      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.server.ServerImpl.doStart(ServerImpl.java:324)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
      at org.jboss.Main.boot(Main.java:148)
      at org.jboss.Main$1.run(Main.java:381)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 61.
      Was expecting one of:
      <VALUE_CLASS_VALUED_PARAMETER> ...
      <VALUE_CLASS_VALUED_PATH> ...

      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.generateParseException(JBossQLParser.java:4803)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.jj_consume_token(JBossQLParser.java:4684)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ValueClassValue(JBossQLParser.java:1879)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ValueClassExpression(JBossQLParser.java:1885)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ComparisonExpression(JBossQLParser.java:1337)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.SimpleCondExpression(JBossQLParser.java:725)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ConditionalPrimary(JBossQLParser.java:671)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ConditionalTest(JBossQLParser.java:639)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ConditionalFactor(JBossQLParser.java:616)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ConditionalTerm(JBossQLParser.java:566)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.ConditionalExpression(JBossQLParser.java:526)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.WhereClause(JBossQLParser.java:495)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.EJBQL(JBossQLParser.java:108)
      at org.jboss.ejb.plugins.cmp.ejbql.JBossQLParser.parse(JBossQLParser.java:65)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler.compileJBossQL(JDBCEJBQLCompiler.java:179)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCJBossQLQuery.(JDBCJBossQLQuery.java:40)
      ... 85 more
      ==================================================

      And the following is my ejb-jar.xml an jbosscmp-jdbc.xml


      ejb-jar.xml
      =====================================
      <?xml version="1.0"?>

      <!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>
      <display-name>FoodsUnion System</display-name>


      <enterprise-beans>

      Restaurant EJB
      <ejb-name>RestaurantEJB</ejb-name>

      <local-home>eric.foodsunion.interfaces.RestaurantLocalHome</local-home>
      eric.foodsunion.interfaces.RestaurantLocal
      <ejb-class>eric.foodsunion.ejb.RestaurantEJB</ejb-class>

      <persistence-type>Container</persistence-type>
      <prim-key-class>eric.foodsunion.pk.RestaurantPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>restaurant</abstract-schema-name>

      <cmp-field><field-name>restaurantID</field-name></cmp-field>
      <cmp-field><field-name>restaurantName</field-name></cmp-field>


      <query-method>
      <method-name>findByRestaurantName</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>

      <ejb-ql>
      <![CDATA[
      SELECT OBJECT(a) FROM restaurant a WHERE a.restaurantName = ?1
      ]]>
      </ejb-ql>




      Food Menu EJB
      <ejb-name>MenuEJB</ejb-name>

      <local-home>eric.foodsunion.interfaces.MenuLocalHome</local-home>
      eric.foodsunion.interfaces.MenuLocal
      <ejb-class>eric.foodsunion.ejb.MenuEJB</ejb-class>

      <persistence-type>Container</persistence-type>
      <prim-key-class>eric.foodsunion.pk.MenuPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>foodmenu</abstract-schema-name>

      <cmp-field><field-name>menuID</field-name></cmp-field>




      <ejb-relation>
      <ejb-relation-name>Restaurant-Menu</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>restaurant-has-menu</ejb-relationship-role-name>

      One

      <relationship-role-source>
      restaurant
      <ejb-name>RestaurantEJB</ejb-name>
      </relationship-role-source>

      <cmr-field>
      menu
      <cmr-field-name>menu</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>menu-belongs-to-restaurants</ejb-relationship-role-name>

      Many
      <cascade-delete/>

      <relationship-role-source>
      <ejb-name>MenuEJB</ejb-name>
      </relationship-role-source>

      <cmr-field>
      <cmr-field-name>restaurants</cmr-field-name>
      <cmr-field-type>java.util.Set</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>



      <assembly-descriptor>
      <container-transaction>

      <ejb-name>RestaurantEJB</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>*</method-name>



      <ejb-name>MenuEJB</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>*</method-name>


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

      ======================================================




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

      <jbosscmp-jdbc>

      java:/MySqlDS
      <datasource-mapping>mySQL</datasource-mapping>

      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>
      <time-out>300</time-out>
      <pk-constraint>true</pk-constraint>
      <fk-constraint>false</fk-constraint>
      <row-locking>false</row-locking>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
      <read-ahead>
      on-load
      <page-size>1000</page-size>
      <eager-load-group>*</eager-load-group>
      </read-ahead>
      <list-cache-max>1000</list-cache-max>



      <enterprise-beans>

      <ejb-name>RestaurantEJB</ejb-name>
      <row-locking>true</row-locking>
      <table-name>restaurant</table-name>

      <cmp-field>
      <field-name>restaurantID</field-name>
      <column-name>restaurant_id</column-name>
      <not-null/>
      </cmp-field>
      <cmp-field>
      <field-name>restaurantName</field-name>
      <column-name>restaurant_name</column-name>
      <jdbc-type>BLOB</jdbc-type>
      <sql-type>BLOB</sql-type>
      <not-null/>
      </cmp-field>


      <query-method>
      <method-name>findByRestaurantName</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>

      <jboss-ql>
      <![CDATA[
      SELECT OBJECT(a) FROM restaurant a WHERE a.restaurantName = ?1
      ]]>
      </jboss-ql>





      <ejb-name>MenuEJB</ejb-name>
      <row-locking>true</row-locking>
      <table-name>foodmenu</table-name>

      <cmp-field>
      <field-name>menuID</field-name>
      <column-name>menu_id</column-name>
      <not-null/>
      </cmp-field>



      </enterprise-beans>



      <ejb-relation>
      <ejb-relation-name>Restaurant-Menu</ejb-relation-name>
      <foreign-key-mapping/>

      <ejb-relationship-role>
      <ejb-relationship-role-name>restaurant-has-menu</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>restaurantID</field-name>
      <column-name>restaurant_id</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>menu-belongs-to-restaurants</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>



      </jbosscmp-jdbc>

      ========================================================


      Please help me !!

      Eric