title: Sling Servlet in CQ - Resource is not modifiable
body: <p>I'm having some issues with a Sling Servlet in CQ. While requesting the servlet I'm getting an exception saying</p>
  <pre><code>Caused by: org.apache.sling.api.resource.PersistenceException: Resource at '/bin/feedServlet' is not modifiable.
          at org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.setProperty(SlingPropertyValueHandler.java:153)
          at org.apache.sling.servlets.post.impl.operations.ModifyOperation.writeContent(ModifyOperation.java:411)
          at org.apache.sling.servlets.post.impl.operations.ModifyOperation.doRun(ModifyOperation.java:101)
  </code></pre>
  <p>In the servlet, I'm trying to inject 2 services using the <code>@Reference</code> annotation.</p>
  <p>Please give me some pointers to solve this issue. Please find my Servlet code below (not complete):</p>
  <pre class="lang-java prettyprint-override"><code>@Component(immediate = true, metatype = false, label = &quot;feedServlet&quot;)
  @Service(Servlet.class)
  @Properties(value = { @org.apache.felix.scr.annotations.Property(name = &quot;sling.servlet.methods&quot;, value = &quot;POST&quot;),
  @org.apache.felix.scr.annotations.Property(name = &quot;sling.servlet.paths&quot;, value = &quot;/bin/feedServlet&quot;) })
  public class FeedServlet extends SlingAllMethodsServlet {
          private static final long serialVersionUID = -2139716879248038562L;
           @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, policy = ReferencePolicy.STATIC)
           private ContentSearchService searchService;
  
           @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, policy = ReferencePolicy.STATIC)
           private FeedGeneratorService feedService;
  
          @Override
          protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServerException,
                  IOException {
               ResourceResolver resourceResolver = request.getResourceResolver();
               List&lt;Hit&gt; list = null;
               String feed = null;
              try {
               list = search(request, searchService);
               feed = feedService.generateFeed(list, resourceResolver);
               } catch (Throwable e) {
               }
              response.getWriter().write(feed);
          }
  </code></pre>
  <p><strong>Note:</strong> Without these services the servlet is working fine now(<a href="https://stackoverflow.com/questions/23149751/unable-to-deploy-slingservlet-in-cq" title="previous thread">previous thread</a>). Is this an issue with the dependency injection? The <code>serviceComponets.xml</code> for this bundle defines these services as:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;scr:component enabled=&quot;true&quot; immediate=&quot;true&quot; name=&quot;com.acme.wcm.cq.servlet.FeedServlet&quot;&gt;
          &lt;implementation class=&quot;com.acme.wcm.cq.servlet.FeedServlet&quot;/&gt;
          &lt;service servicefactory=&quot;false&quot;&gt;
              &lt;provide interface=&quot;javax.servlet.Servlet&quot;/&gt;
          &lt;/service&gt;
          &lt;property name=&quot;sling.servlet.methods&quot; type=&quot;String&quot; value=&quot;POST&quot;/&gt;
          &lt;property name=&quot;sling.servlet.paths&quot; type=&quot;String&quot; value=&quot;/bin/feedServlet&quot;/&gt;
          &lt;property name=&quot;service.pid&quot; value=&quot;com.acme.wcm.cq.servlet.FeedServlet&quot;/&gt;
          &lt;reference name=&quot;searchService&quot; interface=&quot;com.acme.wcm.cq.search.ContentSearchService&quot; cardinality=&quot;1..1&quot; policy=&quot;static&quot; bind=&quot;bindSearchService&quot; unbind=&quot;unbindSearchService&quot;/&gt;
          &lt;reference name=&quot;feedService&quot; interface=&quot;com.acme.wcm.cq.feed.FeedGeneratorService&quot; cardinality=&quot;1..1&quot; policy=&quot;static&quot; bind=&quot;bindFeedService&quot; unbind=&quot;unbindFeedService&quot;/&gt;
      &lt;/scr:component&gt;
  </code></pre>