2 Replies Latest reply on Jun 27, 2005 2:25 AM by talkinjive

    entityBean - error while parsing ejb-jar.xml ...!

    talkinjive Newbie

      Hi !

      JBoss (4.0) doesn't want my ejb-jar.xml (generated with XDoclet). I don't understand why. It only wants the findAll query (without '= ?1') but not queries with parameter '?1'. The '=?1' seems to be the problem.

      ejb-jar.xml :
      ...

      <query-method>
      <method-name>findByPrenom</method-name>
      <method-params>
      </method-params>
      </query-method>
      <result-type-mapping>Remote</result-type-mapping>
      <ejb-ql>[CDATA[SELECT OBJECT(testCMP2) from TestCMP2 testCMP2 where testCMP2.prenom = ?1]]</ejb-ql>

      ...

      server.log :
      2005-06-23 16:24:25,756 ERROR [org.jboss.ejb.EntityContainer] Starting failed jboss.j2ee:jndiName=metier/entite/TestCMP2,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(testCMP2) from TestCMP2 testCMP2 where testCMP2.prenom = ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 72.
      Was expecting one of:
      "CONCAT" ...
      "SUBSTRING" ...
      "(" ...
      <STRING_LITERAL> ...
      <STRING_VALUED_PARAMETER> ...
      <STRING_VALUED_PATH> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:52)
      ...
      org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      Caused by: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 72.
      Was expecting one of:
      "CONCAT" ...
      "SUBSTRING" ...
      "(" ...
      <STRING_LITERAL> ...
      <STRING_VALUED_PARAMETER> ...
      <STRING_VALUED_PATH> ...

      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.generateParseException(EJBQLParser.java:4573)
      ... at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:43)
      ... 76 more
      2005-06-23 16:24:26,506 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=metier/entite/TestCMP2,service=EJB
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(testCMP2) from TestCMP2 testCMP2 where testCMP2.prenom = ?1'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 72.
      Was expecting one of:
      "CONCAT" ...
      "SUBSTRING" ...
      "(" ...
      <STRING_LITERAL> ...
      <STRING_VALUED_PARAMETER> ...
      <STRING_VALUED_PATH> ...
      )
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:52)
      ...
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      Caused by: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 72.
      Was expecting one of:
      "CONCAT" ...
      "SUBSTRING" ...
      "(" ...
      <STRING_LITERAL> ...
      <STRING_VALUED_PARAMETER> ...
      <STRING_VALUED_PATH> ...

      at org.jboss.ejb.plugins.cmp.ejbql.EJBQLParser.generateParseException(EJBQLParser.java:4573)
      ...
      org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:43)
      ... 76 more

      Can anyone help me ?
      Thank you.
      TalkinJive.

        • 1. Re: entityBean - error while parsing ejb-jar.xml ...!
          Stephen Alba Newbie

          Your original findByPrenom does not seem to have a parameter.

          <query-method>
          <method-name>findByPrenom</method-name>
          <method-params>
          </method-params>
          </query-method>
          <result-type-mapping>Remote</result-type-mapping>


          Your Xdoclet is suppose to generate
          <query-method>
          <method-name>findByPrenom</method-name>
          <method-params>
           <method-param>java.lang.Integer</method-param>
          </method-params>
          </query-method>
          <result-type-mapping>Remote</result-type-mapping>

          So that it would accept at least one parameter.

          Hope this xdoclet helps
          @ejb.finder view-type="remote" signature="java.util.Collection
           findByPrenom(java.lang.Integer prenomNo)"
           query="SELECT object(o) FROM PrenomSchema o WHERE
           o.prenom = ?1"



          • 2. Re: entityBean - error while parsing ejb-jar.xml ...!
            talkinjive Newbie

            Hi Salba,

            Thank you very much. Stupid of me to forget the parameter !

            TalkinJive.

            PS : I think 'result-type-mapping = "Remote"' is better than 'view-type="remote"'.