6 Replies Latest reply on Jul 14, 2009 9:10 PM by Ariel.Vazquez.Onufriuk-Oracle

    Error in a Schedule Task using the OIM API

    Ariel.Vazquez.Onufriuk-Oracle
      Hi all,
      I created a Schedule Task that it updates the manager of the users. I developed a jar file for it, but it doesn't work fine.
      The error is the following:

      13:39:07,405 INFO [STDOUT] Thor.API.Exceptions.tcStaleDataUpdateException
      13:39:07,405 INFO [STDOUT] at com.thortech.xl.ejb.beansimpl.tcUserOperationsBean.updateUserData(Unknown Source)
      13:39:07,405 INFO [STDOUT] at com.thortech.xl.ejb.beansimpl.tcUserOperationsBean.updateUser(Unknown Source)
      13:39:07,405 INFO [STDOUT] at com.thortech.xl.ejb.beans.tcUserOperationsSession.updateUser(Unknown Source)
      13:39:07,405 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source)
      13:39:07,405 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:39:07,405 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      13:39:07,405 INFO [STDOUT] at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
      13:39:07,405 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
      13:39:07,405 INFO [STDOUT] at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
      13:39:07,405 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:873)
      13:39:07,405 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
      13:39:07,405 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:39:07,405 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      13:39:07,405 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      13:39:07,405 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      13:39:07,405 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      13:39:07,405 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      13:39:07,405 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      13:39:07,405 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
      13:39:07,405 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
      13:39:07,405 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
      13:39:07,405 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
      13:39:07,405 INFO [STDOUT] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      13:39:07,405 INFO [STDOUT] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      13:39:07,405 INFO [STDOUT] at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
      13:39:07,405 INFO [STDOUT] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
      13:39:07,405 INFO [STDOUT] at $Proxy727.updateUser(Unknown Source)
      13:39:07,405 INFO [STDOUT] at Thor.API.Operations.tcUserOperationsClient.updateUser(Unknown Source)
      13:39:07,405 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
      13:39:07,405 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      13:39:07,405 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      13:39:07,405 INFO [STDOUT] at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
      13:39:07,405 INFO [STDOUT] at Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source)
      13:39:07,405 INFO [STDOUT] at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
      13:39:07,405 INFO [STDOUT] at $Proxy777.updateUser(Unknown Source)
      13:39:07,405 INFO [STDOUT] at com.oracle.tfidm.estudio.schedule.TrustedSourceManagerUpdater2.execute(TrustedSourceManagerUpdater2.java:77)
      13:39:07,405 INFO [STDOUT] at com.thortech.xl.scheduler.tasks.SchedulerBaseTask.run(Unknown Source)
      13:39:07,405 INFO [STDOUT] at com.thortech.xl.scheduler.core.quartz.QuartzWrapper$TaskExecutionAction.run(Unknown Source)
      13:39:07,405 INFO [STDOUT] at Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source)
      13:39:07,405 INFO [STDOUT] at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
      13:39:07,405 INFO [STDOUT] at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
      13:39:07,405 INFO [STDOUT] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)

      The script is the following:

      Hashtable query = new Hashtable();
      query.put("Users.User ID", "*");
      try {
      tcResultSet rs = userOps.findAllUsers(query);

      for(int i = 0; i < rs.getRowCount() ; i++) {
      rs.goToRow(i);

      String idTrustedSourceManager = rs.getStringValue(campoIdTrustedSourceManager);

      if(!idTrustedSourceManager.equalsIgnoreCase("")) {
      // Search the Manager Key
      Hashtable query2 = new Hashtable();
      query2.put(campoIdTrustedSource, idTrustedSourceManager);
      tcResultSet rs2 = userOps.findUsers(query2);
      if(rs2.getRowCount() == 1) {
      rs2.goToRow(0);
      String manager = rs2.getStringValue("Users.Key");
      HashMap nuevoManager = new HashMap();
      nuevoManager.put("Users.Manager Key", manager);

      try {
      userOps.updateUser(rs, nuevoManager);
      }
      catch(Exception e) {

      e.printStackTrace();
      }
      }
      }
      }
      }
      catch(Exception e) {
      e.printStackTrace();
      }

      Any idea?

      Thanks,
      Ariel
        • 1. Re: Error in a Schedule Task using the OIM API
          Rajiv Dewan
          Just see this line:

          String manager = rs2.getStringValue("Users.Key");
          and



          nuevoManager.put("Users.Manager Key", manager);


          Not sure that it is teh reason but try to use Users.Manager Login instead of Users.manager Key

          Users.Manager Key is a long variable.
          You are setting string in it.
          • 2. Re: Error in a Schedule Task using the OIM API
            Kevin Pinsky
            Stale Data error means that you are updating a result set multiple times. For every update user, or whatever, that updates a single result set, in order to modify it again, you must fetch the result set again.

            Try using two result sets. One containing the list of users you are searching for, and then another to grab each unique user's with a findUser within your loop.

            -Kevin
            • 3. Re: Error in a Schedule Task using the OIM API
              Ariel.Vazquez.Onufriuk-Oracle
              Thanks Kevin.
              My requirement is the following, I have to update the user's manager based on UDF using a scheduled task.
              I made the change you suggest me and I don't getting the Stale Data error anymore, but now I'm having the following problem, when I try to perform this operation the manager user is not updated. Do you have any idea to solve it?

              14:05:35,171 ERROR [SERVER] Class/Method: tcUSR/validateUserManager Error :The specified manager causes cycles.
              14:05:35,171 ERROR [SERVER] Class/Method: tcUSR/eventPreUpdate Error :User Manager is not valid.
              14:05:35,171 ERROR [SERVER] Class/Method: tcDataObj/save Error :Data Update Failed
              14:05:35,171 ERROR [DATABASE] Class/Method: tcDataBase/rollbackTransaction encounter some problems: Rollback Executed From
              java.lang.Exception: Rollback Executed From
                   at com.thortech.xl.dataaccess.tcDataBase.rollbackTransaction(Unknown Source)
                   at com.thortech.xl.dataobj.tcDataObj.rollback(Unknown Source)
                   at com.thortech.xl.dataobj.tcDataObj.doRollback(Unknown Source)
                   at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
                   at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
                   at com.thortech.xl.ejb.beansimpl.tcUserOperationsBean.updateUserData(Unknown Source)
                   at com.thortech.xl.ejb.beansimpl.tcUserOperationsBean.updateUser(Unknown Source)
                   at com.thortech.xl.ejb.beans.tcUserOperationsSession.updateUser(Unknown Source)
                   at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source)
                   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.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
                   at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
                   at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
                   at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
                   at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
                   at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
                   at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
                   at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
                   at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
                   at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
                   at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
                   at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
                   at org.jboss.ejb.Container.invoke(Container.java:873)
                   at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:324)
                   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                   at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
                   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                   at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
                   at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
                   at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
                   at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
                   at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
                   at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
                   at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
                   at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
                   at $Proxy727.updateUser(Unknown Source)
                   at Thor.API.Operations.tcUserOperationsClient.updateUser(Unknown Source)
                   at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:324)
                   at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
                   at Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source)
                   at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
                   at $Proxy777.updateUser(Unknown Source)
                   at com.oracle.tfidm.estudio.schedule.TrustedSourceManagerUpdater2.execute(TrustedSourceManagerUpdater2.java:106)
                   at com.thortech.xl.scheduler.tasks.SchedulerBaseTask.run(Unknown Source)
                   at com.thortech.xl.scheduler.core.quartz.QuartzWrapper$TaskExecutionAction.run(Unknown Source)
                   at Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source)
                   at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
                   at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
                   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)
              14:05:35,186 ERROR [ACCOUNTMANAGEMENT] Class/Method: tcUserOperationsBean/updateUserData encounter some problems: maoErrors:The specified manager causes cycles.
              14:05:35,186 INFO [STDOUT] Thor.API.Exceptions.tcAPIException: The specified manager causes cycles.


              Thanks,
              Ariel
              • 5. Re: Error in a Schedule Task using the OIM API
                Kevin Pinsky
                You've created a manager loop. The structure is hierarchical. You can't have a user manage someone who is already above them in the manager structure.

                -Kevin