javax.jcr.nodetype.ConstraintViolationException | Community
Skip to main content
AEMLearner-1989
Level 4
August 18, 2017

javax.jcr.nodetype.ConstraintViolationException

  • August 18, 2017
  • 2 replies
  • 4321 views

Hi Team,

I have changed the method from GET to POST in  HTML form ...I am getting the following error

“javax.jcr.nodetype.ConstraintViolationException: no matching property definition found

When i hit the submit button.

Any pointer here??

Regards,

Sathya

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Prince_Shivhare
Community Advisor
Community Advisor
August 18, 2017

Hi Sathya,

Are you using sling servlet using ajax?

did you checked Adobe Experience Manager Help | Submitting Adobe Experience Manager form data to Java Sling Servlets  for reference?

Regards,
Prince

AEMLearner-1989
Level 4
August 18, 2017

Yes Prince.. you are ryt..I am using ajax

kautuk_sahni
Community Manager
Community Manager
August 21, 2017

Can you share POST body of AJAX?

This is the exact problem you are facing:- AJAX POST Method Call error : javax.jcr.nodetype.ConstraintViolationException

//If the property name contains a namespace, and the namespace isn't there, JCR tries to create the namespace for you. But if you don't have enough permissions to do so, it will throw this kind of exception. Don't post JSON string, but rather simple form-like data. This will work fine then.

Also, When posting data from an HTML form to AEM - post the data to a Sling Servlet using AJAX. See this community article:

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

~kautuk

Kautuk Sahni
AEMLearner-1989
Level 4
August 22, 2017

dataVal = {"fname": fname, "phoneno": phoneno, "email": email, "state": state, "city": city, "alterphoneno": alterphoneno, "coatchingfor": coatchingfor, "pagetitle": hdenbpgtitle, "bpgtitle": bpgtitle, "utm_param": fullpageurl};

            $.ajax({

                async: false,

                type: "POST",

                url: urls,

                data: dataVal,

                success: function (msg) {

                    if (JSON.stringify(msg.success)) {

                        var leadid = msg.LeadID;

                        $('form').attr('action', '/content/pagepath?id=" + leadid);

                    } else {

                        alert('Sorry, Try again');

                        return false;

                    }

                }

smacdonald2008
Level 10
August 22, 2017

See the article that Prince pointed you to. You will learn how to post values to an Experience Manager Sling Servlet.