Spring Application context has not been set
Asked by lamella:

I just had use the atlas-create-confluence-plugin command to create an empty confluence plugin, after plugin created, i use the atlas-run to run this empty plugin,but it run with any error, when i open the url with <http://localhost:1990/confluence>, it make 404, what should i do to solve this problem?

**Version about my development environment :**

windows11, idea, atlassian-plugin-sdk-8.2.7, JDK1.8, chrome 98.0.4758.102

**The code error :**

```
[INFO] [talledLocalContainer] java.lang.IllegalStateException: Spring Application context has not been set
[INFO] [talledLocalContainer] at com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:48)
[INFO] [talledLocalContainer] at com.atlassian.spring.container.ContainerManager.getComponent(ContainerManager.java:33)
[INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.PluginFrameworkContextListener.getPluginSystemLifecycle(PluginFrameworkContextListener.java:187)
[INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:69)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1858)
[INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] [talledLocalContainer] at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
[INFO] [talledLocalContainer] at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:969)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
[INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] [talledLocalContainer] at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
[INFO] [talledLocalContainer] at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
[INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
```


Answers:
author: Andrii Maliuta
body: Hello [@lamella](/t5/user/viewprofilepage/user-id/4805619) ,

Please refer to this doc - <https://confluence.atlassian.com/confkb/confluence-does-not-start-due-to-spring-application-context-has-not-been-set-218278311.html>

Thanks

comments: author: lamella
body: Thanks, but this doc can't help me, i find problem in pom file with confluence.version, i update it to 7.0.5 fixed this problem, SDK create command might need an upgrade in my local.


author: lamella
body: Hi Andrey,

Do you know how to change DB from H2 to mysql in plugin development? Or where can i find the default user/password about H2DB that jira/confluence use?

Thanks! : )


author: Andrii Maliuta
body: Hi [@lamella](/t5/user/viewprofilepage/user-id/4805619) ,

To access H2 for Confluence:

1. Shut down Confluence.
2. Back up your \<confluence-home\>/database directory.
3. Launch DBVisualizer. (or other DB view tool)
4. Choose to Create new database connection and follow the prompts to set up the connection.   
   The information you'll need is:  
   Database driver: **H2 embedded**   
   Database **Userid** : **sa**   
   Database **password** : leave this field blank  
   Database filename:**\<confluence-home\>/database/h2db**   
   leave off the .h2.db file extension.
5. Connect to the database.

Please refer to <https://confluence.atlassian.com/conf59/embedded-h2-database-792499591.html> for details

--------------------------

To change H2 to other DB - <https://confluence.atlassian.com/doc/migrating-to-another-database-148867.html>

You can change the JDBC URL in \<confluence-home\>/confluence.cfg.xml

Hope this helps :)


author: James Watts
body: I was able to update the confluence.version and confluence.data.version in the pom.xml file which resolved the 404 error I was getting, however am left with a blank page when visiting <http://localhost:1990/confluence>

Log file:

127.0.0.1 - - \[15/Mar/2023:14:56:12 -0500\] "GET /cargocpc/index.html HTTP/1.1" 200 124  
0:0:0:0:0:0:0:1 - - \[15/Mar/2023:14:56:26 -0500\] "GET /confluence HTTP/1.1" 302 -  
0:0:0:0:0:0:0:1 - - \[15/Mar/2023:14:56:26 -0500\] "GET /confluence/ HTTP/1.1" 200 80  
0:0:0:0:0:0:0:1 - - \[15/Mar/2023:14:56:38 -0500\] "GET /confluence/ HTTP/1.1" 304 -  
0:0:0:0:0:0:0:1 - - \[15/Mar/2023:14:56:39 -0500\] "GET /confluence/ HTTP/1.1" 304 -  
0:0:0:0:0:0:0:1 - - \[15/Mar/2023:14:56:39 -0500\] "GET /confluence/ HTTP/1.1" 304 -


author: lamella
body: [@James Watts](/t5/user/viewprofilepage/user-id/4715620) What version of confluence are you using now? I don't know the reason for this problem, but after you change the version of confluence, you need to execute the mvn clean command, and then execute atlas-run to run your new version of confluence. If you haven't executed mvn clean, why don't you try it? Maybe this will solve your problem.

:-)


author: James Watts
body: Thanks. Yes, I did do a clean as well. I decided to start fresh with atlas-create-confluence-plugin, then updated the pom, then atlas-run and it launched fine that time. Thanks for the reply!


Tags: app

confluence-server

server