Expand my Community achievements bar.

SOLVED

POST sling servlet exceptions

Avatar

Level 7

import org.apache.commons.io.IOUtils;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.propertytypes.ServiceDescription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;


@Component(
        service= Servlet.class,
        property={
                "sling.servlet.paths="+ "/aem-services/subscribe"
        }
)
@ServiceDescription("Subscribe Servlet")
public class SubscribeServlet extends SlingAllMethodsServlet {

    private static final long serialVersionUID = 1L;
    private static final Logger log = LoggerFactory.getLogger(SubscribeServlet.class);

   
    @Override
    protected void doPost(final SlingHttpServletRequest req,
            final SlingHttpServletResponse resp) throws ServletException, IOException {

        log.info("SubscribeServlet start");

        try {


            PrintWriter out = resp.getWriter();
            resp.setStatus(HttpServletResponse.SC_OK);
            resp.setContentType("application/json");
            resp.setCharacterEncoding("UTF-8");
            out.write("{}");
            out.flush();

            log.info("SubscribeServlet response received");



        } catch (Exception e) {
            log.error("SubscribeServlet error  ", e);
            throw new ServletException("SubscribeServlet exception");
        }

        log.info("SubscribeServlet end");
    }
}

 

Error in logs:

 

27.02.2024 16:57:42.849 *ERROR* [10.240.6.103 [1709053062844] POST /aem-services/subscribe HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.
	at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:519) [org.apache.sling.jcr.resource:3.0.18]
	at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.commit(AuthenticatedResourceProvider.java:215) [org.apache.sling.resourceresolver:1.7.10.B004]
	at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.commit(ResourceResolverControl.java:433) [org.apache.sling.resourceresolver:1.7.10.B004]
	at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.commit(ResourceResolverImpl.java:1024) [org.apache.sling.resourceresolver:1.7.10.B004]
	at org.apache.sling.servlets.post.impl.operations.AbstractPostOperation.run(AbstractPostOperation.java:164) [org.apache.sling.servlets.post:2.3.26]
	at org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:228) [org.apache.sling.servlets.post:2.3.26]
	at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:146) [org.apache.sling.api:2.22.0.B002]
	at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:342) [org.apache.sling.api:2.22.0.B002]
	at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:374) [org.apache.sling.api:2.22.0.B002]
	at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:579) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:88) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:138) [com.day.cq.wcm.cq-wcm-core:5.12.230]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:375) [com.day.cq.wcm.cq-wcm-core:5.12.230]
	at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:190) [com.day.cq.wcm.cq-wcm-core:5.12.230]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.core.impl.page.PageLockFilter.doFilter(PageLockFilter.java:91) [com.day.cq.wcm.cq-wcm-core:5.12.230]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:94) [com.day.cq.cq-personalization:5.12.48]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:283) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:82) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet.doFilter(SaferSlingPostServlet.java:126) [com.adobe.cq.social.cq-social-ugcbase-impl:2.5.3]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.dam.core.impl.assetlinkshare.AdhocAssetShareAuthHandler.doFilter(AdhocAssetShareAuthHandler.java:440) [com.day.cq.dam.cq-dam-core:5.12.366]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.dam.core.impl.servlet.ActivityRecordHandler.doFilter(ActivityRecordHandler.java:141) [com.day.cq.dam.cq-dam-core:5.12.366]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.granite.rest.impl.servlet.ApiResourceFilter.doFilter(ApiResourceFilter.java:70) [com.adobe.granite.rest.api:1.1.16.CQ650-B0005]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.granite.requests.logging.impl.RequestLoggerImpl.doFilter(RequestLoggerImpl.java:121) [com.adobe.granite.requests.logging:1.0.20]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.granite.rest.assets.impl.AssetContentDispositionFilter.doFilter(AssetContentDispositionFilter.java:96) [com.adobe.granite.rest.assets:1.0.58]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.java:332) [com.day.cq.wcm.cq-wcm-core:5.12.230]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:248) [com.day.cq.wcm.cq-wcm-mobile-core:5.11.10]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.aem.cloudmanagerpoc.core.filters.LoggingFilter.doFilter(LoggingFilter.java:58) [sites-cloudmanager-poc.core:2.0.2.0]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.idx.filter.SiteIdFilter.doFilter(SiteIdFilter.java:72) [idx-aem-web-core:5.0.15659]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.aem.sitesref.core.filters.LoggingFilter.doFilter(LoggingFilter.java:58) [sites-ref-core:1.5.0.17]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.wtc.sitecorp.filters.LoggingFilter.doFilter(LoggingFilter.java:58) [corporate-site-core:2.3.5092]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.aem.laska.core.filters.LoggingFilter.doFilter(LoggingFilter.java:58) [539-laska-core:2.10.9.1353]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.msc.siteplan.core.filters.LoggingFilter.doFilter(LoggingFilter.java:58) [MSCSiteplan.core:3.1.6.258]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.twx.dpd.filter.FilterForRestrictedCountries.doFilter(FilterForRestrictedCountries.java:96) [dpd-aem-web-core:7.7.9348]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.sites.twx.dpd.filter.CanonicalUrlFilter.doFilter(CanonicalUrlFilter.java:103) [dpd-aem-web-core:7.7.9348]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.livecycle.content.appcontext.impl.AppContextFilter.doFilter(AppContextFilter.java:69) [com.adobe.livecycle.content.core-bundle:6.0.52]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:110) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.livecycle.dsc.clientsdk.internal.ResourceResolverHolderFilter.doFilter(ResourceResolverHolderFilter.java:37) [com.adobe.livecycle.dsc.clientsdk:3.0.4]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.cq.social.commons.cors.CORSAuthenticationFilter.doFilter(CORSAuthenticationFilter.java:91) [com.adobe.cq.social.cq-social-commons:1.10.87]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServletHelper.java:226) [com.day.cq.wcm.cq-wcm-foundation:5.12.64]
	at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.java:138) [com.day.cq.wcm.cq-wcm-foundation:5.12.64]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.granite.optout.impl.OptOutFilter.doFilter(OptOutFilter.java:76) [com.adobe.granite.optout:1.0.0]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServletHelper.java:226) [com.day.cq.wcm.cq-wcm-foundation:5.12.64]
	at com.adobe.cq.wcm.core.components.internal.servlets.CoreFormHandlingServlet.doFilter(CoreFormHandlingServlet.java:123) [com.adobe.cq.core.wcm.components.core:2.23.2]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.fd.core.security.internal.CurrentUserServiceImpl.doFilter(CurrentUserServiceImpl.java:114) [adobe-aemfd-core-security:3.0.124]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.acs.commons.redirects.filter.RedirectFilter.doFilter(RedirectFilter.java:391) [com.adobe.acs.acs-aem-commons-bundle:6.0.14]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:90) [com.day.cq.wcm.cq-wcm-core:5.12.230]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:87) [org.apache.sling.rewriter:1.2.2]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:81) [com.adobe.granite.httpcache.core:1.0.8]
	at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:60) [com.adobe.granite.httpcache.core:1.0.8]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:131) [org.apache.sling.i18n:2.5.14]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217) [com.adobe.granite.csrf:1.0.20.CQ650-B0002]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.security.impl.ContentDispositionFilter.doFilter(ContentDispositionFilter.java:152) [org.apache.sling.security:1.1.16]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:84) [org.apache.sling.engine:2.7.10.B0004]
	at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(ResourceResolverHelperImpl.java:83) [com.adobe.granite.resourceresolverhelper:1.0.4]
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:151) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:250) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:126) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:86) [org.apache.felix.http.jetty:4.2.2]
	at com.adobe.granite.cors.impl.CORSFilter.doFilter(CORSFilter.java:88) [com.adobe.granite.cors:1.0.10.CQ650-B0002]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:149) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.2.2]
	at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308) [com.adobe.granite.license:1.2.10]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:149) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:131) [org.apache.sling.i18n:2.5.14]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:149) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116) [org.apache.sling.featureflags:1.2.2]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:149) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:73) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:149) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.sling.engine.impl.parameters.RequestParameterSupportConfigurer.doFilter(RequestParameterSupportConfigurer.java:67) [org.apache.sling.engine:2.7.10.B0004]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:149) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.Dispatcher$1.doFilter(Dispatcher.java:152) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1000) [org.apache.felix.http.jetty:4.2.2]
	at com.adobe.granite.cors.impl.CORSFilter.doFilter(CORSFilter.java:88) [com.adobe.granite.cors:1.0.10.CQ650-B0002]
	at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1006) [org.apache.felix.http.jetty:4.2.2]
	at com.adobe.granite.auth.oauth.impl.OAuthCallbackFilter.doFilter(OAuthCallbackFilter.java:69) [com.adobe.granite.auth.oauth:1.7.2]
	at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1006) [org.apache.felix.http.jetty:4.2.2]
	at com.adobe.granite.auth.ims.impl.IMSClusterExchangeTokenPreprocessor.doFilter(IMSClusterExchangeTokenPreprocessor.java:281) [com.adobe.granite.auth.ims:1.3.12.CQ650-B0014]
	at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1006) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:326) [org.apache.sling.security:1.1.16]
	at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1006) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:97) [org.apache.felix.http.sslfilter:1.2.6]
	at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1006) [org.apache.felix.http.jetty:4.2.2]
	at com.adobe.ams.security.core.AMSSecurityFilter.doFilter(AMSSecurityFilter.java:56) [com.adobe.ams.dispatcher-filter-test-endpoint.core:0.0.2]
	at org.apache.felix.http.base.internal.handler.PreprocessorHandler.handle(PreprocessorHandler.java:137) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager$2.doFilter(WhiteboardManager.java:1006) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager.invokePreprocessors(WhiteboardManager.java:1010) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:94) [org.apache.felix.http.jetty:4.2.2]
	at org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49) [org.apache.felix.http.jetty:4.2.2]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) [org.apache.felix.http.servlet-api:1.2.0]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [org.apache.felix.http.jetty:4.2.2]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [org.apache.felix.http.jetty:4.2.2]
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.jcr.AccessDeniedException: OakAccess0000: Access denied
	at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:232) [org.apache.jackrabbit.oak-api:1.22.15]
	at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213) [org.apache.jackrabbit.oak-api:1.22.15]
	at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:669) [org.apache.jackrabbit.oak-jcr:1.22.15]
	at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:495) [org.apache.jackrabbit.oak-jcr:1.22.15]
	at org.apache.jackrabbit.oak.jcr.session.SessionImpl$9.performVoid(SessionImpl.java:453) [org.apache.jackrabbit.oak-jcr:1.22.15]
	at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:273) [org.apache.jackrabbit.oak-jcr:1.22.15]
	at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:450) [org.apache.jackrabbit.oak-jcr:1.22.15]
	at com.adobe.granite.repository.impl.CRX3SessionImpl.save(CRX3SessionImpl.java:208) [com.adobe.granite.repository:1.6.28.CQ650-B0001]
	at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:517) [org.apache.sling.jcr.resource:3.0.18]
	... 174 common frames omitted
Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakAccess0000: Access denied
	at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.checkPermissions(PermissionValidator.java:209) [org.apache.jackrabbit.oak-core:1.22.15]
	at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.childNodeAdded(PermissionValidator.java:146) [org.apache.jackrabbit.oak-core:1.22.15]
	at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.childNodeAdded(PermissionValidator.java:52) [org.apache.jackrabbit.oak-core:1.22.15]
	at org.apache.jackrabbit.oak.spi.commit.CompositeEditor.childNodeAdded(CompositeEditor.java:107) [org.apache.jackrabbit.oak-store-spi:1.22.15]
	at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeAdded(EditorDiff.java:115) [org.apache.jackrabbit.oak-store-spi:1.22.15]
	at org.apache.jackrabbit.oak.segment.MapRecord$3.childNodeAdded(MapRecord.java:424) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:527) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:420) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:651) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:51) [org.apache.jackrabbit.oak-store-spi:1.22.15]
	at org.apache.jackrabbit.oak.spi.commit.EditorHook.processCommit(EditorHook.java:54) [org.apache.jackrabbit.oak-store-spi:1.22.15]
	at org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:60) [org.apache.jackrabbit.oak-store-spi:1.22.15]
	at org.apache.jackrabbit.oak.segment.scheduler.Commit.apply(Commit.java:99) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.segment.scheduler.LockBasedScheduler.execute(LockBasedScheduler.java:299) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.segment.scheduler.LockBasedScheduler.schedule(LockBasedScheduler.java:270) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.segment.SegmentNodeStore.merge(SegmentNodeStore.java:211) [org.apache.jackrabbit.oak-segment-tar:1.22.15]
	at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:251) [org.apache.jackrabbit.oak-core:1.22.15]
	at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:346) [org.apache.jackrabbit.oak-jcr:1.22.15]
	at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:493) [org.apache.jackrabbit.oak-jcr:1.22.15]
	... 179 common frames omitted

 

