4 Replies Latest reply on Sep 18, 2003 6:47 AM by kjensendk

    Error While creating table

    qinding

      I followed the book and ran the exercises. I used the firebird as my DBMS. It worked fine till I did ex07_1.

      I got the following error:
      MBeans waiting for othe rMBeans:
      [ObjectName: jboss.j2ee:jndiName=CreditCardHomeLocal, service=EJB State: FAILED
      I Depend On:
      Depends On Me: org.jboss.deployment.DeploymentException: Error while creating table; - nested throwable: (org.firebirdsql.jdbc.FBSQLException: GDS Exception. Dynamic SQL Error
      SQL error code = -104
      Token unknow - line1, char 62
      TYPE)]

      I removed Firebird services but only used Hypersonic, the exercise ran fine. Put back the Firebird then I had the error. The Address table was created successfully before the CreditCard table in Firebird. I don't know why?

      Exercise 4 through 6 ran very well on Firebird. By the way, with exercise 7, in jbosscmp-jdbc, there was no mapping for CreditCardEJB. To continue the exercise, I added it.

      Could somone going through the book help me identify the problem? Thank you. QD

        • 1. Re: Error While creating table
          jbrosenberg

          I get a similar problem, I am using a Oracle db...

          I get this error:


          10:58:03,260 INFO [AddressEJB] Created table 'ADDRESS' successfully.
          10:58:03,601 ERROR [EntityContainer] Starting failed
          org.jboss.deployment.DeploymentException: Error while creating table; - nested throwable: (java.sql.SQLException: ORA-00904: invalid column
          name
          )
          at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:178)
          at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:87)
          at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:499)
          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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)
          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 sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)

          • 2. Re: Error While creating table
            jbrosenberg

            Ok, I got rid of the ivalid column name, by changing
            in jbosscmp_jdbc.xml, the NUMBER field in
            the PHONE table to THE_NUMBER, apparently
            NUMBER is a reserved word in Oracle...

            Then, I had to do the same for the CREDITCARD table.
            This is not explicitly mentioned in the jbosscmp-jdbc.xml, it was using defaults from the ejb-jar.xml file...So I had to add it to the jbosscmp-jdbc.xml file, and also change the name of the NUMBER column there to THE_NUMBER....

            Now it deploys...

            Jason

            • 3. Re: Error While creating table
              2000

              I get the same error with hypersonic on JBOSS 3.2.. Here it is :

              Error while creating table PRODUCTS; - nested throwable: (java.sql.SQLException: Unexpected token: ) in statement [CREATE TABLE PRODUCTS (productid VARCHAR(256), name VARCHAR(256), description VARCHAR(256), baserPrice DOUBLE NOT NULL, CONSTRAINT PK_PRODUCTS PRIMARY KEY ())])]

              in order to go round the problem i set up my jbosscmp-jdbc.xml defaults with <create-table>false</create-table> and I create it manually on hypersonic (without the last CONSTRAINT ... bit).

              However I would appreciate if someone could give me a hint on why this does not work. thanks !

              • 4. Re: Error While creating table
                kjensendk

                Had the same problem... BUT.....
                My ejb-jar.xml file had UPPERCASE letters in the
                <cmp-field><field-name>Fieldname</field-name></cmp-field>

                Changed it to begin with lowercase and then it worked just fine