Expand my Community achievements bar.

javax.jcr.nodetype.ConstraintViolationException

Avatar

Level 5

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

6 Replies

Avatar

Community Advisor

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

Avatar

Administrator

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

Avatar

Level 5

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;

                    }

                }

Avatar

Level 10

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

Avatar

Level 5

Hi ,

I am trying post the values to third party web services API and will get success message with unique id...

able to success message as well as id but when i try to pass the same with URL ..its throwing a above message  ...

javax.jcr.nodetype.ConstraintViolationException