Can anyone shed some light on this? I thought POST is allowed and in above is a simple post servlet. 

1 Accepted Solution

Avatar

Correct answer by
Adobe Champion

I think what's happening is you have not registered your servlet to accept POST calls, and therefore you're instead hitting the default Sling Post servlet.  Because you're hitting the default Sling Post servlet, it's acting like your POST is a request to save data into the JCR, which is failing and giving you the stack trace indicating a failed commit.

 

To tell AEM that your servlet can accept POST requests, you must add into the `property` config the following:

ServletResolverConstants.SLING_SERVLET_METHODS + "=" + HttpConstants.METHOD_POST,

OR

"sling.servlet.methods=POST"

View solution in original post

2 Replies

Avatar

Community Advisor

Hi, 

 

Are you sure that the code you posted here is the same code which is running on AEM? From what I can see, the code should have at least this entry (which I didn't find in your log)


catch (Exception e) {
            log.error("SubscribeServlet error  ", e); //THIS LINE
            throw new ServletException("SubscribeServlet exception");
        }

Also, the log is pointing out this issue, which seems like your servlet is trying to save some changes and does not have permission to do so. However, your code does not have any reference to such operations. Therefore, I guess that you are running a different code. Can you please double-check?

Caused by: javax.jcr.AccessDeniedException: OakAccess0000: Access denied

 

Hope this helps.

 



Esteban Bustamante

Avatar

Correct answer by
Adobe Champion

I think what's happening is you have not registered your servlet to accept POST calls, and therefore you're instead hitting the default Sling Post servlet.  Because you're hitting the default Sling Post servlet, it's acting like your POST is a request to save data into the JCR, which is failing and giving you the stack trace indicating a failed commit.

 

To tell AEM that your servlet can accept POST requests, you must add into the `property` config the following:

ServletResolverConstants.SLING_SERVLET_METHODS + "=" + HttpConstants.METHOD_POST,

OR

"sling.servlet.methods=POST"