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

SOLVED

How can I fix javax.jcr.nodetype.ConstraintViolationException: No default node type available for /bin/rcc?

Avatar

Level 4

Hello Everyone,

Can I ask a question ?

How can I fix javax.jcr.nodetype.ConstraintViolationException: No default node type available for /bin/rcc ?

  1. 24.12.2018 12:58:45.547 *ERROR* [0:0:0:0:0:0:0:1 [1545674325541] POST /bin/rcc/solution/poc/venue HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Unable to create resource named rcc in /bin
  2. 24.12.2018 12:58:45.548 *ERROR* [0:0:0:0:0:0:0:1 [1545674325541] POST /bin/rcc/solution/poc/venue HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
  3. javax.jcr.nodetype.ConstraintViolationException: No default node type available for /bin/rcc

        at org.apache.jackrabbit.oak.util.TreeUtil.addChild(TreeUtil.java:186)

        at org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.addChild(NodeDelegate.java:693)

        at org.apache.jackrabbit.oak.jcr.session.NodeImpl$5.perform(NodeImpl.java:298)

        at org.apache.jackrabbit.oak.jcr.session.NodeImpl$5.perform(NodeImpl.java:264)

        at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:208)

        at org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:112)

        at org.apache.jackrabbit.oak.jcr.session.NodeImpl.addNode(NodeImpl.java:264)

        at org.apache.jackrabbit.oak.jcr.session.NodeImpl.addNode(NodeImpl.java:249)

        at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.create(JcrResourceProvider.java:431)

        at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.create(AuthenticatedResourceProvider.java:182)

        at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.create(ResourceResolverControl.java:378)

        at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.create(ResourceResolverImpl.java:1159)

        at org.apache.sling.servlets.post.impl.operations.AbstractCreateOperation.deepGetOrCreateNode(AbstractCreateOperation.java:584)

        at org.apache.sling.servlets.post.impl.operations.AbstractCreateOperation.processCreate(AbstractCreateOperation.java:107)

        at org.apache.sling.servlets.post.impl.operations.ModifyOperation.doRun(ModifyOperation.java:91)

        at org.apache.sling.servlets.post.AbstractPostOperation.run(AbstractPostOperation.java:97)

        at org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:205)

        at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:146)

        at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:342)

        at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:374)

        at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552)

        at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)

        at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:156)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:375)

        at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:190)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.wcm.core.impl.PageLockFilter.doFilter(PageLockFilter.java:91)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)

        at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:71)

        at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:109)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet.doFilter(SaferSlingPostServlet.java:126)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.dam.core.impl.assetlinkshare.AdhocAssetShareAuthHandler.doFilter(AdhocAssetShareAuthHandler.java:437)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.dam.core.impl.servlet.ActivityRecordHandler.doFilter(ActivityRecordHandler.java:154)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73)

        at com.adobe.cq.dam.cfm.impl.servlets.CompatFilter.doFilter(CompatFilter.java:81)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.granite.rest.impl.servlet.ApiResourceFilter.doFilter(ApiResourceFilter.java:70)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.granite.requests.logging.impl.RequestLoggerImpl.doFilter(RequestLoggerImpl.java:121)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.granite.rest.assets.impl.AssetContentDispositionFilter.doFilter(AssetContentDispositionFilter.java:96)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.security.impl.ContentDispositionFilter.doFilter(ContentDispositionFilter.java:180)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.java:367)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:248)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:107)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.cq.social.commons.cors.CORSAuthenticationFilter.doFilter(CORSAuthenticationFilter.java:91)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServletHelper.java:221)

        at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.java:138)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.granite.optout.impl.OptOutFilter.doFilter(OptOutFilter.java:76)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServletHelper.java:221)

        at com.adobe.cq.wcm.core.components.internal.servlets.CoreFormHandlingServlet.doFilter(CoreFormHandlingServlet.java:131)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:90)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.cq.history.impl.HistoryRequestFilter.doFilter(HistoryRequestFilter.java:122)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.cq.mcm.campaign.servlets.CampaignCopyTracker.doFilter(CampaignCopyTracker.java:100)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:83)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:81)

        at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:60)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:131)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73)

        at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(ResourceResolverHelperImpl.java:83)

        at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)

        at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:151)

        at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:219)

        at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)

        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)

        at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)

        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)

        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)

        at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:96)

        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)

        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)

        at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:295)

        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)

        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)

        at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:131)

        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)

        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)

        at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116)

        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)

        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)

        at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:72)

        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)

        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)

        at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:127)

        at org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)

        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)

        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)

        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)

        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)

        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)

        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)

        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)

        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)

        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)

        at org.eclipse.jetty.server.Server.handle(Server.java:499)

        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)

        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)

        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)

        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)

        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)

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

  1. javax.jcr.nodetype.ConstraintViolationException: No default node type available for /bin/

