Confluence NullPointerException after attempting to upgrade
Asked by CodeSmile:

I get a generic NullPointerException when I try to launch my 5.1.1 instance on Ubuntu.

I initially tried to upgrade to 5.1.5 as the confluence user, but the upgrade was aborted due to permission error, which left the install dir broken (some files already deleted). As always I had made backup copies via cp -r of both install and home dir.

So I removed the broken install \& home folders and copied the backup folders back in place. This is when I noticed that I had permission errors (ie could not write log files and such errors), so I ran chown -r confluence and chmod -r 775 on both install \& home folders - somewhat brute force but I just wanted to get rid of the permission errors for now.

This is when the null pointer exception started to occur. I tried cleaning the caches to no avail. I double checked all config files.

I even did what was suggested in another thread: I changed the home dir and re-ran confluence setup wizard with a new, empty database (postgres 9 via jdbc). This way I could verify that the db connection is still correct and that the install dir also seems to be ok. After I had an empty confluence I shut down the instance and changed the confluence.cfg.xml to point to the original db - restarted and voila, the spaces etc. were all there - just not the attachments and all that.

However, as soon as I point the home dir back to the original home dir (exact same settings in confluence.cfg.xml) I get the null pointer exception I posted below. I can clean caches as much as I want it isn't helping.

For now I'll attempt to copy individual folders to the new test installation's home directory in order to pinpoint what folder and perhaps which file causes the exception. But in the meantime I'd appreciate any pointers as to what else I should try.

Specifically, are there any other (temporary) files I should try to delete? Webresource-temp for example sounds like temporary files.

```
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException	com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)	com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112)	com.atlassian.confluence.setup.ConfluenceEncodingFilter.getGlobalSettings(ConfluenceEncodingFilter.java:45)	com.atlassian.confluence.setup.ConfluenceEncodingFilter.getEncodingInternal(ConfluenceEncodingFilter.java:35)	com.atlassian.confluence.setup.ConfluenceEncodingFilter.getEncoding(ConfluenceEncodingFilter.java:27)	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:38)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:65)root cause java.lang.NullPointerException	com.atlassian.spring.container.ContainerManager.getComponent(ContainerManager.java:33)	com.atlassian.confluence.util.LazyComponentReference$Accessor.get(LazyComponentReference.java:44)	com.atlassian.util.concurrent.Lazy$Strong.create(Lazy.java:85)	com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:321)	com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143)	com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112)	com.atlassian.confluence.setup.ConfluenceEncodingFilter.getGlobalSettings(ConfluenceEncodingFilter.java:45)	com.atlassian.confluence.setup.ConfluenceEncodingFilter.getEncodingInternal(ConfluenceEncodingFilter.java:35)	com.atlassian.confluence.setup.ConfluenceEncodingFilter.getEncoding(ConfluenceEncodingFilter.java:27)	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:38)	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)	com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:65)note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.
```

Note: I found this error in the atlassian-confluence.log:

```
2013-08-24 19:55:07,660 INFO [main] [com.atlassian.confluence.lifecycle] &lt;init&gt; Loading EhCache cache manager2013-08-24 19:55:11,642 ERROR [main] [springframework.web.context.ContextLoader] initWebApplicationContext Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'macroIconManager' defined in class path resource [services/pluginServiceContext.xml]: Cannot resolve reference to bean 'httpRetrievalService' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'httpRetrievalService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'settingsManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'upgradeManager' while setting bean property 'upgradeManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'upgradeManager' defined in class path resource [upgradeSubsystemContext.xml]: Cannot resolve reference to bean 'removeClassicThemeUpgradeTask' while setting bean property 'upgradeTasks' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'removeClassicThemeUpgradeTask' defined in class path resource [upgradeSubsystemContext.xml]: Cannot resolve reference to bean 'spaceManager' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spaceManager' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexManager' defined in class path resource [indexingSubsystemContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexTaskPerformer' defined in class path resource [indexingSubsystemContext.xml]: Cannot resolve reference to bean 'luceneConnection' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'luceneConnection' defined in class path resource [indexingSubsystemContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bonnie.LuceneConnection]: Constructor threw exception; nested exception is java.lang.NumberFormatException: For input string: "12h.gz"
```


Answers:
author: uWEB
body: delete index-folder \> confluence-home\>index


author: RambanamP
body: as per your log, lot of people faced this problem check few

[https://answers.atlassian.com/questions/94131/confluence-system-error-java-lang-nullpointerexception](/questions/94131/confluence-system-error-java-lang-nullpointerexception)

[https://answers.atlassian.com/questions/56733/confluence-suddenly-unusable-java-error](/questions/56733/confluence-suddenly-unusable-java-error)

[https://answers.atlassian.com/questions/180647/how-do-i-fix-this-error](/questions/180647/how-do-i-fix-this-error)

[https://answers.atlassian.com/questions/201441/confluence-unusable-after-restart](/questions/201441/confluence-unusable-after-restart)

i hope those links will help you!!

comments: author: CodeSmile
body: Thanks. Database is correct, so that can't be the problem. I'm still not rooting out ownership or permission issues, though my brute force attempt should have fixed any.

Interestingly at some point I keep getting "Tomcat did not stop in time. PID file was not removed." messages when trying to shut down confluence. That didn't happen before.


Tags: confluence-administration

startup