sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Munteanu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SLING-7811) NPE when repository is starting up
Date Wed, 08 Aug 2018 10:31:00 GMT

    [ https://issues.apache.org/jira/browse/SLING-7811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16572994#comment-16572994
] 

Robert Munteanu commented on SLING-7811:
----------------------------------------

With the current master branch, plus

{noformat}diff --git a/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminWhitelist.java
b/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminWhitelist.java
index 5bd5d38..38c001b 100644
--- a/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminWhitelist.java
+++ b/src/main/java/org/apache/sling/jcr/base/internal/LoginAdminWhitelist.java
@@ -29,6 +29,7 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
 import org.osgi.service.component.annotations.Modified;
 import org.osgi.service.component.annotations.Reference;
 import org.osgi.service.component.annotations.ReferenceCardinality;
@@ -52,7 +53,8 @@ import static org.apache.sling.commons.osgi.PropertiesUtil.toStringArray;
         property = {
                 Constants.SERVICE_DESCRIPTION + "=Apache Sling Login Admin Whitelist",
                 Constants.SERVICE_VENDOR + "=The Apache Software Foundation"
-        }
+        },
+        configurationPolicy = ConfigurationPolicy.REQUIRE
 )
 @Designate(
         ocd = LoginAdminWhitelistConfiguration.class
{noformat}

{noformat}
diff --git a/src/main/provisioning/sling.txt b/src/main/provisioning/sling.txt
index e72e122..d779e1f 100644
--- a/src/main/provisioning/sling.txt
+++ b/src/main/provisioning/sling.txt
@@ -106,7 +106,7 @@
 [artifacts startLevel=15]
     org.apache.sling/org.apache.sling.jcr.jcr-wrapper/2.0.0
     org.apache.sling/org.apache.sling.jcr.api/2.4.0
-    org.apache.sling/org.apache.sling.jcr.base/3.0.4
+    org.apache.sling/org.apache.sling.jcr.base/3.0.5-SNAPSHOT
     org.apache.sling/org.apache.sling.jcr.registration/1.0.4
     org.apache.jackrabbit/jackrabbit-api/${jackrabbit.version}
     org.apache.jackrabbit/jackrabbit-jcr-commons/${jackrabbit.version}
@@ -153,6 +153,10 @@
     org.apache.sling.commons.log.file="logs/request.log"
     org.apache.sling.commons.log.level="info"
 
+  # SLING-7811 - wait until at all admin config fragments exist
+  org.apache.sling.jcr.base.internal.LoginAdminWhitelist
+    WhitelistFragment.cardinality.minimum=I"1"
+
   # TODO: remove bundles as their dependency on admin login is fixed, see SLING-5355 for
linked issues
   # For these bundles, admin login is considered "ok":
   # org.apache.sling.jcr.contentloader
{noformat}

I get a single restart of the repository startup sequence, but multiple service-related errors
( also see above ). One of the things that puzzles me is that the {{SlingServletResolver}}
is registered, but can't be accessed for some reason, 

{noformat}
08.08.2018 12:46:10.398 *INFO* [Apache Sling Repository Startup Thread #2] org.apache.sling.servlets.resolver
Service [org.apache.sling.servlets.resolver.SlingServletResolver,638, [org.apache.sling.api.servlets.ServletResolver,
org.apache.sling.api.scripting.SlingScriptResolver, org.apache.sling.engine.servlets.ErrorHandler,
org.apache.sling.api.request.SlingRequestListener]] ServiceEvent REGISTERED
...
08.08.2018 12:46:10.694 *INFO* [Timer-1] org.apache.sling.servlets.resolver bundle org.apache.sling.servlets.resolver:2.4.22
(158)[org.apache.sling.servlets.resolver.SlingServletResolver(268)] :  Could not obtain all
required dependencies, getService returning null
...
08.08.2018 12:46:10.696 *ERROR* [FelixDispatchQueue] org.apache.sling.starter.startup FrameworkEvent
ERROR (org.osgi.framework.ServiceException: Service factory returned null. (Component: org.apache.sling.servlets.resolver.SlingServletResolver
(268)))
org.osgi.framework.ServiceException: Service factory returned null. (Component: org.apache.sling.servlets.resolver.SlingServletResolver
(268))
        at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:380)
        at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:247)
        at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:350)
        at org.apache.felix.framework.Felix.getService(Felix.java:3737)
        at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:470)
        at org.apache.sling.starter.startup.impl.Activator.checkServices(Activator.java:146)
        at org.apache.sling.starter.startup.impl.Activator.access$100(Activator.java:32)
        at org.apache.sling.starter.startup.impl.Activator$1$1.run(Activator.java:108)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

