12 Replies Latest reply on Aug 8, 2003 3:05 AM by artmotion

    Problem with Template example: invalid ejb-name

    jiuyang

      Hi,

      I am using Jboss 3.2 with ANT 1.5.3-1, Xdoclet 1.1.2, and jdk1.3.1_02 on Win2K. I tried to deploy the template by following the exact steps in the Getting Started document, but encountered a problem.

      I created a build.properties, and changed the build.xml to point to this file. When I run 'ant main', jboss reported this error: "Error in ejb-jar.xml for Entity Bean test/TestEntity: The ejb-name for a CMP2.x Entity must be a valid Java Identifier"

      How to resolve this error? Thanks in advance.

      JiuYang

        • 1. Re: Problem with Template example: invalid ejb-name
          jiuyang

          Ok I found a reference on how to solve this problem in a previous thread - http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=

          • 2. Re: Problem with Template example: invalid ejb-name
            dtowers

            I am having the same problem you had. I followed the instructions in the other link and now I get the following, do you have any suggestions:


            [ejbdoclet] Running
            [ejbdoclet] Generating CMP class for 'test.entity.TestEntityBean'.
            [ejbdoclet] Running
            [ejbdoclet] Generating EJB deployment descriptor.
            [ejbdoclet] Running XDoclet failed.
            [ejbdoclet] <<No such EJB defined: test/TestEntity>>
            [ejbdoclet] 1 error
            [ejbdoclet] 27 warnings
            [ejbdoclet] javadoc: In doclet class xdoclet.DocletTask$DocletMain, method star
            t has thrown an exception java.lang.reflect.InvocationTargetException

            BUILD FAILED
            file:D:/apps/jboss/template/build.xml:147: Javadoc returned 1

            Total time: 14 seconds

            • 3. Re: Problem with Template example: invalid ejb-name
              jiuyang

              Hi,

              Did you change yr ejb-name xdoclet declaration to @ejb:bean name="TestEntity" in yr bean code?

              • 4. Re: Problem with Template example: invalid ejb-name
                omocha

                I have the same problem. When I run ant main:

                I got the following:

                [ejbdoclet] Running
                [ejbdoclet] javadoc: warning - Method test.message.TestMessageDrivenBean.ejbCrea
                te
                [ejbdoclet] documents that it throws javax.ejb.CreateException,
                [ejbdoclet] but does not declare it.
                [ejbdoclet] Running
                [ejbdoclet] 1 warning

                compile:

                jar:

                compile-web:

                war:

                deploy-server:

                create-client:
                [echo] JBoss Home on Unix: C:/containers/jboss-3.0.7_tomcat-4.1.24
                [echo] Java Home on Unix: C:/tools/jdk1.3.1_02/jre

                main:

                BUILD SUCCESSFUL
                Total time: 14 seconds

                Anyone can help with this

                Thanks!

                • 5. Re: Problem with Template example: invalid ejb-name
                  mdoherty

                  I have this problem also. I foillowed the instructions in the other thread and got:


                  xdoclet-generate:
                  [ejbdoclet] Generating Javadoc
                  [ejbdoclet] Javadoc execution
                  [ejbdoclet] Loading source file C:\JBoss.3.0TemplateAndExamples\template\src\mai
                  n\ejb\test\entity\TestBMPEntityBean.java...
                  [ejbdoclet] Loading source file C:\JBoss.3.0TemplateAndExamples\template\src\mai
                  n\ejb\test\entity\TestEntityBean.java...
                  [ejbdoclet] Loading source file C:\JBoss.3.0TemplateAndExamples\template\src\mai
                  n\ejb\test\message\TestMessageDrivenBean.java...
                  [ejbdoclet] Loading source file C:\JBoss.3.0TemplateAndExamples\template\src\mai
                  n\ejb\test\session\SequenceGeneratorBean.java...
                  [ejbdoclet] Loading source file C:\JBoss.3.0TemplateAndExamples\template\src\mai
                  n\ejb\test\session\TestSessionBean.java...
                  [ejbdoclet] Constructing Javadoc information...
                  [ejbdoclet] Running
                  [ejbdoclet] Running
                  [ejbdoclet] Running
                  [ejbdoclet] Running
                  [ejbdoclet] Running
                  [ejbdoclet] Running
                  [ejbdoclet] Running
                  [ejbdoclet] Running XDoclet failed.
                  [ejbdoclet] <<xdoclet.XDocletException: No such EJB defined: test/TestEntity>>
                  [ejbdoclet] 1 error
                  [ejbdoclet] javadoc: In doclet class xdoclet.DocletTask$DocletMain, method star
                  t has thrown an exception java.lang.reflect.InvocationTargetException

                  BUILD FAILED
                  file:C:/JBoss.3.0TemplateAndExamples/template/build.xml:147: Javadoc returned 1


                  Anybody got past this point ????

                  • 6. Re: Problem with Template example: invalid ejb-name
                    smile

                    Change the @ejb:bean name="test/TestSession" tag in TestSessionBean.java into @ejb:bean name = "TestSession".
                    This change is not stated in the other thread.....

                    • 7. Re: Problem with Template example: invalid ejb-name
                      mdoherty

                      Thanks for the suggestion but unfortunatly it did'nt work. Still get the same output as above.

                      Does anybody know what this error is telling us - why does it think this EJB is not defined and what stage of the xdoclet build process is this happening at ?

                      • 8. Re: Problem with Template example: invalid ejb-name
                        jandrews

                        I have implemented the changes in the reference message, and I'm still getting an error. Just to reiterate for users in this group (organized by file):

                        TestEntityBean.java:

                        a. remove "test/" from @ejb:bean everywhere it appears
                        b. remove "test/" from @ejb:ejb-ref
                        c. drop "@jboss:finder-query
                        d. add @jboss:finder name="findByName" query="SELECT OBJECT(t) FROM TestEntity t WHERE t.firstName = ?1 AND t.lastName = ?2"
                        e. add @jboss:finder name="findAnotherByName query="SELECT OBJECT(t) FROM TestEntity t WHERE t.id ?1 AND t.firstName = ?2 AND t.lastName = ?3"

                        SequenceGenerator.java:

                        a. remove "test/" from @ejb:bean wherever it shows up.

                        TestSessionBean.java:

                        a. remove "test/" from @ejb:ejb-rev ejb-name.

                        I'm now building successfully, but when I deploy, the jboss log gives me the following:

                        16:24:23,007 WARN [verifier] EJB spec violation:
                        Bean : 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.

                        16:24:23,007 WARN [verifier] EJB spec violation:
                        Bean : 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.

                        16:24:23,023 ERROR [MainDeployer] could not create deployment: file:/C:/APPS/jboss-3.2.1/server/default/deploy/ejb-test.jar
                        org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.

                        <stack trace snipped>

                        16:24:23,023 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@a15dafd7{
                        url=file:/C:/APPS/jboss-3.2.1/server/default/deploy/ejb-test.jar, deployedLastModified=1055193549132 }
                        org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.

                        Anybody have a clue here?

                        • 9. Re: Problem with Template example: invalid ejb-name
                          kittlitz

                          > I'm now building successfully, but when I deploy, the
                          > jboss log gives me the following:
                          >
                          > 16:24:23,007 WARN [verifier] EJB spec violation:
                          > Bean : 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.

                          I had the same problem, because I misunderstood the advice about adding the @ejb:finder directives to TestEntityBean.java. Fortunately, someone had posted the correct source on another thread.

                          Make sure the @ejb:finder directives in the TestEntityBean.java file look like:

                          * @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"
                          Note that these are @ejb:finder directives, not @jboss:finder directives (though I'm not sure it makes a difference)

                          This should get you past the deployment error. However, you should also put the 'test/' string back into the directives in TestSession.java, otherwise the test client won't be able to find it via JNDI.

                          Best of luck!

                          • 10. Re: Problem with Template example: invalid ejb-name
                            kittlitz

                            BTW, the thread that led me to the solution is at

                            <http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= in particular user hansbaus's post of Dec 18, 2002, which has an attached Java file.

                            • 11. Re: Problem with Template example: invalid ejb-name
                              macamat

                              Just wanted to say thanks for the great help in this post and others dealing with the example project. Getting it working on 3.2.1 is not easy for a newbie to JBoss but I just got there - it is possible!

                              • 12. Re: Problem with Template example: invalid ejb-name
                                artmotion

                                Good for you.
                                Could you put it somewhere online, so that other 3.2.1 newbees can start mor easily?

                                Or send it me, I put it onlin!