0 Replies Latest reply on Aug 30, 2007 11:25 AM by baroquew

    Error compiling EJB-QL statement ''; at startup

    baroquew

      I am posting my questions in the Beginners Corner as it is what I am: a beginner in Jboss and alike. Problem is, I have to carry on the development of an existing project.

      I have currently: a server (jboss 4.0.1sp1) on which a version of the project is running and two development platforms (none of which is guaranteed to be the one used to generate the version used on the server). I set up one of those platform exactly as the server (jboss 4.0.1sp1, postgresql-8.0.309.jdbc2ee, jre 1.5.0).

      This being said i can begin my question:

      on the platform i set up, on launching my application, i get:

      16:23:10,853 INFO [STDOUT] org.jboss.ejb.plugins.cmp.ejbql.ParseException: FROM not found
      16:23:10,853 INFO [STDOUT] at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.parse(EJBQLParser.java:39)



      16:23:10,900 ERROR [EntityContainer] Starting failed jboss.j2ee:jndiName=ContactsEntityLocal,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement ''; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: FROM not found)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:52)


      16:23:10,932 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=ContactsEntityLocal,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement ''; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: FROM not found)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:52)


      as error messages.

      I have had those error messages for almost every single bean in the project (in different occasions), and more generally speaking, my finder functions seem to cause troubles (findAll and findByPrimaryKey namely). I managed to debug a few files without really knowing how (I checked on many forums but never really found a solution, i just got ideas where to look from there), until I decided to compare the ejb-jar.xml and jbosscmp-jdbc.xml (among others) between my development platform and the .ear file on the server. And they are the same, so I really wonder where my problems are coming from.

      Here is my ejb-jar.xml fragment about that bean

      <entity >
       <description><![CDATA[Description for ContactsEntity]]></description>
       <display-name>Name for ContactsEntity</display-name>
      
       <ejb-name>ContactsEntity</ejb-name>
      
       <local-home>com.opticall.dod.server.interfaces.ContactsEntityLocalHome</local-home>
       <local>com.opticall.dod.server.interfaces.ContactsEntityLocal</local>
      
       <ejb-class>com.opticall.dod.server.ejb.ContactsEntityCMP</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>java.lang.String</prim-key-class>
       <reentrant>False</reentrant>
       <cmp-version>2.x</cmp-version>
       <abstract-schema-name>ContactsEntity</abstract-schema-name>
       <cmp-field >
       <description><![CDATA[Getter for CMP Field lastname]]></description>
       <field-name>lastname</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[Getter for CMP Field firstname]]></description>
       <field-name>firstname</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[Getter for CMP Field phonenumber]]></description>
       <field-name>phonenumber</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[Getter for CMP Field username]]></description>
       <field-name>username</field-name>
       </cmp-field>
       <cmp-field >
       <description><![CDATA[Getter for CMP Field contactid]]></description>
       <field-name>contactid</field-name>
       </cmp-field>
       <primkey-field>contactid</primkey-field>
      
       <resource-ref >
       <res-ref-name>jdbc/DoDServerDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      
       <query>
       <query-method>
       <method-name>findAll</method-name>
       <method-params>
       </method-params>
       </query-method>
       <ejb-ql/>
       </query>
       <query>
       <query-method>
       <method-name>findMyContacts</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       <method-param>int</method-param>
       <method-param>int</method-param>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[SELECT OBJECT(o) FROM ContactsEntity o WHERE ((o.username LIKE ?1) OR (o.username LIKE ?4)) OFFSET ?3 LIMIT ?2]]></ejb-ql>
       </query>
       <query>
       <query-method>
       <method-name>findByLetter</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       <method-param>java.lang.String</method-param>
       <method-param>int</method-param>
       <method-param>int</method-param>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[SELECT OBJECT(o) FROM ContactsEntity o WHERE (((o.username LIKE ?1) OR (o.username LIKE ?5)) AND (o.lastname = ?2%)) ORDER BY o.lastname OFFSET ?4 LIMIT ?3]]></ejb-ql>
       </query>
       <query>
       <query-method>
       <method-name>findNumberOfContactsByLetter</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[SELECT COUNT (o.lastname) FROM ContactsEntity o WHERE ((o.username = ?1) AND (o.lastname = ?2%))]]></ejb-ql>
       </query>
       <query>
       <query-method>
       <method-name>findNumberOfContacts</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <ejb-ql><![CDATA[SELECT COUNT (o.lastname) FROM ContactsEntity o WHERE (o.username = ?1)]]></ejb-ql>
       </query>
       <!-- Write a file named ejb-finders-ContactsEntityBean.xml if you want to define extra finders. -->
      
       </entity>


      and the jbosscmp-jdbc.xml fragment:

      <entity>
       <ejb-name>ContactsEntity</ejb-name>
       <datasource>java:DoDServerDS</datasource>
       <datasource-mapping>PostgreSQL 7.2</datasource-mapping>
       <create-table>false</create-table>
       <remove-table>false</remove-table>
       <table-name>dodserver_contacts</table-name>
      
       <cmp-field>
       <field-name>lastname</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>firstname</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>phonenumber</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>username</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>contactid</field-name>
      
       </cmp-field>
      
       <query>
       <query-method>
       <method-name>findMyContacts</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       <method-param>int</method-param>
       <method-param>int</method-param>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <jboss-ql><![CDATA[SELECT OBJECT(o) FROM ContactsEntity o WHERE ((o.username LIKE ?1) OR (o.username LIKE ?4)) ORDER BY o.lastname OFFSET ?3 LIMIT ?2]]></jboss-ql>
       </query>
       <query>
       <query-method>
       <method-name>findByLetter</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       <method-param>java.lang.String</method-param>
       <method-param>int</method-param>
       <method-param>int</method-param>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <jboss-ql><![CDATA[SELECT OBJECT(o) FROM ContactsEntity o WHERE (((o.username LIKE ?1) OR (o.username LIKE ?5)) AND (o.lastname LIKE CONCAT(?2,'%'))) ORDER BY o.lastname OFFSET ?4 LIMIT ?3]]></jboss-ql>
       </query>
       <query>
       <query-method>
       <method-name>findNumberOfContactsByLetter</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <jboss-ql><![CDATA[SELECT COUNT (o.lastname) FROM ContactsEntity o WHERE ((o.username LIKE ?1) AND (o.lastname LIKE CONCAT (?2,'%')))]]></jboss-ql>
       </query>
       <query>
       <query-method>
       <method-name>findNumberOfContacts</method-name>
       <method-params>
       <method-param>java.lang.String</method-param>
       </method-params>
       </query-method>
       <jboss-ql><![CDATA[SELECT COUNT (o.lastname) FROM ContactsEntity o WHERE (o.username LIKE ?1)]]></jboss-ql>
       </query>
      
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>


      It's the way things are both on the up-and-running server and on the dev machine. Except that on the dev machine, it doesn't work. I tried adding (or not) the findAll to the jbosscmp-jdbc.xml, filling it in (or not) with the appropriate query code, but nothing.

      If you have any input, that would be very appreciated, even if you see something obvious, don't hesitate!

      Thank you

      baro

      (using eclipse 3.1.2, jbosside 1.6.0GA and xdoclet 4.0)