Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments

Difficulty on using Creating custom CQ email services example


Level 6

I get the following error when trying to submit the email form.



"javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}name" 

while processing /content/.../email2.json.jsp

javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}name
Locationinvalid link: /content/ShopriteAfrica/English/email2.json.jsp/content/.../English/email2.json.jsp
Parent Location/content/.../English

Go Back

invalid link: /content/ShopriteAfrica/English/email2.json.jspModified Resource

Parent of Modified Resource


I have set up the following Action for my e-mail page 


<form action="email2.json.jsp" method="post" class="ajax">


             <div class="form__entry">
                <input type="submit" value="submit"  name="submit" id="submit" value="Submit" class="form__input form__submit" tabindex="7" >  



The Javascript is 

  $('#contactSubmit').click(function() {
      var failure = function(err) {
          alert("Unable to retrive data "+err);
          // TODO - clear the form
      //Get the values to pass to the Mail OSGi bundle
      var server = $('#????').val() ;  // how to link
      var name = $('#name').val() ;  // how to link
      var surname = $('#surname').val() ;
      var email = $('#email').val() ; 
      var phoneNumber = $('#phoneNumber').val() ; 
      var enquiry = $('#enquiry').val() ;
      var url = location.pathname.replace(".html", "/contactus/email2.json.jsp") + "?to="+ to +"&server="+server +"&subject="+subject +"&message="+message;
      $.ajax(url, {
          dataType: "text",
          success: function(rawData, status, xhr) {
              try {               
              } catch(err) {
          error: function(xhr, status, err) {
      return false;



And I am using a modified version of the email2.jason.jasp

1 Accepted Solution


Correct answer by
Level 4
0 Replies


Correct answer by
Level 4


Level 2

Hi i have doubt in you given link .

am following same thing just i change from valid my mail id and smtp user also same but it is not working .

can you help me what code change it is working.



Level 6

That is not a helpful reply, as I am not disputing that the basic tutorial works. If you read the code above, I am trying to apply the tutorial in a different context. I am using a different javascript, among others. I am not correctly specifying the url for the email2.json.jsp and I think that is the cause of my failure. This being a help forum I am looking to see if anyone can see what I have done wrong in the code I posted.


Level 4

"javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}name" while processing /content/.../email2.json.jsp"

I see you are making call to jsp. I don't think it is possible to make call to jsp directly in CQ5.

"var url = location.pathname.replace(".html", "/contactus/email2.json.jsp") + "?to="+ to +"&server="+server +"&subject="+subject +"&message="+message;"

Few Questions:

What is the current page path?

What is the selector name? ex: json or email2 or email2.json

if the current page is http://localhost:4502/content/ShopriteAfrica/English/ContactUs.html and your selector is json or email2 then
 ajax call should be ContactUs.json.html or ContactUs.email2.html or ContactUs.email2.json.html not /contactus/email2.json.jsp.

Can you post the Selector based servlet which you have for sending email.


Level 6

<%@ page import="*,Shoprite.Africa.Nigeria.CustomEmailService" %><%
String server = request.getParameter("server");
String name = request.getParameter("name");
String surname = request.getParameter("surname");
String email = request.getParameter("email");
String phoneNumber = request.getParameter("phoneNumber");
String enquiry = request.getParameter("enquiry");

//Send the email message
CustomEmailService mailService = new CustomEmailService();
mailService.send(server,name,surname,email,"Contactus Form Generated EMail",phoneNumber,enquiry);  


Level 6

I found that the url to my Selector based servlet is 



my call in ajax is 


            jQuery.get("ContactUs.emailus.html", {
                to: jQuery('input[name=name]', form),
                surname: jQuery('input[name=surname]', form),
                message: jQuery('input[name=message]', form)



This does not execute the emailus.jsp, is ContactUs.emailus.html incorrect.