You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Mark Derricutt <ma...@talios.com> on 2010/04/09 02:14:58 UTC

NullPointerExceptions starting sling

Hi all,

Not really sure how to diagnose this problem I'm having, every time I
attach a debugger it goes away.

Anyway, after updated the our sling/osgi infrastructure from using
sling 2.0.2-incubation to the current release version, all of our
integration tests started to fail because sling was no longer creating
its content repository ( it sometimes works, but more often doesn't ).
 Basically, my integration tests start a Felix instance and deploy all
of slings bundles, I'm now getting the following NPE being logged:

09.04.2010 11:53:59.161 *INFO* [SCR Component Actor]
org.apache.sling.jcr.jackrabbit.server Using JNDI context
{java.naming.provider.url=http://sling.apache.org,
java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory}
to register repositories
09.04.2010 11:53:59.163 *INFO* [SCR Component Actor]
org.apache.sling.jcr.jackrabbit.server Using RMI Registry port 1099
09.04.2010 11:53:59.176 *INFO* [FelixStartLevel]
org.springframework.osgi.extender.internal.activator.ContextLoaderListener
Starting [org.springframework.bundle.osgi.extender] bundle v.[1.1.1]
09.04.2010 11:53:59.185 *INFO* [SCR Component Actor]
org.apache.sling.jcr.jackrabbit.server Configuration File
/Users/amrk/IdeaProjects/securemx/smx3/integration/launchpad-tests has
been lost, trying to recreate
09.04.2010 11:53:59.190 *ERROR* [SCR Component Actor]
org.apache.sling.jcr.jackrabbit.server startRepository: Uncaught
Throwable trying to access Repository, calling stopRepository()
(java.lang.NullPointerException) java.lang.NullPointerException
	at org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepository.copyFile(SlingServerRepository.java:212)
	at org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepository.acquireRepository(SlingServerRepository.java:133)
	at org.apache.sling.jcr.base.AbstractSlingRepository.startRepository(AbstractSlingRepository.java:762)
	at org.apache.sling.jcr.base.AbstractSlingRepository.activate(AbstractSlingRepository.java:580)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
	at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
	at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
	at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
	at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:138)
	at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:226)
	at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
	at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:991)
	at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:298)
	at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:138)
	at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
	at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
	at java.lang.Thread.run(Thread.java:637)
DEBUG: WIRE: 14.0 -> org.xml.sax.helpers -> 0
Apr 9, 2010 11:53:59 AM net.sf.ehcache.config.ConfigurationFactory
parseConfiguration
WARNING: No configuration found. Configuring ehcache from
ehcache-failsafe.xml  found in the classpath:
bundle://14.0:11/ehcache-failsafe.xml
DEBUG: WIRE: 14.0 -> javax.xml.parsers -> 0
09.04.2010 11:53:59.458 *INFO* [FelixStartLevel]
org.springframework.bundle.osgi.extender Service [74] ServiceEvent
REGISTERED


When I start Felix I'm setting the following options:

        configMap.put("sling.home", "/var/smx3/sling");
        configMap.put("sling.context.default", "default");
        configMap.put("felix.cm.dir", "/var/smx3/felix/config");
        configMap.put("ds.factory.enabled", "true");
        configMap.put("org.osgi.service.http.port", "8888");

The directory /var/smx3 exists, but is empty, and writable.  The
problem seems to occur even if the repository exists ( using the
default embedded database repository ).

Has anyone seen this behaviour before?  Is there some step I may have
missed?  What confuses me is when I set a breakpointon
SlingServerRepository#copyFile and attach a debugger, everything runs
fine, which leads to think theres some race condition or something
happening -somewhere-.

Mark


-- 
Pull me down under...

Re: NullPointerExceptions starting sling

Posted by Mark Derricutt <ma...@talios.com>.
Cool, I suspected as much, as this is all being done from some
integration tests ( everything works fine when we start from using
karaf ) I'll just add this my normal config bootstrap process.

-- 
Pull me down under...

On Sat, Apr 10, 2010 at 1:31 AM, Justin Edelson <ju...@gmail.com> wrote:
> Mark-
> I don't know how this happened, but it should be easy to fix.
> 1) Start Sling.
> 2) Go to http://[sling host]:[sling port]/system/console/configMgr
> 3) Find the "Apache Sling Embedded JCR Repository" configuration and
> click Edit.
> 4) Correct the values as necessary and click Save.
>
> Within the polling intveral you should be good to go.
>
> HTH,
> Justin
>
>
>
> Justin
>
> On 4/8/10 9:02 PM, Mark Derricutt wrote:
>> Looking further back up the call chain I see that the
>> org.apache.sling.jcr.jackrabbit.server.SlingServerRepository component
>> configuration has "" as the values for home and config, and its the
>> when the File("").getParent() is called ( config ) that the NPE is
>> called.
>>
>> I guess an earlier version of sling looked for the sling.home
>> environment property which was being set in sling.properties of the
>> old launchpad, and our integration tests?
>>
>
>

Re: NullPointerExceptions starting sling

