7 Replies Latest reply on Feb 6, 2013 2:13 AM by Veena_07

    javax.jcr.nodetype.ConstraintViolationException : Node is protected

    Veena_07 Level 3

      Hi

       

          I have an nt:unstructured node to which i am writing some properties through java code. The properties are getting written but in my error log i am getting

       

      javax.jcr.nodetype.ConstraintViolationException: Unable to perform operation. Node is protected.

       

             this error message.  Can anyone tell me why it happens and how to avoid this error message

       

       

       

      Thanks and regards

       

      Veena

        • 1. Re: javax.jcr.nodetype.ConstraintViolationException : Node is protected
          Yogesh Upadhyay Level 4

          Can you send full stack trace ? And if possible json output of node you are trying to modify. Something like yournpdepath.json or .xml

           

          Yogesh

          • 2. Re: javax.jcr.nodetype.ConstraintViolationException : Node is protected
            AshishSPanwar Level 2

            Are you trying to write to a "cq:Page" node?

            If so, try writing to the "cq:Pagecontent" node under the cq:Page node (jcr:content).

            • 3. Re: javax.jcr.nodetype.ConstraintViolationException : Node is protected
              Veena_07 Level 3

              05.02.2013 20:11:01.917 *ERROR* [JobHandler: /etc/workflow/instances/2013-02-05/model_29635143320497:/content/test67] com.az.signup.helper.SignupFormHelper Error in SignUpformhelper.java in setNodeProperty() javax.jcr.nodetype.ConstraintViolationException: Unable to perform operation. Node is protected.

                        at org.apache.jackrabbit.core.ItemValidator.checkCondition(ItemValidator.java:276)

                        at org.apache.jackrabbit.core.ItemValidator.checkModify(ItemValidator.java:248)

                        at org.apache.jackrabbit.core.PropertyImpl.checkSetValue(PropertyImpl.java:271)

                        at org.apache.jackrabbit.core.PropertyImpl.setValue(PropertyImpl.java:714)

                        at org.apache.jackrabbit.core.NodeImpl$SetPropertyOperation.perform(NodeImpl.java:2023)

                        at org.apache.jackrabbit.core.NodeImpl$SetPropertyOperation.perform(NodeImpl.java:1967)

                        at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)

                        at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:1889)

                        at org.apache.jackrabbit.core.NodeImpl.setProperty(NodeImpl.java:1859)

                        at com.az.signup.helper.SignupFormHelper.setNodeProperty(com.az.signup.helper.SignupFormHelp er.java:1946)

                        at com.az.signup.dax.MasterDataCRX.setSurveyValues(com.az.signup.dax.MasterDataCRX.java:264)

                        at com.az.signup.dax.MasterDataCRX.setSurveyNode(com.az.signup.dax.MasterDataCRX.java:216)

                        at com.az.signup.dax.MasterDataCRX.callSetSurveyNode(com.az.signup.dax.MasterDataCRX.java:13 0)

                        at com.az.signup.dax.MasterDataCRX.submitSurveyOptsBrands(com.az.signup.dax.MasterDataCRX.ja va:87)

                        at com.az.signup.impl.AZSignUpWorkflow.execute(com.az.signup.impl.AZSignUpWorkflow.java:86)

                        at com.day.cq.workflow.impl.job.HandlerBase.executeProcess(HandlerBase.java:172)

                        at com.day.cq.workflow.impl.job.JobHandler.process(JobHandler.java:122)

                        at org.apache.sling.event.jobs.JobUtil$1.run(JobUtil.java:272)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                        at java.lang.Thread.run(Thread.java:619)

               

               

               

              this the error log i get.

               

               

              {"qstnIdSys":"BRA123QNS001","qstnText":"23423","ansIdsSys":["BRA123ANS001"],"ansType":"dat e","qstnId":"123","jcr:primaryType":"nt:unstructured"}

               

              this is json of one node created and properties written. Properties are getting written correctly but the above error is coming

              • 4. Re: javax.jcr.nodetype.ConstraintViolationException : Node is protected
                splram

                What is the name of property that you are trying to update using setProperty? Some properties cannot be modified, are you trying to modify something which is not supposed to be modified? Check once.

                • 5. Re: javax.jcr.nodetype.ConstraintViolationException : Node is protected
                  Veena_07 Level 3

                  whatever the json is showing is all set dynamically through coding... Runtime only the nt:unstructured node is created and properties are set to it.

                  • 6. Re: javax.jcr.nodetype.ConstraintViolationException : Node is protected
                    splram Level 1

                    Since the properties are getting modifed from a worfklow process, after setting the property, are you saving using session.save()? check once without saving the session.

                    • 7. Re: javax.jcr.nodetype.ConstraintViolationException : Node is protected
                      Veena_07 Level 3

                      Hi splram

                       

                          I tried to log what all properties are getting written. Wen i checked i could find that it is taking the primary type of other node also and i think that is what throwing error..

                       

                      Thanks a lot for your precious comments and help