7 Replies Latest reply on Dec 18, 2002 5:13 AM by Hans Bausewein

    Errors in JBoss.3.0TemplateAndExamples.zip 'template' ??

    Hans Bausewein Newbie

      My own template-derived application did not work, so I went back to try the template from 'JBoss.3.0TemplateAndExamples.zip'.

      For the complete output of the server log see the attachment.

      1. test/TestEntity: The ejb-name for a CMP 2.x Entity must be a valid Java Identifier.
      === so I modify this to just TestEntity.

      2. Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.
      === I guess this means I have to copy the query row from '@jboss:finder-query' to '@ejb:finder' !? But then I get
      DeploymentExceptions :-(

      any ideas?

      I try to run JBoss on Linux 2.2.17
      and JDK 1.4.1_01.

        • 1. Re: Errors in JBoss.3.0TemplateAndExamples.zip 'template' ??
          Hans Bausewein Newbie

          Attach FIles apparently does not work, at least not for Opera for Linux users, so here it is in a probably messy format:
          2002-12-16 17:58:46,032 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/usr/share/java/jboss-3.0.4/server/default/deploy/ejb-test.jar
          2002-12-16 17:58:46,097 WARN [org.jboss.metadata.EntityMetaData] test/TestEntity: The ejb-name for a CMP 2.x Entity must be a valid Java Identifier
          2002-12-16 17:58:46,108 WARN [org.jboss.metadata.EntityMetaData] test/TestEntity: The abstract-schema-name must be a valid Java Identifier 'test/TestEntity'
          2002-12-16 17:58:46,437 INFO [org.jboss.ejb.EJBDeployer]
          Bean : test/TestEntity
          Method : public abstract TestEntity findAnotherByName(int, String, String) throws RemoteException, FinderException
          Section: 10.5.6
          Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.

          2002-12-16 17:58:46,438 INFO [org.jboss.ejb.EJBDeployer]
          Bean : test/TestEntity
          Method : public abstract TestEntity findByName(String, String) throws RemoteException, FinderException
          Section: 10.5.6
          Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.

          • 2. Re: Errors in JBoss.3.0TemplateAndExamples.zip 'template' ??
            Hans Bausewein Newbie

            If this one will show up twice, don't blame me, because I had to login (which I had done already!) and got an error, so the
            message did not get here. Next try. (always save your message before posting!).

            I'll answer my own questions ;-)

            These are the changes, I've made to TestEntityBean.java and now it deploys without warnings or exceptions.

            1. @ejb:bean name="test/TestEntity"
            replaced by
            @ejb:bean name="TestEntity"

            This to avoid the deployment message that
            "The ejb-name for a CMP 2.x Entity must be a valid Java Identifier."

            I modified the ejb-name and ejb-ref tags for SequenceGenerator also.

            * In 'TestEntityBean.java': @ejb:ejb-ref ejb-name="SequenceGenerator"

            * In 'TestSessionBean.java' @ejb:ejb-ref ejb-name="TestEntity"
            ref-name="mytest/TestEntity"

            * On 'SequenceGeneratorBean.java': @ejb:bean name="SequenceGenerator"


            2. Removed '@jboss:finder-query'

            3. Added the queries to '@jboss:finder' as:
            - findByName:
            query="SELECT OBJECT(t) FROM TestEntity t WHERE t.firstName = ?1
            AND t.lastName = ?2"

            - findAnotherByName:
            query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id <> ?1 AND
            t.firstName = ?2 AND t.lastName = ?3"

            changes:
            * it needs the full query including SELECT ... WHERE
            * != replaced by <>
            * {n} replaced by ?n (using n=1..3 instead of n=0..2 )


            I used xdoclet 1.1.2, which is the latest stable version.

            hope this helps.

            Hans


            ===== the new xdoclet header for TestEntityBean ======
            * The Entity bean represents a TestEntity
            *
            * @author Andreas Schaefer
            * @version $Revision: 1.1 $
            *
            * @ejb:bean name="TestEntity"
            * display-name="TestEntity working on projects to support clients"
            * type="CMP"
            * jndi-name="ejb/test/TestEntity"
            *
            * @ejb:env-entry name="SequenceName"
            * value="TestEntity"
            *
            * @ejb:ejb-ref ejb-name="SequenceGenerator"
            *
            * @ejb:transaction type="Required"
            *
            * @ejb:data-object extends="test.interfaces.AbstractData"
            * setdata="false"
            *
            * @ejb:finder signature="java.util.Collection findAll()"
            *
            * @ejb:finder signature="test.interfaces.TestEntity findByName( java.lang.String pSurname, java.lang.String pLastName )"
            * query="SELECT OBJECT(t) FROM TestEntity t WHERE t.firstName = ?1 AND t.lastName = ?2"
            *
            *
            * @ejb:finder signature="test.interfaces.TestEntity findAnotherByName( int pId, java.lang.String pSurname, java.lang.String pLastName )"
            * query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id <> ?1 AND t.firstName = ?2 AND t.lastName = ?3"
            *
            *
            * @jboss:table-name table-name="TestEntity"
            *
            * @jboss:create-table create="true"
            *
            * @jboss:remove-table remove="true"

            • 3. Re: Errors in JBoss.3.0TemplateAndExamples.zip 'template' ??
              Hans Bausewein Newbie

              If this one will show up twice, don't blame me, because I had to login
              (which I had done already!) and got an error, so the
              message did not get here. Next try. (always save your message before
              posting!).

              I'll answer my own questions ;-)

              These are the changes, I've made to TestEntityBean.java and now it deploys
              without warnings or exceptions.

              1. @ejb:bean name="test/TestEntity"
              replaced by
              @ejb:bean name="TestEntity"

              This to avoid the deployment message that
              "The ejb-name for a CMP 2.x Entity must be a valid Java Identifier."

              I modified the ejb-name and ejb-ref tags for SequenceGenerator also.

              * In 'TestEntityBean.java': @ejb:ejb-ref ejb-name="SequenceGenerator"

              * In 'TestSessionBean.java' @ejb:ejb-ref ejb-name="TestEntity"
              ref-name="mytest/TestEntity"

              * On 'SequenceGeneratorBean.java': @ejb:bean name="SequenceGenerator"


              2. Removed '@jboss:finder-query'

              3. Added the queries to '@jboss:finder' as:
              - findByName:
              query="SELECT OBJECT(t) FROM TestEntity t WHERE t.firstName = ?1
              AND t.lastName = ?2"

              - findAnotherByName:
              query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id <> ?1 AND
              t.firstName = ?2 AND t.lastName = ?3"

              changes:
              * it needs the full query including SELECT ... WHERE
              * != replaced by <>
              * {n} replaced by ?n (using n=1..3 instead of n=0..2 )


              I used xdoclet 1.1.2, which is the latest stable version.

              hope this helps.

              Hans


              ===== the new xdoclet header for TestEntityBean ======
              * The Entity bean represents a TestEntity
              *
              * @author Andreas Schaefer
              * @version $Revision: 1.1 $
              *
              * @ejb:bean name="TestEntity"
              * display-name="TestEntity working on projects to support
              clients"
              * type="CMP"
              * jndi-name="ejb/test/TestEntity"
              *
              * @ejb:env-entry name="SequenceName"
              * value="TestEntity"
              *
              * @ejb:ejb-ref ejb-name="SequenceGenerator"
              *
              * @ejb:transaction type="Required"
              *
              * @ejb:data-object extends="test.interfaces.AbstractData"
              * setdata="false"
              *
              * @ejb:finder signature="java.util.Collection findAll()"
              *
              * @ejb:finder signature="test.interfaces.TestEntity findByName(
              java.lang.String pSurname, java.lang.String pLastName )"
              * query="SELECT OBJECT(t) FROM
              TestEntity t WHERE t.firstName = ?1 AND t.lastName = ?2"
              *
              *
              * @ejb:finder signature="test.interfaces.TestEntity
              findAnotherByName( int pId, java.lang.String pSurname,
              java.lang.String pLastName )"
              * query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id <>
              ?1 AND t.firstName = ?2 AND t.lastName = ?3"
              *
              *
              * @jboss:table-name table-name="TestEntity"
              *
              * @jboss:create-table create="true"
              *
              * @jboss:remove-table remove="true"





              NOTE: 3rd try to post (with the saved message), now with
              Netscape 6.2 for Linux

              • 4. Re: Errors in JBoss.3.0TemplateAndExamples.zip 'template' ??
                Hans Bausewein Newbie

                If this one will show up twice, don't blame me, because I had to login
                (which I had done already!) and got an error, so the
                message did not get here. Next try. (always save your message before
                posting!).

                I'll answer my own questions ;-)

                These are the changes, I've made to TestEntityBean.java and now it deploys
                without warnings or exceptions.

                1. @ejb:bean name="test/TestEntity"
                replaced by
                @ejb:bean name="TestEntity"

                This to avoid the deployment message that
                "The ejb-name for a CMP 2.x Entity must be a valid Java Identifier."

                I modified the ejb-name and ejb-ref tags for SequenceGenerator also.

                * In 'TestEntityBean.java': @ejb:ejb-ref ejb-name="SequenceGenerator"

                * In 'TestSessionBean.java' @ejb:ejb-ref ejb-name="TestEntity"
                ref-name="mytest/TestEntity"

                * On 'SequenceGeneratorBean.java': @ejb:bean name="SequenceGenerator"


                2. Removed '@jboss:finder-query'

                3. Added the queries to '@jboss:finder' as:
                - findByName:
                query="SELECT OBJECT(t) FROM TestEntity t WHERE t.firstName = ?1
                AND t.lastName = ?2"

                - findAnotherByName:
                query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id <> ?1 AND
                t.firstName = ?2 AND t.lastName = ?3"

                changes:
                * it needs the full query including SELECT ... WHERE
                * != replaced by <>
                * {n} replaced by ?n (using n=1..3 instead of n=0..2 )


                I used xdoclet 1.1.2, which is the latest stable version.

                hope this helps.

                Hans






                • 5. Re: Errors in JBoss.3.0TemplateAndExamples.zip 'template' ??
                  Hans Bausewein Newbie

                  If this one will show up 5 times, don't blame me, because I had to login
                  (which I had done already!) and got an error, so the
                  message did not get here. Next try. (always save your message before
                  posting!).

                  I'll answer my own questions ;-)

                  These are the changes, I've made to TestEntityBean.java and now it deploys
                  without warnings or exceptions.

                  1. @ejb:bean name="test/TestEntity"
                  replaced by
                  @ejb:bean name="TestEntity"

                  This to avoid the deployment message that
                  "The ejb-name for a CMP 2.x Entity must be a valid Java Identifier."

                  I modified the ejb-name and ejb-ref tags for SequenceGenerator also.

                  * In 'TestEntityBean.java': @ejb:ejb-ref ejb-name="SequenceGenerator"

                  * In 'TestSessionBean.java' @ejb:ejb-ref ejb-name="TestEntity"
                  ref-name="mytest/TestEntity"

                  * On 'SequenceGeneratorBean.java': @ejb:bean name="SequenceGenerator"


                  2. Removed '@jboss:finder-query'

                  3. Added the queries to '@jboss:finder' as:
                  - findByName:
                  query="SELECT OBJECT(t) FROM TestEntity t WHERE t.firstName = ?1
                  AND t.lastName = ?2"

                  - findAnotherByName:
                  query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id <> ?1 AND
                  t.firstName = ?2 AND t.lastName = ?3"

                  changes:
                  * it needs the full query including SELECT ... WHERE
                  * != replaced by <>
                  * {n} replaced by ?n (using n=1..3 instead of n=0..2 )
                  * name of the db-field replaced by name of the property (which
                  is the only thing ejb-jar.xml knows about!)

                  I used xdoclet 1.1.2, which is the latest stable version.

                  hope this helps.

                  Hans


                  ===== the new xdoclet header for TestEntityBean ======
                  * The Entity bean represents a TestEntity
                  *
                  * @author Andreas Schaefer
                  * @version $Revision: 1.1 $
                  *
                  * @ejb:bean name="TestEntity"
                  * display-name="TestEntity working on projects to support
                  clients"
                  * type="CMP"
                  * jndi-name="ejb/test/TestEntity"
                  *
                  * @ejb:env-entry name="SequenceName"
                  * value="TestEntity"
                  *
                  * @ejb:ejb-ref ejb-name="SequenceGenerator"
                  *
                  * @ejb:transaction type="Required"
                  *
                  * @ejb:data-object extends="test.interfaces.AbstractData"
                  * setdata="false"
                  *
                  * @ejb:finder signature="java.util.Collection findAll()"
                  *
                  * @ejb:finder signature="test.interfaces.TestEntity findByName(
                  java.lang.String pSurname, java.lang.String pLastName )"
                  * query="SELECT OBJECT(t) FROM
                  TestEntity t WHERE t.firstName = ?1 AND t.lastName = ?2"
                  *
                  *
                  * @ejb:finder signature="test.interfaces.TestEntity
                  findAnotherByName( int pId, java.lang.String pSurname,
                  java.lang.String pLastName )"
                  * query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id <>
                  ?1 AND t.firstName = ?2 AND t.lastName = ?3"
                  *
                  *
                  * @jboss:table-name table-name="TestEntity"
                  *
                  * @jboss:create-table create="true"
                  *
                  * @jboss:remove-table remove="true"

                  • 7. Re: Errors in JBoss.3.0TemplateAndExamples.zip 'template' ??
                    Hans Bausewein Newbie

                    I've found a minor error in my 'fix'. See my last post on subject
                    "Problem building template example".