java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Configure Nexus 2.7 with a jetty.xml similar to this: {noformat} <?xml version="1.0"?> <!-- Sonatype Nexus (TM) Open Source Version Copyright (c) 2007-2013 Sonatype, Inc. All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the Eclipse Foundation. All other trademarks are the property of their respective owners. --> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!-- ============================================================ --> <!-- --> <!-- For help using this configuration, see: --> <!-- --> <!-- http://links.sonatype.com/products/nexus/oss/docs-jetty --> <!-- --> <!-- ============================================================ --> <Configure id="Server" class="org.eclipse.jetty.server.Server"> <Set name="threadPool"> <New class="com.yammer.metrics.jetty.InstrumentedQueuedThreadPool"/> </Set> <Call name="addConnector"> <Arg> <New class="org.sonatype.nexus.bootstrap.jetty.InstrumentedSslSelectChannelConnector"> <Arg> <New class="org.eclipse.jetty.util.ssl.SslContextFactory"> <Set name="keyStore">/home/rseddon/nexus-ssl/keystore</Set> <Set name="trustStore">/home/rseddon/nexus-ssl/keystore</Set> <Set name="keyStorePassword">foobar</Set> <Set name="keyManagerPassword">foobar</Set> <Set name="trustStorePassword">foobar</Set> </New> </Arg> <Set name="host">${application-host}</Set> <Set name="port">${application-port-ssl}</Set> <Set name="forwarded">true</Set> </New> </Arg> </Call> <New id="NexusHandler" class="com.yammer.metrics.jetty.InstrumentedHandler"> <Arg> <New id="NexusWebAppContext" class="org.eclipse.jetty.webapp.WebAppContext"> <Arg>${nexus-webapp}</Arg> <Arg>${nexus-webapp-context-path}</Arg> <Set name="extractWAR">false</Set> <Set name="throwUnavailableOnStartupException">true</Set> </New> </Arg> </New> <Set name="handler"> <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> <Call name="addHandler"> <Arg> <Ref id="NexusHandler"/> </Arg> </Call> </New> </Set> <Set name="stopAtShutdown">true</Set> <Set name="sendServerVersion">true</Set> <Set name="sendDateHeader">true</Set> <Set name="gracefulShutdown">1000</Set> </Configure> {noformat} Now access https://localhost:8443/nexus/content/groups/public/. You get a NPE and 500 status. {noformat} HTTP ERROR 500Problem accessing /nexus/content/groups/public/. Reason: Server ErrorCaused by:java.lang.NullPointerException at java.util.Arrays$ArrayList.<init>(Arrays.java:2842) at java.util.Arrays.asList(Arrays.java:2828) at org.sonatype.nexus.web.content.NexusContentServlet.getResourceStoreRequest(NexusContentServlet.java:176) at org.sonatype.nexus.web.content.NexusContentServlet.doGet(NexusContentServlet.java:330) at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) at org.sonatype.nexus.web.content.NexusContentServlet.service(NexusContentServlet.java:321) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:278) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:268) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:180) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93) at com.yammer.metrics.web.WebappMetricsFilter.doFilter(WebappMetricsFilter.java:76) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) at org.sonatype.nexus.web.NexusGuiceFilter$MultiFilterChain.doFilter(NexusGuiceFilter.java:83) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) {noformat} The problem is the NexusContentServlet ( now ContentServlet in 2.8-SNAPSHOT ) expects that the request attribute "javax.servlet.request.X509Certificate" is populated if an incoming request is https. There is no guarantee this will be true. In fact the default is this is not the case. You would have to configure jetty SslContextFactory with needClientAuth(true) and be using SSL client certificates in order to make this work. Bad code: {code:java} if (request.isSecure()) { result.getRequestContext().put(AccessManager.REQUEST_CONFIDENTIAL, Boolean.TRUE); final List<X509Certificate> certs = Arrays.asList((X509Certificate[]) request .getAttribute("javax.servlet.request.X509Certificate")); // <==== NPE HERE if (certs != null && !certs.isEmpty()) { result.getRequestContext().put(AccessManager.REQUEST_CERTIFICATES, certs); } } {code}
    via by Peter Lynch,
  • NPE with /give command
    via GitHub by tobi1449
    ,
  • create index with COLLATE bug?
    via by john davids,
    • java.lang.NullPointerException at java.util.Arrays$ArrayList.<init>(Arrays.java:2842) at java.util.Arrays.asList(Arrays.java:2828) at org.sonatype.nexus.web.content.NexusContentServlet.getResourceStoreRequest(NexusContentServlet.java:176) at org.sonatype.nexus.web.content.NexusContentServlet.doGet(NexusContentServlet.java:330) at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) at org.sonatype.nexus.web.content.NexusContentServlet.service(NexusContentServlet.java:321) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:278) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:268) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:180) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93) at com.yammer.metrics.web.WebappMetricsFilter.doFilter(WebappMetricsFilter.java:76) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) at org.sonatype.nexus.web.NexusGuiceFilter$MultiFilterChain.doFilter(NexusGuiceFilter.java:83) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120)

    Users with the same issue

    Unknown visitor
    Unknown visitor2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    poroszdporoszd
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    19 more bugmates