Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-2890

Intermittent NullPointerException in ClassLoaderWriterImpl when running org.apache.sling.launchpad.webapp.integrationtest.servlets.resolver.errorhandler.ErrorHandlingTest

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: JCR Classloader 3.1.12
    • Fix Version/s: None
    • Component/s: JCR
    • Labels:

      Description

      I've seen this error about 50% of the times when running the launchpad tests. The complete stack trace is

      org.apache.sling.api.SlingException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP
      at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:691)
      at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608)
      at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:525)
      at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
      at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:265)
      at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:87)
      at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:465)
      at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
      at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
      at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
      at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)
      at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:259)
      at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)
      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)
      at org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:47)
      at org.apache.sling.launchpad.testservices.filters.NoPropertyFilter.doFilter(NoPropertyFilter.java:25)
      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
      at org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:47)
      at org.apache.sling.launchpad.testservices.filters.SlingFilter.doFilter(SlingFilter.java:25)
      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
      at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:64)
      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
      at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processRequest(SlingRequestProcessorImpl.java:151)
      at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:206)
      at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:96)
      at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
      at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
      at org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:47)
      at org.apache.sling.launchpad.testservices.filters.HttpServiceExtFilter.doFilter(HttpServiceExtFilter.java:27)
      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
      at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
      at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75)
      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
      at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
      at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
      at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
      at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:326)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      Caused by: java.lang.NullPointerException: Specified service reference cannot be null.
      at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:458)
      at org.apache.sling.jcr.classloader.internal.ClassLoaderWriterImpl.getOrCreateClassLoader(ClassLoaderWriterImpl.java:215)
      at org.apache.sling.jcr.classloader.internal.ClassLoaderWriterImpl.getClassLoader(ClassLoaderWriterImpl.java:523)
      at org.apache.sling.scripting.jsp.SlingIOProvider.getClassLoader(SlingIOProvider.java:163)
      at org.apache.sling.scripting.jsp.jasper.JspCompilationContext.getClassLoader(JspCompilationContext.java:134)
      at org.apache.sling.scripting.jsp.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:193)
      at org.apache.sling.scripting.jsp.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
      at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:123)
      at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getType(PackageBinding.java:126)
      at org.eclipse.jdt.internal.compiler.lookup.Scope.findType(Scope.java:1327)
      at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2351)
      at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2074)
      at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:44)
      at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:130)
      at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:138)
      at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:432)
      at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:190)
      at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:403)
      at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1047)
      at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1094)
      at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:353)
      at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:596)
      at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:411)
      at org.apache.sling.scripting.jsp.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:412)
      at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:312)
      at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:290)
      at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:277)
      at org.apache.sling.scripting.jsp.jasper.JspCompilationContext.compile(JspCompilationContext.java:501)
      at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.prepareServlet(JspServletWrapper.java:427)
      at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:486)
      ... 54 more

      By looking at the code I noticed that access to the dynamicClassLoaderManager field is synchronized some of the time, but not in the bindDynamicClassLoaderManager and unbindDynamicClassLoaderManager methods. However, making them synchronized does not solve the problem.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rombert Robert Munteanu
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: