9 Replies Latest reply on Dec 5, 2004 8:34 PM by Scott Stark

    relation and remove problem on 3.2.6

    nicolas frank Newbie

      I have a problem with remove and relation on jboss 3.2.6. (was working on 3.2.3)
      I would like to know if I made a mistake or if this is a bug I need to report :

      I have 2 ejbs in relation :

      One 'Parent' which has 0 or 1 'zeroOrOneChild'. My problem is that a call to remove on Parent fail with a NoSuchObjectLocalException if the relation is null (Parent has no zeroOrOneChild).

      the ZeroOrOneChild table has a field idParent matching with its associate Parent (forein key).

      Here is my relation :

      <ejb-relationship-role >
       <ejb-relationship-role-name>Parent-facmp20-has-zeroOrOneChild-facmp20</ejb-relationship-role-name>
       <multiplicity>One</multiplicity>
       <relationship-role-source >
       <ejb-name>Parent</ejb-name>
       </relationship-role-source>
       <cmr-field >
       <cmr-field-name>zeroOrOneChild</cmr-field-name>
       </cmr-field>
       </ejb-relationship-role>


      Parent.getZeroOrOneChild() can have a null value (I guess there is nothing special to set into the descriptor)


      and the log and stacktrace when removing Parent with idParent=65558 and which has no ZeroOrOneChild :

      2004-11-03 17:54:27,620 DEBUG [myapplicationlog] remove Parent
      2004-11-03 17:54:27,620 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.ZeroOrOneChild] Executing SQL: SELECT CdCleRIB, CdCodeCdR, CdCodeTiers, CdEvent, CdFonction, CdMillesime, CdModeReglement, CdProgramme, CdService, DtEcheanceAmortissement, DtEcheanceInteret, DtEncaissement, FlBonification, FlFraisGestion, LbFournisseur, LbImputationCapital, LbImputationICNE, LbImputationInteret FROM ZeroOrOneChild WHERE (IdParent=?)
      2004-11-03 17:54:27,620 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: null, causedBy:
      javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=[.65558.]
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:158)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:341)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:484)
      at org.jboss.ejb.Container.invoke(Container.java:709)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.invokeRemoveRelation(JDBCCMRFieldBridge.java:1211)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:1026)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:1012)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:996)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:890)
      at org.jboss.ejb.plugins.cmp.jdbc.CascadeDeleteStrategy$NoneCascadeDeleteStrategy.removedIds(CascadeDeleteStrategy.java:52)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.removeFromRelations(JDBCCMRFieldBridge.java:393)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.removeFromRelations(JDBCEntityBridge.java:308)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.execute(JDBCRemoveEntityCommand.java:91)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.removeEntity(JDBCStoreManager.java:682)
      at org.jboss.ejb.plugins.CMPPersistenceManager.removeEntity(CMPPersistenceManager.java:466)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.removeEntity(CachedConnectionInterceptor.java:457)
      at org.jboss.ejb.EntityContainer.remove(EntityContainer.java:500)
      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.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1111)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:72)
      at org.jboss.cache.invalidation.triggers.EntityBeanCacheBatchInvalidatorInterceptor.invoke(EntityBeanCacheBatchInvalidatorInterceptor.java:113)

      I understand that Jboss is looking for an element on 'ZeroOrOneChild' which has a idParent matching with the parent to be removed.

      But as this is a 0..1 relation it should not throw an exeption if no object is found, should it ?

      Thank's.

      Nicolas FRANK.


        • 1. Re: relation and remove problem on 3.2.6
          Jesus Gonzalez Newbie

          I've just migrated from version 3.2.1 to 4.0.1RC1 and I've got a similar problem:
          I have relationships without cascade-delete but null valued in some cases; when I try to remove the entity bean the
          javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=

          Why is tryng to read the related bean? (It does not to remove it, because of there is not cascade-delete configurated).

          What is the function of org.jboss.ejb.plugins.cmp.jdbc.CascadeDeleteStrategy$NoneCascadeDeleteStrategy.removedIds() ?

          • 2. Re: relation and remove problem on 3.2.6
            Alexey Loubyansky Master

            Just tried against 4.0.1RC1. Worked fine. If you have a testcase, please, submit a bug report and attach the testcase. Thanks!

            • 3. Re: relation and remove problem on 3.2.6
              Jesus Gonzalez Newbie

              Alexey, thanks for your quick anwer.

              Here is the relationship (jbosscmp-jdbc.xml)

              <ejb-relation>
              <ejb-relation-name>visadosEJB-usuarioEJB1</ejb-relation-name>
              <ejb-relationship-role>
              <ejb-relationship-role-name>VisadosEJBRelationshipRole</ejb-relationship-role-name>
              <key-fields />
              </ejb-relationship-role>
              <ejb-relationship-role>
              <ejb-relationship-role-name>UsuarioEJBRelationshipRole</ejb-relationship-role-name>
              <key-fields>
              <key-field>
              <field-name>nombre</field-name>
              <column-name>usuariovisa</column-name>
              </key-field>
              </key-fields>
              </ejb-relationship-role>
              </ejb-relation>
              <ejb-relation>


              Here is the stack trace obtained: (Field usuariovisa is null)

              2004-11-26 11:16:11,770 DEBUG [Visado] jgonzalez -- remove(VisadosEJBPK[2004/513])
              2004-11-26 11:16:11,788 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: null, causedBy:
              javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=
              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:182)
              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:339)
              at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
              at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
              at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
              at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
              at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
              at org.jboss.ejb.Container.invoke(Container.java:856)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.invokeRemoveRelation(JDBCCMRFieldBridge.java:1211)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:1026)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:1012)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.destroyRelationLinks(JDBCCMRFieldBridge.java:996)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.setInstanceValue(JDBCCMRFieldBridge.java:890)
              at org.jboss.ejb.plugins.cmp.jdbc.CascadeDeleteStrategy$NoneCascadeDeleteStrategy.removedIds(CascadeDeleteStrategy.java:52)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.removeFromRelations(JDBCCMRFieldBridge.java:393)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.removeFromRelations(JDBCEntityBridge.java:308)
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.execute(JDBCRemoveEntityCommand.java:91)
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.removeEntity(JDBCStoreManager.java:682)
              at org.jboss.ejb.plugins.CMPPersistenceManager.removeEntity(CMPPersistenceManager.java:506)
              at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.removeEntity(CachedConnectionInterceptor.java:454)
              at org.jboss.ejb.EntityContainer.remove(EntityContainer.java:530)
              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.invocation.Invocation.performCall(Invocation.java:345)
              at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1159)
              at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:72)
              at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:273)
              at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
              at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:111)
              at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:211)
              at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
              at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:53)
              at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
              at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
              at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
              at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
              at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
              at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
              at org.jboss.ejb.Container.invoke(Container.java:856)
              at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
              at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
              at $Proxy1214.remove(Unknown Source)
              .......

              • 4. Re: relation and remove problem on 3.2.6
                Stefan Schmidt Newbie

                very similiar problem here: works fine on 3.2.4, but fails in 4.0.1RC1 (no other version tried so far).
                sorry, no details available - I've reverted to 3.2.4 again because of lack of time.

                • 5. Re: relation and remove problem on 3.2.6
                  Alexey Loubyansky Master

                  Post other descriptors also and container configurations you use. Thanks.

                  • 6. Re: relation and remove problem on 3.2.6
                    Jesus Gonzalez Newbie

                    A more complete description is showed here.
                    But I think the main questions are:
                    What is the function of the method "org.jboss.ejb.plugins.cmp.jdbc.CascadeDeleteStrategy$NoneCascadeDeleteStrategy.removedIds()" (when not exist cascade-delete)?


                    ejb-jar.xml
                    ...
                    <ejb-relation>
                    <ejb-relation-name>visadosEJB-usuarioEJB1</ejb-relation-name>
                    <ejb-relationship-role>
                    visadosEJB
                    <ejb-relationship-role-name>VisadosEJBRelationshipRole</ejb-relationship-role-name>
                    Many
                    <relationship-role-source>
                    visadosEJB
                    <ejb-name>VisadosEJB</ejb-name>
                    </relationship-role-source>
                    <cmr-field>
                    usuarioEJB
                    <cmr-field-name>visado_por</cmr-field-name>
                    </cmr-field>
                    </ejb-relationship-role>
                    <ejb-relationship-role>
                    usuarioEJB
                    <ejb-relationship-role-name>UsuarioEJBRelationshipRole</ejb-relationship-role-name>
                    One
                    <relationship-role-source>
                    usuarioEJB
                    <ejb-name>UsuarioEJB</ejb-name>
                    </relationship-role-source>
                    </ejb-relationship-role>
                    </ejb-relation>
                    ...


                    jbosscmp-jdbc.xml
                    ...
                    <ejb-relation>
                    <ejb-relation-name>visadosEJB-usuarioEJB1</ejb-relation-name>
                    <ejb-relationship-role>
                    <ejb-relationship-role-name>VisadosEJBRelationshipRole</ejb-relationship-role-name>
                    <key-fields />
                    </ejb-relationship-role>
                    <ejb-relationship-role>
                    <ejb-relationship-role-name>UsuarioEJBRelationshipRole</ejb-relationship-role-name>
                    <key-fields>
                    <key-field>
                    <field-name>nombre</field-name>
                    <column-name>usuariovisa</column-name>
                    </key-field>
                    </key-fields>
                    </ejb-relationship-role>
                    </ejb-relation>
                    <ejb-relation>
                    ...

                    informix-ds.xml
                    <no-tx-datasource>
                    <jndi-name>JVisaDS</jndi-name>
                    <connection-url>jdbc:informix-sqli://xxx.xxx.xxx.xxx:55000/jvisa:INFORMIXSERVER=srvifx15</connection-url>
                    <driver-class>com.informix.jdbc.IfxDriver</driver-class>
                    <user-name>jvisa</user-name>
                    visados
                    </no-tx-datasource>


                    jboss-service.xml
                    ...
                    <!-- ==================================================================== -->
                    <!-- Transactions -->
                    <!-- ==================================================================== -->
                    <!-- The configurable Xid factory. For use with Oracle, set pad to true -->

                    <!--attribute name="Pad">true</attribute-->


                    <!--
                    | The fast in-memory transaction manager.
                    -->
                    <mbean code="org.jboss.tm.TransactionManagerService"
                    name="jboss:service=TransactionManager"
                    xmbean-dd="resource:xmdesc/TransactionManagerService-xmbean.xml">

                    <!-- JGM: Cambio el time-out a 20 segundos
                    300 -->
                    20

                    <!-- set to false to disable transaction demarcation over IIOP -->
                    true
                    <depends optional-attribute-name="XidFactory">jboss:service=XidFactory

                    <!--
                    | UserTransaction support.
                    -->
                    <mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"
                    name="jboss:service=ClientUserTransaction"
                    xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">


                    jboss:service=invoker,type=jrmp
                    jboss:service=ClientUserTransaction
                    UserTransactionSessionFactory
                    org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory


                    org.jboss.proxy.ClientMethodInterceptor
                    org.jboss.invocation.InvokerInterceptor


                    jboss:service=invoker,type=jrmp


                    <depends optional-attribute-name="TxProxyName">

                    jboss:service=invoker,type=jrmp
                    jboss:service=ClientUserTransaction

                    org.jboss.tm.usertx.interfaces.UserTransactionSession


                    org.jboss.proxy.ClientMethodInterceptor
                    org.jboss.invocation.InvokerInterceptor


                    jboss:service=invoker,type=jrmp



                    ...


                    standardjbosscmp-jdbc.xml
                    <jbosscmp-jdbc>


                    <!-- java:/DefaultDS -->
                    java:/InformixDS
                    <!-- optional since 4.0 <datasource-mapping>Hypersonic SQL</datasource-mapping> -->

                    <create-table>true</create-table>
                    <remove-table>false</remove-table>
                    <read-only>false</read-only>
                    <!-- <read-time-out>300000</read-time-out> -->
                    <read-time-out>3000</read-time-out>
                    <row-locking>false</row-locking>
                    <pk-constraint>true</pk-constraint>
                    <fk-constraint>false</fk-constraint>
                    <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
                    <read-ahead>
                    on-load
                    <page-size>1000</page-size>
                    <eager-load-group>*</eager-load-group>
                    </read-ahead>
                    <list-cache-max>1000</list-cache-max>
                    <clean-read-ahead-on-load>false</clean-read-ahead-on-load>

                    <unknown-pk>
                    <key-generator-factory>UUIDKeyGeneratorFactory</key-generator-factory>
                    <unknown-pk-class>java.lang.String</unknown-pk-class>
                    <jdbc-type>VARCHAR</jdbc-type>
                    <sql-type>VARCHAR(32)</sql-type>
                    </unknown-pk>

                    <entity-command name="default"/>
                    <ql-compiler>org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler</ql-compiler>

                    ...

                    Thanks

                    • 7. Re: relation and remove problem on 3.2.6
                      Alexey Loubyansky Master

                      No, I don't need your -ds.xml, transaction manager, etc. I was asking for EJB deployment descriptors.

                      • 8. Re: relation and remove problem on 3.2.6
                        Sonnel Pun Newbie

                        I encounter the same problem. The same code which was running fine on 3.2.1 but failed on 3.2.4. I tried the code on versions 3.2.1 and higher and found from 3.2.4 to 4.0 failed. The same exception is catched as jesusgmadrazo's. Any idea?

                        Sonnel

                        • 9. Re: relation and remove problem on 3.2.6
                          Scott Stark Master

                          File a bug report with an example as requested:
                          http://jira.jboss.com/jira/browse/JBAS