Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-8369

ScriptedSQL - patch ADD operation throws 500 Internal Server Exception

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • OpenIDM 5.5.0
    • OpenIDM 6.0.0
    • _Samples
    • OpenIDM 5.5.0-SNAPSHOT (55bd93d), IDMMySQL 5.1.34, groovy connector 1.4.1.0

    Description

      ADD operation on string throws 500 Exception complaining about null values for not changed attributes. Sample used for scriptedsql is building-scripted-connector.

      Patch operation

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --data '[{"operation":"add","field":"/email","value":"foobar@foo.bar"}]' --request PATCH "http://localhost:8080/openidm/system/hrdb/account/7"
      
      Response Content:
      {"code":500,"reason":"Internal Server Error","message":"Operation PATCH failed with ConnectorException on system object: 7"}
      

      OpenIDM exception

      WARNING: Failed to execute: 
                              UPDATE
                                  users
                              SET
                                  fullname = ?,
                                  firstname = ?,
                                  lastname = ?,
                                  email = ?,
                                  organization = ?,
                                  password = coalesce(sha1(?), password),
                                  timestamp = now()
                              WHERE
                                  id = ?
                               because: Column 'firstname' cannot be null
      May 22, 2017 1:53:21 PM org.forgerock.openidm.servlet.internal.ServletConnectionFactory$2 lambda$handleRequestWithLogging$8
      WARNING: Resource exception: 500 Internal Server Error: "Operation PATCH failed with ConnectorException on system object: 7"
      org.forgerock.json.resource.InternalServerErrorException: Operation PATCH failed with ConnectorException on system object: 7
      	at org.forgerock.openidm.provisioner.openicf.impl.ExceptionHelper.adaptConnectorException(ExceptionHelper.java:154)
      	at org.forgerock.openidm.provisioner.openicf.impl.ObjectClassResourceProvider.handlePatch(ObjectClassResourceProvider.java:399)
      	at org.forgerock.openidm.provisioner.openicf.impl.ObjectClassRequestHandler.handlePatch(ObjectClassRequestHandler.java:122)
      	at org.forgerock.json.resource.Router.handlePatch(Router.java:292)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:85)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterPatch(Filters.java:74)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:83)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterPatch(Filters.java:74)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:83)
      	at org.forgerock.openidm.filter.ScriptedFilter$4.apply(ScriptedFilter.java:120)
      	at org.forgerock.openidm.filter.ScriptedFilter$4.apply(ScriptedFilter.java:117)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:247)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:236)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:215)
      	at org.forgerock.openidm.filter.ScriptedFilter.filterRequest(ScriptedFilter.java:184)
      	at org.forgerock.openidm.filter.ScriptedFilter.filterPatch(ScriptedFilter.java:116)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterPatch(Filters.java:72)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:83)
      	at org.forgerock.openidm.audit.filter.AuditFilter.lambda$filterPatch$3(AuditFilter.java:130)
      	at org.forgerock.openidm.audit.filter.AuditFilter.logAuditAccessEntry(AuditFilter.java:168)
      	at org.forgerock.openidm.audit.filter.AuditFilter.filterPatch(AuditFilter.java:130)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterPatch(MutableFilterDecorator.java:84)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterPatch(Filters.java:72)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:83)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$2.lambda$filterPatch$3(ServletConnectionFactory.java:368)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$2.handleRequestWithLogging(ServletConnectionFactory.java:407)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$2.filterPatch(ServletConnectionFactory.java:368)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:83)
      	at org.forgerock.openidm.filter.PassthroughFilter.filterPatch(PassthroughFilter.java:60)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterPatch(MutableFilterDecorator.java:84)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterPatch(MutableFilterDecorator.java:84)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:83)
      	at org.forgerock.openidm.filter.PassthroughFilter.filterPatch(PassthroughFilter.java:60)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterPatch(MutableFilterDecorator.java:84)
      	at org.forgerock.json.resource.FilterChain$Cursor.handlePatch(FilterChain.java:83)
      	at org.forgerock.json.resource.FilterChain.handlePatch(FilterChain.java:240)
      	at org.forgerock.json.resource.InternalConnection.patchAsync(InternalConnection.java:66)
      	at org.forgerock.json.resource.AbstractConnectionWrapper.patchAsync(AbstractConnectionWrapper.java:155)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$1$1.patchAsync(ServletConnectionFactory.java:278)
      	at org.forgerock.json.resource.http.RequestRunner.visitPatchRequest(RequestRunner.java:212)
      	at org.forgerock.json.resource.http.RequestRunner.visitPatchRequest(RequestRunner.java:82)
      	at org.forgerock.json.resource.Requests$PatchRequestImpl.accept(Requests.java:358)
      	at org.forgerock.json.resource.http.RequestRunner.handleResult(RequestRunner.java:128)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:247)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:236)
      	at org.forgerock.json.resource.http.HttpAdapter.doRequest(HttpAdapter.java:712)
      	at org.forgerock.json.resource.http.HttpAdapter.doPatch(HttpAdapter.java:509)
      	at org.forgerock.json.resource.http.HttpAdapter.handle(HttpAdapter.java:280)
      	at org.forgerock.http.handler.Handlers$HandlerDescribableAsDescribableHandler.handle(Handlers.java:146)
      	at org.forgerock.http.filter.OptionsFilter.filter(OptionsFilter.java:69)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.http.swagger.OpenApiRequestFilter.filter(OpenApiRequestFilter.java:62)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.grantAccess(AuthenticationFramework.java:188)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.lambda$onValidateRequestSuccess$1(AuthenticationFramework.java:181)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:247)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:236)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.validateRequest(AuthenticationFramework.java:144)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.processMessage(AuthenticationFramework.java:134)
      	at org.forgerock.caf.authentication.framework.AuthenticationFilter.filter(AuthenticationFilter.java:84)
      	at org.forgerock.openidm.auth.AuthFilterWrapper.filter(AuthFilterWrapper.java:82)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.http.filter.TransactionIdInboundFilter.filter(TransactionIdInboundFilter.java:52)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.http.servlet.HttpFrameworkServlet.service(HttpFrameworkServlet.java:237)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      	at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:257)
      	at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:220)
      	at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.forgerock.openidm.servletregistration.impl.ServletRegistrationSingleton$FilterProxy.invoke(ServletRegistrationSingleton.java:283)
      	at com.sun.proxy.$Proxy59.doFilter(Unknown Source)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
      	at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:301)
      	at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.forgerock.openidm.servletregistration.impl.ServletRegistrationSingleton$FilterProxy.invoke(ServletRegistrationSingleton.java:283)
      	at com.sun.proxy.$Proxy59.doFilter(Unknown Source)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:276)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:499)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.identityconnectors.framework.common.exceptions.ConnectorException: Update (Update) script error
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
      	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:255)
      	at org.forgerock.openicf.misc.scriptedcommon.ScriptedConnectorBase.update(ScriptedConnectorBase.groovy:579)
      	at org.identityconnectors.framework.impl.api.local.operations.UpdateImpl.update(UpdateImpl.java:88)
      	at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:104)
      	at com.sun.proxy.$Proxy67.update(Unknown Source)
      	at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.identityconnectors.framework.impl.api.local.operations.ThreadClassLoaderManagerProxy.invoke(ThreadClassLoaderManagerProxy.java:96)
      	at com.sun.proxy.$Proxy67.update(Unknown Source)
      	at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:98)
      	at com.sun.proxy.$Proxy67.update(Unknown Source)
      	at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.identityconnectors.framework.impl.api.local.LocalConnectorFacadeImpl$ReferenceCountingProxy.invoke(LocalConnectorFacadeImpl.java:304)
      	at com.sun.proxy.$Proxy67.update(Unknown Source)
      	at org.identityconnectors.framework.impl.api.AbstractConnectorFacade.update(AbstractConnectorFacade.java:255)
      	at org.forgerock.openidm.provisioner.openicf.impl.ObjectClassResourceProvider.executePatchOperations(ObjectClassResourceProvider.java:692)
      	at org.forgerock.openidm.provisioner.openicf.impl.ObjectClassResourceProvider.handlePatch(ObjectClassResourceProvider.java:388)
      	... 102 more
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'firstname' cannot be null
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
      	at com.mysql.jdbc.Util.getInstance(Util.java:360)
      	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:971)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2141)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2077)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2062)
      	at groovy.sql.Sql.executeUpdate(Sql.java:2869)
      	at groovy.sql.Sql$executeUpdate$3.call(Unknown Source)
      	at org.forgerock.openicf.connectors.hrdb.UpdateScript.run(UpdateScript.groovy:94)
      	at org.forgerock.openicf.misc.scriptedcommon.ScriptedConfiguration.evaluate(ScriptedConfiguration.java:747)
      	at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
      	at org.forgerock.openicf.misc.scriptedcommon.ScriptedConnectorBase$_getScriptEvaluator_closure5.doCall(ScriptedConnectorBase.groovy:641)
      	at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      	at groovy.lang.Closure.call(Closure.java:414)
      	at org.forgerock.openicf.connectors.hrdb.HRDBConnector.evaluateScript(HRDBConnector.java:56)
      	at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
      	at org.forgerock.openicf.misc.scriptedcommon.ScriptedConnectorBase.genericUpdate(ScriptedConnectorBase.groovy:713)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
      	at org.forgerock.openicf.misc.scriptedcommon.ScriptedConnectorBase.executeUpdate(ScriptedConnectorBase.groovy:588)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
      	at org.forgerock.openicf.misc.scriptedcommon.ScriptedConnectorBase.update(ScriptedConnectorBase.groovy:574)
      	... 126 more
      

      Attachments

        Issue Links

          Activity

            People

              katie.gonzalez Katie Gonzalez
              michal.orlik@profiq.cz Michal Orlik
              Michal Orlik Michal Orlik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: