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

Scriptedcrest2Dj and Scriptedrest2Dj samples do not work with OpenDJ 3.0.0

    Details

      Description

      1) for ScriptedCrest2DJ, it fails on updating user with PUT:

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --header "If-Match: *" --data '{"name":{"familyName":"Smith","givenName":"User"},"contactInformation":{"emailAddress":"user@example.com","telephoneNumber":"555-555-5555"},"password":"TestPassw0rd","displayName":"User.Smith","_id":"user"}' --request PUT "http://localhost:8080/openidm/system/scriptedcrest/users/user"
      {"code":500,"reason":"Internal Server Error","message":"Operation UPDATE failed with ConnectorException on system object: user"}
      

      In the log, there is an error that could help us find the source of the failure:

      caused by: org.forgerock.json.resource.BadRequestException: The request cannot be processed because it attempts to create the read-only field '/_rev'
      

      2) for Scriptedrest2Dj it fails on updating group with PUT:

      curl --header "Content-Type: application/json" --header "X-OpenIDM-Password: openidm-admin" --header "X-OpenIDM-Username: openidm-admin" --header "If-Match: *" --data '{"_id":"group1","members":[{"_id":"user"}]}' --request PUT "http://localhost:8080/openidm/system/scriptedrest/group/group1"
      {"code":500,"reason":"Internal Server Error","message":"Operation UPDATE failed with ConnectorException on system object: group1"}
      

      In the log, we don't have explicit messages

      WARNING: Resource exception: 500 Internal Server Error: "Operation UPDATE failed with ConnectorException on system object: group1"
      org.forgerock.json.resource.InternalServerErrorException: Operation UPDATE failed with ConnectorException on system object: group1
      	at org.forgerock.openidm.provisioner.openicf.impl.OpenICFProvisionerService.adaptConnectorException(OpenICFProvisionerService.java:561)
      (...)
      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:57)
      (...)  
      at org.identityconnectors.framework.impl.api.AbstractConnectorFacade.update(AbstractConnectorFacade.java:255)
      	at org.forgerock.openidm.provisioner.openicf.impl.OpenICFProvisionerService$ObjectClassResourceProvider.handleUpdate(OpenICFProvisionerService.java:1587)
      	... 110 more
      Caused by: groovyx.net.http.HttpResponseException: Bad Request
      	at groovyx.net.http.RESTClient.defaultFailureHandler(RESTClient.java:263)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      (...)  
      

      but when we do an ngrep we can have more informations on what what goes on:

      ##
      T 127.0.0.1:50099 -> 127.0.0.1:8090 [AP]
      PUT /groups/group1 HTTP/1.1.
      Accept: application/json, application/javascript, text/javascript.
      Content-Length: 28.
      Content-Type: application/json.
      Host: localhost:8090.
      Connection: Keep-Alive.
      User-Agent: Apache-HttpClient/4.4.1 (Java/1.7.0_60).
      Accept-Encoding: gzip,deflate.
      Authorization: Basic aWRtOnBhc3N3b3Jk.
      .
      {"members":[{"_id":"user"}]}
      ##
      T 127.0.0.1:8090 -> 127.0.0.1:50099 [AP]
      HTTP/1.1 400 Bad Request.
      Server: grizzly/2.3.23.
      Cache-Control: no-cache.
      Content-Type: application/json; charset=UTF-8.
      Date: Wed, 23 Dec 2015 13:39:06 GMT.
      Connection: close.
      Transfer-Encoding: chunked.
      .
      87.
      {"code":400,"reason":"Bad Request","message":"The request cannot be processed because it attempts to remove the required field '/_id'"}.
      
      ##
      T 127.0.0.1:8090 -> 127.0.0.1:50099 [AP]
      0.
      .
      
      ##
      

      => looks like the body of the PUT does not contain the _id and DJ is complaining about it (though it was not complaining with DJ 2.6.3).
      So should we send the _id on update?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brmiller Brendan Miller
                Reporter:
                laurent.bristiel Laurent Bristiel [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: