13 Replies Latest reply on May 6, 2003 5:25 AM by sys user

    Many errors in template project causing lots of grief!

    Gunther Schadow Newbie

      Hi,

      getting started with the template project is causing me lots of grief. There seems to be so much dependency on moving targets that it's bound to fail. The versions of Xdoclet and ant you get today are incompatible to the current build.xml file in the templates project and I had to make many changes to at least get the project compile.
      At least those problems were discussed somewhere so I could find the hints with Google.

      However, now that I have it compiled, the deployment fails miserably missing all sorts of classes:

      test.interfaces.TestEntityLocalHome
      test.interfaces.TestBMPEntityLocalHome
      test.interfaces.SequenceGeneratorLocalHome
      test.interfaces.TestSessionLocalHome

      the whole misery is evident in the log output starting with the following lines:

      09:00:06,526 INFO [MainDeployer] Starting deployment of package: file:/home/gunther/java/jboss/server/default/deploy/ejb-test.jar
      09:00:06,607 WARN [EntityMetaData] test/TestEntity: The ejb-name for a CMP 2.x Entity must be a valid Java Identifier
      09:00:06,607 WARN [EntityMetaData] test/TestEntity: The abstract-schema-name must be a valid Java Identifier 'test/TestEntity'

      I am sure there are just 2 minor problems with configuration, some changes in Xdoclet that cause this to happen. However, the bottom line is that it is not a good start for even a patient newbie. Worst of all, I can find none of these problems discussed anywhere, neither on Google nor on the fora here.

      Any hints?
      thanks,
      -Gunther

        • 1. Re: Many errors in template project causing lots of grief!
          alexeyv Newbie

          I have the same problem.

          Warnings that you are getting during execution of the xdoclet ant target are just that - warnings.

          The problem is definitely something else. I haven't been able to figure out what it is yet, either.

          • 2. Re: Many errors in template project causing lots of grief!
            alexeyv Newbie

            I guess, we both had this problem with JBoss 3.2 beta from SourceForge. (I certainly did). Looks like it's either a beta bug or incompatibility of some sort.

            Solution:
            1. Download JBoss 3.0.6 sources from www.jboss.org
            2. Build
            3. Build the template project
            4. Have fun.

            • 3. Re: Many errors in template project causing lots of grief!
              hanxuerui Newbie

              I fixed this problem by change the "test/TestEntity" to TestEntity. You will find the "test/TestEntity" at the beginning of the ejb java file. under the src/ejb/test/entity/ directory.

              But after this, I got into a trouble I am still working on, please let me know it will be great if we can help each other.

              Thanks.

              • 4. Re: Many errors in template project causing lots of grief!
                hanxuerui Newbie

                I fixed this problem by replace "test/TestEntity" with "TestEntity". You can find this defination at the beginning of the EJB java src file.

                But I had a new problem, if you have this fixed you will get the error I just posted in this group.

                Let me know if you get pass this. and I hope we can help each other out.

                • 5. Re: Many errors in template project causing lots of grief!
                  hanxuerui Newbie

                  I fixed this problem by replace "test/TestEntity" with "TestEntity". You can find this defination at the beginning of the EJB java src file.

                  But I had a new problem, if you have this fixed you will get the error I just posted in this group.

                  Let me know if you get pass this. and I hope we can help each other out.

                  • 6. Re: Many errors in template project causing lots of grief!
                    Juha Lindfors Master

                    you cannot use slashes in ejb names any more, 3.2 enforces this but the template project has not been updated for quite a while

                    • 7. Re: Many errors in template project causing lots of grief!
                      tobias Newbie

                      i had the same problem with the template project with jboss 3.2.0. as already suggested, at first it's a good idea to replace "test/TestEntity" by "TestEntity".
                      but here comes the next problem:

                      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.
                      ERROR [MainDeployer] could not create deployment: file:/data/tools/jboss-3.2.0/server/default/deploy/ejb-test.jar

                      that's (perhaps) a good moment to modify the xdoclet tags in TestEntityBean.java, because the @jboss:finder-query tags one finds there seem to work fine with jboss 3.0.6 and with jaws but not with jboss 3.2.0 (the problem seems to be, that the query entries in jaws.xml are not used. instead it would be nice, if there where query entries in ejb-jar.xml).

                      i deleted the @jboss:finder-query tags and added the "query" parameter to the @ejb:finder tag,
                      something like query="SELECT OBJECT(e) FROM TestEntity e WHERE e.id <> ?1 AND e.lastName = ?2 AND e.firstName = ?3"
                      that's to be done for "findByName" and "findAnotherByName".

                      probably i just figured out a workaround and not "the solution", but for now it works :-)

                      nonetheless i don't understand, how ejb-jar.xml, jaws.xml, jboss.xml and jbosscmp-jdbc.xml
                      work with jboss-3.2.0.

                      greetings - toBias

                      • 8. Re: Many errors in template project causing lots of grief!
                        Alasdair MacLeod Newbie

                        For what it's worth, I got the template working by:

                        adding a new finder to TestEntityBean:
                        findByName( int pId, java.lang.String pSurname, java.lang.String pLastName )

                        and using this rather than findAnotherByName() in TestEntityBean.setValueObject ()

                        (the original logic always threw an InvalidValueException

                        As described above I changed the bean name to
                        * @ejb:bean name="TestEntity"

                        and in TestSessionBean set the ref accordingly
                        * @ejb:ejb-ref ejb-name="TestEntity"

                        • 9. Re: Many errors in template project causing lots of grief!
                          sys user Master

                          The slash thing is correct. Only valid token characters are allowed in EJB names. So e.g. test_TestEntity would be a valid ejb name, but not test/TestEntity.

                          The second thing with finder methods:
                          As far as I understand it CMP1.1 had no standard way of declaring finder queries. So each app server did it in its own way.
                          So the @jboss:finder-query tag was JBoss' way of handling finder queries in CMP1.1.
                          In my JBoss3.0.4 the template finder queries do not lead to deployment errors, but they don't work at runtime either.
                          In CMP2.0 the query attribute is used.
                          So the correct thing is to add a query to the template project (like you did) to make the template work under CMP2.0.
                          Another possibility (but worse) to make the template work would be to tell JBoss to use CMP1.1 (which is possible in one of the config files). Then the template should work. But since JBoss3.0 CMP2.0 is default.

                          Ciao

                          • 10. Re: Many errors in template project causing lots of grief!
                            jjclose Newbie


                            I have a couple of questions about this fix:

                            First, do you mean this for both TestEntity beans? i.e. TestEntity and TestBMPEntity?

                            Second, is this change (changing test/TestEntity) required for all appearances of ejb-names? For example, in TestEntity is it required to change test/SequenceGenerator to just plain SequenceGenerator ?

                            Thanks for the help, if I had not seen these posts I would probably _still_ be stuck.

                            • 11. Re: Many errors in template project causing lots of grief!
                              sys user Master

                              I removed the "test/" from every ejb-name including SequenceGenerator and the session bean.
                              I only worked with the CMP version of the entity bean.

                              • 12. Didn't help -- Re: Many errors in template project causing l
                                jjclose Newbie


                                When I tried what you describe here, I get an EJB QL syntax error during deployment. Probably everyone on this list knows EJBQL better than I do, so any suggestions are greatly appreciated. The error is below:
                                2003-05-05 17:39:58,348 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/test/TestEntity,service=EJB
                                org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT OBJECT(e) FROM TestEntity e WHERE e.id <> ?1 AND e.lastName = ?2 AND e.firstName = ?3'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 50.
                                Was expecting one of:
                                "ABS" ...
                                "LENGTH" ...
                                "LOCATE" ...
                                "SQRT" ...
                                "(" ...
                                "+" ...
                                "-" ...
                                <INTEGER_LITERAL> ...
                                <FLOATING_POINT_LITERAL> ...
                                <NUMERIC_VALUED_PARAMETER> ...
                                <NUMERIC_VALUED_PATH> ...
                                )
                                at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.(JDBCEJBQLQuery.java:46)
                                at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:53)
                                at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:218)
                                at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:505)
                                at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:410)
                                at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:170)
                                at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:339)
                                at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
                                at java.lang.reflect.Method.invoke(Native Method)
                                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
                                at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
                                at $Proxy11.start(Unknown Source)
                                at org.jboss.system.ServiceController.start(ServiceController.java:392)
                                at java.lang.reflect.Method.invoke(Native Method)
                                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
                                at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                                at $Proxy45.start(Unknown Source)
                                at org.jboss.ejb.EjbModule.startService(EjbModule.java:347)
                                at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
                                at java.lang.reflect.Method.invoke(Native Method)
                                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
                                at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
                                at $Proxy11.start(Unknown Source)
                                at org.jboss.system.ServiceController.start(ServiceController.java:392)
                                at java.lang.reflect.Method.invoke(Native Method)
                                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
                                at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                                at $Proxy19.start(Unknown Source)
                                at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:541)
                                at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
                                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
                                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
                                at java.lang.reflect.Method.invoke(Native Method)
                                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
                                at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                                at $Proxy7.deploy(Unknown Source)
                                at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:280)
                                at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:407)
                                at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:200)
                                at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:211)
                                at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:190)
                                + nested throwable:
                                org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 50.
                                Was expecting one of:
                                "ABS" ...
                                "LENGTH" ...
                                "LOCATE" ...
                                "SQRT" ...
                                "(" ...
                                "+" ...
                                "-" ...
                                <INTEGER_LITERAL> ...
                                <FLOATING_POINT_LITERAL> ...
                                <NUMERIC_VALUED_PARAMETER> ...
                                <NUMERIC_VALUED_PATH> ...



                                • 13. Re: Didn't help -- Re: Many errors in template project causi
                                  sys user Master

                                  jBoss is complaining about the '1'. So I think maybe you forgot to add the method signature.

                                  In CMP1.1 the xdoclet tags had to look like this:


                                  * @jboss:finder-query name="findByName"
                                  * query="First_Name = {0} AND Last_Name = {1}"
                                  *
                                  * @jboss:finder-query name="findAnotherByName"
                                  * query="Id != {0} AND First_Name = {1} AND Last_Name = {2}"

                                  In CMP2.0 the xdoclet tags had to look like that:

                                  * @ejb:finder signature="test.interfaces.TestEntity findByName( java.lang.String pSurname, java.lang.String pLastName )"
                                  * query="SELECT OBJECT(e) from TestEntitySchema AS e WHERE e.firstName = ?1 AND e.lastName = ?2"
                                  *
                                  * @ejb:finder signature="test.interfaces.TestEntity findAnotherByName( int pId, java.lang.String pSurname, java.lang.String pLastName )"
                                  * query="SELECT OBJECT(e) from TestEntitySchema AS e WHERE e.id <> ?1 AND e.firstName = ?2 AND e.lastName = ?3"
                                  *

                                  and finally you have to add a schema name. In my case TestEntitySchema

                                  * @ejb:bean name="TestEntity"
                                  * display-name="TestEntity working on projects to support clients"
                                  * type="CMP"
                                  * jndi-name="ejb/test/TestEntity"
                                  * schema="TestEntitySchema"

                                  @jjclose:
                                  to your request in the other thread: I did change the template quite a bit. That starts with a completely changed coding style and ended with totally different package, class and method names. So that wouldn't help you.


                                  Hope that helps