3 Replies Latest reply on Aug 27, 2004 1:00 PM by Heiko Rupp

    Relation table and unexpected post table create command leed

    microbiotic Newbie

      Hi all,

      I'm trying to deploy my entity beans on JBoss 3.2.3 & 3.2.5 and Oracle8.
      Jboss is configured to create all tables needed for the entity beans and their relation.
      If the DB is empty all works fine - except that JBoss executes a CREATE SEQUENCE %%t_seq START WITH 1 INCREMENT BY 1] on table DEVICES_POLLINGS_RELATION which is not defined. When the server starts a second time the table still exists but JBoss executes the CREATE SEQUENCE command again. This leads to a "ORA-00955: name is already used by an existing object" Exception.

      Can someone give me a hint? Is this an error in my config or a JBoss bug?
      Thanks a lot for help!

      regards,
      Marcel

      Indices for table GENERAL_DEVICESnot created as table existed
      21:59:17,705 DEBUG [DeviceRecord:207] Did not issue user-defined SQL for existing table GENERAL_DEVICES
      21:59:17,715 INFO [DeviceRecord:454] Table 'DEVICES_POLLINGS_RELATION' already exists
      21:59:17,715 INFO [DeviceRecord:608] issuePostCreateSQL::sql: [CREATE SEQUENCE %%t_seq START WITH 1 INCREMENT BY 1] on table DEVICES_POLLINGS_RELATION
      21:59:17,715 INFO [DeviceRecord:642] Executing SQL: CREATE SEQUENCE DEVICES_POLLINGS_RELATION_seq START WITH 1 INCREMENT BY 1
      21:59:17,845 WARN [DeviceRecord:656] Issuing sql CREATE SEQUENCE DEVICES_POLLINGS_RELATION_seq START WITH 1 INCREMENT BY 1 failed: java.sql.SQLException: ORA-00955: name is already used by an existing object
      
      21:59:17,915 ERROR [EntityContainer:283] Starting failed jboss.j2ee:jndiName=ManualPollingRecordLocal,service=EJB
      org.jboss.deployment.DeploymentException: Error while issuing sql in post-table-create; - nested throwable: (java.sql.SQLException: ORA-00955: name is already used by an existing object
      )
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.issuePostCreateSQL(JDBCStartCommand.java:657)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:305)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:492)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:396)
       at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:147)
       at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:337)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
       at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
       at $Proxy17.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:367)
       at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy105.start(Unknown Source)
       at org.jboss.ejb.EjbModule.startService(EjbModule.java:367)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
       at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
       at $Proxy17.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:367)
       at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy14.start(Unknown Source)
       at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:570)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:828)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
       at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy7.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:460)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
      Caused by: java.sql.SQLException: ORA-00955: name is already used by an existing object
      
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
       at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
      [...]
      


      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">
      
      <jbosscmp-jdbc>
       <defaults>
       <datasource>java:/Oracle8</datasource>
       <datasource-mapping>Oracle8</datasource-mapping>
       <create-table>true</create-table>
       <remove-table>false</remove-table>
       <read-only>false</read-only>
       <read-time-out>300000</read-time-out>
       <row-locking>false</row-locking>
       <pk-constraint>false</pk-constraint>
       <fk-constraint>false</fk-constraint>
       <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
       </defaults>
      
       <enterprise-beans>
      
       <!--
       To add beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
       that contains the <entity></entity> markup for those beans.
       -->
      
       <entity>
       <ejb-name>FTAMDeviceRecord</ejb-name>
      
       <table-name>ftam_devices</table-name>
      
       <cmp-field>
       <field-name>deviceId</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>foo</field-name>
      
       </cmp-field>
      
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>
      
       <entity>
       <ejb-name>FTPDeviceRecord</ejb-name>
      
       <table-name>ftp_devices</table-name>
      
       <cmp-field>
       <field-name>deviceId</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>hostname</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>password</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>portnumber</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>username</field-name>
      
       </cmp-field>
      
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>
      
       <entity>
       <ejb-name>SuspensionRecord</ejb-name>
      
       <post-table-create>
       <sql-statement>CREATE SEQUENCE %%t_seq START WITH 1 INCREMENT BY 1</sql-statement>
       </post-table-create>
      
       <table-name>SUSPENSIONS</table-name>
      
       <cmp-field>
       <field-name>id</field-name>
       <column-name>id</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>longActivationDate</field-name>
       <column-name>acdate</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>longExpirationDate</field-name>
       <column-name>exdate</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>deviceId</field-name>
       <column-name>device_id</column-name>
      
       </cmp-field>
      
       <entity-command name="oracle-sequence">
       <attribute name="sequence">SUSPENSIONS_seq</attribute>
       </entity-command>
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>
      
       <entity>
       <ejb-name>DeviceRecord</ejb-name>
      
       <post-table-create>
       <sql-statement>CREATE SEQUENCE %%t_seq START WITH 1 INCREMENT BY 1</sql-statement>
       </post-table-create>
      
       <table-name>GENERAL_DEVICES</table-name>
      
       <cmp-field>
       <field-name>id</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>name</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>deviceType</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>description</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>automaticPollingEnabled</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>CDRFileName</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>remoteDirectory</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>deleteEnabled</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>targetDirectory</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>timeout</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>listenerClassName</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>expertClassName</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>logFile</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>traceFile</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>retryInterval</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>maxRetries</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>maxTransferId</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>minTransferId</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>renamingEnabled</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>workingDirectory</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>booleanERROR</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>namingScheme</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>lastSuccessfulPolling</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>lastSequenceNumber</field-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>currentTransferId</field-name>
      
       </cmp-field>
      
       <entity-command name="oracle-sequence">
       <attribute name="sequence">GENERAL_DEVICES_seq</attribute>
       </entity-command>
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>
      
       <entity>
       <ejb-name>PollingCycleRecord</ejb-name>
      
       <post-table-create>
       <sql-statement>CREATE SEQUENCE %%t_seq START WITH 1 INCREMENT BY 1</sql-statement>
       </post-table-create>
      
       <table-name>POLLING_CYCLES</table-name>
      
       <cmp-field>
       <field-name>id</field-name>
       <column-name>id</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>name</field-name>
       <column-name>name</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>cronString</field-name>
       <column-name>cron_string</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>active</field-name>
       <column-name>active</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>longActivationDate</field-name>
       <column-name>activation</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>longExpirationDate</field-name>
       <column-name>expiration</column-name>
      
       </cmp-field>
      
       <entity-command name="oracle-sequence">
       <attribute name="sequence">POLLING_CYCLES_seq</attribute>
       </entity-command>
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>
      
       <entity>
       <ejb-name>ManualPollingRecord</ejb-name>
      
       <post-table-create>
       <sql-statement>CREATE SEQUENCE %%t_seq START WITH 1 INCREMENT BY 1</sql-statement>
       </post-table-create>
      
       <table-name>MANUAL_POLLINGS</table-name>
      
       <cmp-field>
       <field-name>id</field-name>
       <column-name>id</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>deviceId</field-name>
       <column-name>device_id</column-name>
      
       </cmp-field>
       <cmp-field>
       <field-name>longDate</field-name>
       <column-name>execdate</column-name>
      
       </cmp-field>
      
       <entity-command name="oracle-sequence">
       <attribute name="sequence">MANUAL_POLLINGS_seq</attribute>
       </entity-command>
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
       </entity>
      
       </enterprise-beans>
      
       <relationships>
       <ejb-relation>
       <ejb-relation-name>device-suspension-relation</ejb-relation-name>
      
       <ejb-relationship-role>
       <ejb-relationship-role-name>one-device</ejb-relationship-role-name>
       <key-fields>
       <key-field>
       <field-name>id</field-name>
       <column-name>device_id</column-name>
       </key-field>
       </key-fields>
      
       </ejb-relationship-role>
       <ejb-relationship-role>
       <ejb-relationship-role-name>suspensions</ejb-relationship-role-name>
       <key-fields/>
      
       </ejb-relationship-role>
       </ejb-relation>
       <ejb-relation>
       <ejb-relation-name>device-polling-cycle-relation</ejb-relation-name>
       <relation-table-mapping>
       <table-name>DEVICES_POLLINGS_RELATION</table-name>
       <create-table>true</create-table>
       </relation-table-mapping>
      
       <ejb-relationship-role>
       <ejb-relationship-role-name>devices</ejb-relationship-role-name>
       <key-fields>
       <key-field>
       <field-name>id</field-name>
       <column-name>device_id</column-name>
       </key-field>
       </key-fields>
      
       </ejb-relationship-role>
       <ejb-relationship-role>
       <ejb-relationship-role-name>polling-cycles</ejb-relationship-role-name>
       <key-fields>
       <key-field>
       <field-name>id</field-name>
       <column-name>pc_id</column-name>
       </key-field>
       </key-fields>
      
       </ejb-relationship-role>
       </ejb-relation>
       <ejb-relation>
       <ejb-relation-name>device-manual-polling-relation</ejb-relation-name>
      
       <ejb-relationship-role>
       <ejb-relationship-role-name>one-device</ejb-relationship-role-name>
       <key-fields>
       <key-field>
       <field-name>id</field-name>
       <column-name>device_id</column-name>
       </key-field>
       </key-fields>
      
       </ejb-relationship-role>
       <ejb-relationship-role>
       <ejb-relationship-role-name>many-manual-pollings</ejb-relationship-role-name>
       <key-fields/>
      
       </ejb-relationship-role>
       </ejb-relation>
       <!--
       To add jboss relationships for beans not managed by XDoclet, add
       a file to your XDoclet merge directory called jbosscmp-jdbc-relationships.xml that contains
       the <ejb-relation></ejb-relation> markups for those beans.
       -->
       </relationships>
      
      </jbosscmp-jdbc>