{noformat}

That _Timer-1_ thread comes from the {{org.apache.sling.starter.startup}} bundle, but I can't
find anything wrong with the code. It is a timer, indeed, but it's not hanging on to stale
service references. The same thing happens to the {{ResourceResolverFactory}}

{noformat}08.08.2018 12:46:10.724 *INFO* [Apache Sling Repository Startup Thread #2] org.apache.sling.servlets.resolver
bundle org.apache.sling.servlets.resolver:2.4.22 (158)[org.apache.sling.servlets.resolver.SlingServletResolver(268)]
:  Could not obtain all required dependencies, getService returning null
08.08.2018 12:46:10.725 *ERROR* [FelixDispatchQueue] org.apache.sling.engine FrameworkEvent
ERROR (org.osgi.framework.ServiceException: Service factory returned null. (Component: org.apache.sling.servlets.resolver.SlingServletResolver
(268)))
{noformat}

The error message points to {{org.apache.felix.scr.impl.manager.SimpleComponentManager}}:
https://github.com/apache/felix/blob/org.apache.felix.scr-2.1.0/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java#L906-L911
. 

The {{ServletResolver}} not being available is responsible for most (all?) the logged errors
after the repository restart, but I'm not sure why this happens. My (simplistic) view on OSGi
services is that once registered, the service is available for being accessed, given that
it's visible from a classloaded point of view.

[~cziegeler] - what possible reasons could there be for the service not being able to be retrieved?


> NPE when repository is starting up
> ----------------------------------
>
>                 Key: SLING-7811
>                 URL: https://issues.apache.org/jira/browse/SLING-7811
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR Oak Server 1.1.4, JCR Base 3.0.4
>            Reporter: Carsten Ziegeler
>            Assignee: Robert Munteanu
>            Priority: Major
>             Fix For: JCR Base 3.0.6, JCR Oak Server 1.2.2
>
>
> With the latest Sling Starter, the following NPE occurs in the logs. It seems to be harmless,
nevertheless we should fix it:
> For now I assigned it to both, JCR Base and Oak Server, as it's unclear which one it
is. Interestingly we've released Oak Server 1.2.0 but are not using it in the starter.
> {noformat}
> 06.08.2018 15:45:18.396 *ERROR* [Apache Sling Repository Startup Thread] org.apache.sling.jcr.oak.server.internal.OakSlingRepositoryManager
start: Uncaught Throwable trying to access Repository, calling stopRepository()
> java.lang.NullPointerException: null
>         at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:192)
[com.google.guava:15.0.0]
>         at org.apache.jackrabbit.oak.jcr.Jcr.with(Jcr.java:296) [org.apache.jackrabbit.oak-jcr:1.6.8]
>         at org.apache.sling.jcr.oak.server.internal.OakSlingRepositoryManager.acquireRepository(OakSlingRepositoryManager.java:161)
[org.apache.sling.jcr.oak.server:1.1.4]
>         at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.initializeAndRegisterRepositoryService(AbstractSlingRepositoryManager.java:471)
[org.apache.sling.jcr.base:3.0.4]
>         at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.access$300(AbstractSlingRepositoryManager.java:85)
[org.apache.sling.jcr.base:3.0.4]
>         at org.apache.sling.jcr.base.AbstractSlingRepositoryManager$4.run(AbstractSlingRepositoryManager.java:455)
[org.apache.sling.jcr.base:3.0.4]
> {noformat}
> The stack trace points to a null workspace name ( see https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.6.8/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java#L296
).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message