Posted by Justin Edelson <ju...@gmail.com>.
Mark-
I don't know how this happened, but it should be easy to fix.
1) Start Sling.
2) Go to http://[sling host]:[sling port]/system/console/configMgr
3) Find the "Apache Sling Embedded JCR Repository" configuration and
click Edit.
4) Correct the values as necessary and click Save.

Within the polling intveral you should be good to go.

HTH,
Justin



Justin

On 4/8/10 9:02 PM, Mark Derricutt wrote:
> Looking further back up the call chain I see that the
> org.apache.sling.jcr.jackrabbit.server.SlingServerRepository component
> configuration has "" as the values for home and config, and its the
> when the File("").getParent() is called ( config ) that the NPE is
> called.
> 
> I guess an earlier version of sling looked for the sling.home
> environment property which was being set in sling.properties of the
> old launchpad, and our integration tests?
> 


Re: NullPointerExceptions starting sling

Posted by Mark Derricutt <ma...@talios.com>.
Looking further back up the call chain I see that the
org.apache.sling.jcr.jackrabbit.server.SlingServerRepository component
configuration has "" as the values for home and config, and its the
when the File("").getParent() is called ( config ) that the NPE is
called.

I guess an earlier version of sling looked for the sling.home
environment property which was being set in sling.properties of the
old launchpad, and our integration tests?

-- 
Pull me down under...

On Fri, Apr 9, 2010 at 12:14 PM, Mark Derricutt <ma...@talios.com> wrote:
> Hi all,
>
> Not really sure how to diagnose this problem I'm having, every time I
> attach a debugger it goes away.
>
> Anyway, after updated the our sling/osgi infrastructure from using
> sling 2.0.2-incubation to the current release version, all of our
> integration tests started to fail because sling was no longer creating
> its content repository ( it sometimes works, but more often doesn't ).
>  Basically, my integration tests start a Felix instance and deploy all
> of slings bundles, I'm now getting the following NPE being logged:
>
> 09.04.2010 11:53:59.161 *INFO* [SCR Component Actor]
> org.apache.sling.jcr.jackrabbit.server Using JNDI context
> {java.naming.provider.url=http://sling.apache.org,
> java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory}
> to register repositories
> 09.04.2010 11:53:59.163 *INFO* [SCR Component Actor]
> org.apache.sling.jcr.jackrabbit.server Using RMI Registry port 1099
> 09.04.2010 11:53:59.176 *INFO* [FelixStartLevel]
> org.springframework.osgi.extender.internal.activator.ContextLoaderListener
> Starting [org.springframework.bundle.osgi.extender] bundle v.[1.1.1]
> 09.04.2010 11:53:59.185 *INFO* [SCR Component Actor]
> org.apache.sling.jcr.jackrabbit.server Configuration File
> /Users/amrk/IdeaProjects/securemx/smx3/integration/launchpad-tests has
> been lost, trying to recreate
> 09.04.2010 11:53:59.190 *ERROR* [SCR Component Actor]
> org.apache.sling.jcr.jackrabbit.server startRepository: Uncaught
> Throwable trying to access Repository, calling stopRepository()
> (java.lang.NullPointerException) java.lang.NullPointerException
>        at org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepository.copyFile(SlingServerRepository.java:212)
>        at org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepository.acquireRepository(SlingServerRepository.java:133)
>        at org.apache.sling.jcr.base.AbstractSlingRepository.startRepository(AbstractSlingRepository.java:762)
>        at org.apache.sling.jcr.base.AbstractSlingRepository.activate(AbstractSlingRepository.java:580)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
>        at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
>        at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
>        at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
>        at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:138)
>        at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:226)
>        at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:991)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:298)
>        at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:138)
>        at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
>        at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
>        at java.lang.Thread.run(Thread.java:637)
> DEBUG: WIRE: 14.0 -> org.xml.sax.helpers -> 0
> Apr 9, 2010 11:53:59 AM net.sf.ehcache.config.ConfigurationFactory
> parseConfiguration
> WARNING: No configuration found. Configuring ehcache from
> ehcache-failsafe.xml  found in the classpath:
> bundle://14.0:11/ehcache-failsafe.xml
> DEBUG: WIRE: 14.0 -> javax.xml.parsers -> 0
> 09.04.2010 11:53:59.458 *INFO* [FelixStartLevel]
> org.springframework.bundle.osgi.extender Service [74] ServiceEvent
> REGISTERED
>
>
> When I start Felix I'm setting the following options:
>
>        configMap.put("sling.home", "/var/smx3/sling");
>        configMap.put("sling.context.default", "default");
>        configMap.put("felix.cm.dir", "/var/smx3/felix/config");
>        configMap.put("ds.factory.enabled", "true");
>        configMap.put("org.osgi.service.http.port", "8888");
>
> The directory /var/smx3 exists, but is empty, and writable.  The
> problem seems to occur even if the repository exists ( using the
> default embedded database repository ).
>
> Has anyone seen this behaviour before?  Is there some step I may have
> missed?  What confuses me is when I set a breakpointon
> SlingServerRepository#copyFile and attach a debugger, everything runs
> fine, which leads to think theres some race condition or something
> happening -somewhere-.
>
> Mark
>
>
> --
> Pull me down under...
>