8 Replies Latest reply on Dec 8, 2017 6:31 AM by Ratna Kumar

    AEM6.1 create servlet bundle in crxde lite - NullPointerException

    kooljman

      I've got logs..

      Please check bus in java.

      =========================================================

      07.12.2017 14:19:36.544 *ERROR* [0:0:0:0:0:0:0:1 [1512623976471] POST /libs/crxde/build HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable

      javax.servlet.ServletException: java.lang.NullPointerException

      at com.day.crx.ide.AbstractCRXDEServlet.throwError(AbstractCRXDEServlet.java:139)

      at com.day.crx.ide.CRXDEBuildServlet.handleAuthenticatedRequest(CRXDEBuildServlet.java:178)

      at com.day.crx.ide.AbstractCRXDEServlet.processRequest(AbstractCRXDEServlet.java:98)

      at com.day.crx.ide.AbstractCRXDEServlet.doPost(AbstractCRXDEServlet.java:79)

      at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.ja va:148)

      at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.jav a:344)

      at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.jav a:375)

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

      at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilter Chain.java:45)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:64)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProce ssorImpl.java:284)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:64)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.adobe.cq.social.commons.security.SaferSlingPostServlet.doFilter(SaferSlingPostServlet .java:133)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.j ava:349)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgre ssTrackerLogFilter.java:64)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.j ava:251)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.theme.impl.ThemeResolverFilter.doFilter(ThemeResolverFilter.java:76)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.designimporter.CanvasPageDeleteRequestFilter.doFilter(CanvasPageDeleteRequ estFilter.java:88)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

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

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.adobe.cq.dam.s7imaging.impl.auth.MemoryTokenAuthHandler.doFilter(MemoryTokenAuthHandl er.java:156)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter.doFilter(BackgroundServle tStarterFilter.java:135)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(Resourc eResolverHelperImpl.java:81)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProce ssorImpl.java:153)

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

      at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:3 39)

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

      at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java: 93)

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:50)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:31)

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

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108 )

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

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:46)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:31)

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

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108 )

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

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:46)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:31)

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

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108 )

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

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:46)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:31)

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

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108 )

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

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:46)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:31)

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

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108 )

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

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:46)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:31)

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

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108 )

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

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:46)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:31)

      at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java: 76)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java :494)

      at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)

      at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnec tion.java:1043)

      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)

      at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)

      at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

      at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)

      at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

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

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

      at java.lang.Thread.run(Unknown Source)

      Caused by: java.lang.NullPointerException: null

      at org.apache.felix.scrplugin.helper.ClassScanner.getComponentDescriptors(ClassScanner.java: 465)

      at org.apache.felix.scrplugin.helper.ClassScanner.getDescription(ClassScanner.java:433)

      at org.apache.felix.scrplugin.SCRDescriptorGenerator.createComponent(SCRDescriptorGenerator. java:398)

      at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:161 )

      at com.day.crx.ide.BundleBuilder.generateScrDescriptors(BundleBuilder.java:624)

      at com.day.crx.ide.BundleBuilder.build(BundleBuilder.java:245)

      at com.day.crx.ide.CRXDEBuildServlet.handleAuthenticatedRequest(CRXDEBuildServlet.java:165)

      ... 120 common frames omitted

      ======================================================================

       

      package com.kjm.simple.example;

       

      import org.apache.felix.scr.annotations.sling.SlingServlet;
      import org.apache.felix.scr.annotations.Properties;
      import org.apache.felix.scr.annotations.Property;
      import org.apache.sling.api.SlingHttpServletRequest;
      import org.apache.sling.api.SlingHttpServletResponse;
      import org.apache.sling.api.servlets.OptingServlet;
      import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
      import org.apache.sling.commons.json.JSONException;
      import org.apache.sling.commons.json.JSONObject;

      import javax.servlet.ServletException;
      import java.io.IOException;

       

       

      @SlingServlet(

          resourceTypes={"/bin/test/MyServlet"},

          extensions={"json"},

          generateService = true,

          generateComponent = true,

          label="Sample servlet",

          methods={"GET"},

          metatype=true,

          name="com.kjm.simple.example.MyServlet"

      )
      public class MyServlet extends SlingSafeMethodsServlet {

          @Override
          protected void doGet(SlingHttpServletRequest req, SlingHttpServletResponse res) throws ServerException, IOException {

              res.setContentType("application/json");

              try{
                  JSONObject obj = new JSONObject();
               obj.put("success", true);
               obj.put("test", "test");

                  res.getWriter().println(obj.toString());
              }catch(JSONException e){
                  System.out.println(e);
              }

          }

      }