This error happens when VenueServlet is called.

Here is VenueServlet

@Service()

@SlingServlet(methods = {"POST"}, paths = {"/bin/VenueServlet"})

public class VenueServlet extends SlingAllMethodsServlet {

    private static final Logger LOG = LoggerFactory.getLogger(VenueServlet.class);

    @Override

    protected void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException {

        doProcess(request, response);

    }

    @Override

    protected void doPost(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException {

        doProcess(request, response);

    }

    private void doProcess(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws IOException {

        LOG.error("VenueServlet servlet starts");

        Map valueMap = request.getParameterMap();

        if (valueMap.containsKey("val1")) {

            String val1 = request.getParameter("val1");

            LOG.error("--------------val1 : {}", val1);

        }

        if (valueMap.containsKey("val2")) {

            String val2 = request.getParameter("val2");

            LOG.error("--------------val2 : {}", val2);

        }

        LOG.error("VenueServlet servlet ends");

    }

}

1 Accepted Solution

Avatar

Correct answer by
Level 4

Thank you for everyone.

I fixed the error.

E:\02.Canada\01.Eom Chung Yong\01.Company\01.Webconsol\90.Source\RCC-Solution-POC\apps\src\main\content\jcr_root\etc\designs\rccexcaliburpoc\components\venue\js\venue.js

$(".perform").click(function(){

varships=$('#ships').val();

alert("ships:"+ships);

//UseJQueryAJAXrequesttopostdatatoaSlingServlet

$.ajax({

type:'POST',

url:'/bin/rcc/solution/poc/venue',

data:{'ships':ships},//passingvaluestoservlet

success:function(msg){

//Successlogichere(Theresponsefromservlet)

}

});

location.reload();

});

E:\02.Canada\01.Eom Chung Yong\01.Company\01.Webconsol\90.Source\RCC-Solution-POC\bundle\src\main\java\com\royalcaribbean\excalibur\solution\poc\core\servlets\VenueServlet.java

packagecom.royalcaribbean.excalibur.solution.poc.core.servlets;

importcom.royalcaribbean.excalibur.solution.poc.core.utils.FileWriterUtil;

importcom.royalcaribbean.excalibur.solution.poc.core.utils.page.PageResourceUtil;

importorg.apache.commons.lang3.StringUtils;

importorg.apache.felix.scr.annotations.Service;

importorg.apache.felix.scr.annotations.sling.SlingServlet;

importorg.apache.sling.api.SlingHttpServletRequest;

importorg.apache.sling.api.SlingHttpServletResponse;

importorg.apache.sling.api.resource.Resource;

importorg.apache.sling.api.resource.ResourceResolver;

importorg.apache.sling.api.servlets.SlingAllMethodsServlet;

importorg.slf4j.Logger;

importorg.slf4j.LoggerFactory;

importjavax.servlet.ServletException;

importjava.io.IOException;

importjava.util.ArrayList;

importjava.util.HashMap;

importjava.util.List;

importjava.util.Map;

importstaticcom.royalcaribbean.excalibur.solution.poc.core.utils.Constants.*;

@Service()

@SlingServlet(methods={"POST"},paths={PATH_SERVLET_PFX+"/venue"})

publicclassVenueServletextendsSlingAllMethodsServlet{

privatestaticfinalLoggerLOG=LoggerFactory.getLogger(VenueServlet.class);

@Override

protectedvoiddoGet(finalSlingHttpServletRequestrequest,finalSlingHttpServletResponseresponse)throwsServletException,IOException{

doProcess(request,response);

}

@Override

protectedvoiddoPost(finalSlingHttpServletRequestrequest,finalSlingHttpServletResponseresponse)throwsServletException,IOException{

doProcess(request,response);

}

privatevoiddoProcess(finalSlingHttpServletRequestrequest,finalSlingHttpServletResponseresponse)throwsIOException{

LOG.error("VenueServletservletstarts");

MapvalueMap=request.getParameterMap();

if(valueMap.containsKey("ships")){

Stringships=request.getParameter("ships");

LOG.error("--------------ships:{}",ships);

}

LOG.error("VenueServletservletends");

}

}

E:\02.Canada\01.Eom Chung Yong\01.Company\01.Webconsol\90.Source\RCC-Solution-POC\bundle\src\main\java\com\royalcaribbean\excalibur\solution\poc\core\utils\Constants.java

publicstaticfinalStringPATH_SERVLET_PFX="/bin/rcc/solution/poc";

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

Thank you for everyone.

I fixed the error.

E:\02.Canada\01.Eom Chung Yong\01.Company\01.Webconsol\90.Source\RCC-Solution-POC\apps\src\main\content\jcr_root\etc\designs\rccexcaliburpoc\components\venue\js\venue.js

$(".perform").click(function(){

varships=$('#ships').val();

alert("ships:"+ships);

//UseJQueryAJAXrequesttopostdatatoaSlingServlet

$.ajax({

type:'POST',

url:'/bin/rcc/solution/poc/venue',

data:{'ships':ships},//passingvaluestoservlet

success:function(msg){

//Successlogichere(Theresponsefromservlet)

}

});

location.reload();

});

E:\02.Canada\01.Eom Chung Yong\01.Company\01.Webconsol\90.Source\RCC-Solution-POC\bundle\src\main\java\com\royalcaribbean\excalibur\solution\poc\core\servlets\VenueServlet.java

packagecom.royalcaribbean.excalibur.solution.poc.core.servlets;

importcom.royalcaribbean.excalibur.solution.poc.core.utils.FileWriterUtil;

importcom.royalcaribbean.excalibur.solution.poc.core.utils.page.PageResourceUtil;

importorg.apache.commons.lang3.StringUtils;

importorg.apache.felix.scr.annotations.Service;

importorg.apache.felix.scr.annotations.sling.SlingServlet;

importorg.apache.sling.api.SlingHttpServletRequest;

importorg.apache.sling.api.SlingHttpServletResponse;

importorg.apache.sling.api.resource.Resource;

importorg.apache.sling.api.resource.ResourceResolver;

importorg.apache.sling.api.servlets.SlingAllMethodsServlet;

importorg.slf4j.Logger;

importorg.slf4j.LoggerFactory;

importjavax.servlet.ServletException;

importjava.io.IOException;

importjava.util.ArrayList;

importjava.util.HashMap;

importjava.util.List;

importjava.util.Map;

importstaticcom.royalcaribbean.excalibur.solution.poc.core.utils.Constants.*;

@Service()

@SlingServlet(methods={"POST"},paths={PATH_SERVLET_PFX+"/venue"})

publicclassVenueServletextendsSlingAllMethodsServlet{

privatestaticfinalLoggerLOG=LoggerFactory.getLogger(VenueServlet.class);

@Override

protectedvoiddoGet(finalSlingHttpServletRequestrequest,finalSlingHttpServletResponseresponse)throwsServletException,IOException{

doProcess(request,response);

}

@Override

protectedvoiddoPost(finalSlingHttpServletRequestrequest,finalSlingHttpServletResponseresponse)throwsServletException,IOException{

doProcess(request,response);

}

privatevoiddoProcess(finalSlingHttpServletRequestrequest,finalSlingHttpServletResponseresponse)throwsIOException{

LOG.error("VenueServletservletstarts");

MapvalueMap=request.getParameterMap();

if(valueMap.containsKey("ships")){

Stringships=request.getParameter("ships");

LOG.error("--------------ships:{}",ships);

}

LOG.error("VenueServletservletends");

}

}

E:\02.Canada\01.Eom Chung Yong\01.Company\01.Webconsol\90.Source\RCC-Solution-POC\bundle\src\main\java\com\royalcaribbean\excalibur\solution\poc\core\utils\Constants.java

publicstaticfinalStringPATH_SERVLET_PFX="/bin/rcc/solution/poc";