[BLOSSOM-217] Context initialization depends on context itself (?), IllegalStateException Created: 10/Jul/15 Updated: 16/Jul/15 Resolved: 16/Jul/15 |
|
| Status: | Closed |
| Project: | Blossom |
| Component/s: | None |
| Affects Version/s: | 3.0.7 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Neutral |
| Reporter: | TLN | Assignee: | Tobias Mattsson |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
Hi, I have a weird problem. It seems to be a bug, but I'm not 100% sure. I need some help with figuring it out though. java.lang.IllegalStateException: DialogCreationContext not set, dialog cannot be created without it [blossom-area-dialog:project.spring.web.blossom.controllers.templates.HomePageTemplate$StageArea] at info.magnolia.module.blossom.dialog.BlossomDialogDefinitionProvider.getDialogDefinition(BlossomDialogDefinitionProvider.java:67) at info.magnolia.ui.dialog.registry.DialogDefinitionRegistry.register(DialogDefinitionRegistry.java:96) at info.magnolia.module.blossom.template.TemplateExporter.registerAreaDialog(TemplateExporter.java:293) at info.magnolia.module.blossom.template.TemplateExporter.registerAreaDialogs(TemplateExporter.java:270) at info.magnolia.module.blossom.template.TemplateExporter.exportTemplates(TemplateExporter.java:202) at info.magnolia.module.blossom.template.TemplateExporter.onApplicationEvent(TemplateExporter.java:173) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331) at info.magnolia.module.blossom.render.BlossomDispatcherServlet.onRefresh(BlossomDispatcherServlet.java:119) at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:801) at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1117) at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1113) at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:52) at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:100) at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:69) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at info.magnolia.module.blossom.module.BlossomModuleSupport.initDispatcherServlet(BlossomModuleSupport.java:168) at info.magnolia.module.blossom.module.BlossomModuleSupport.initBlossomDispatcherServlet(BlossomModuleSupport.java:127) As you can see the stack trace contains these lines: at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489) , so obviously the web application context is just in the process of getting initialized. Unfortunately, as part of this it runs through the following lines:
DialogCreationContext context = DialogCreationContextHolder.get();
if (context == null) {
throw new IllegalStateException("DialogCreationContext not set, dialog cannot be created without it [" + dialogDescription.getId() + "]");
}
This very exception is thrown (see stack trace above), because there is no context yet, which seems somehow expected as it is just getting initialized. Now you might be wondering what I'm trying to do. I think it's quite a normal thing, I'm trying to render an area which is a direct inner class of a @Template controller. The area definition looks pretty much like this: @Area(value="stage", title="Stage") @Controller public static class StageArea { @RequestMapping("/homepage/stage") public String render(Model model) { return "components/home_stage.jsp"; } @TabFactory("Content") public void contentTab(UiConfig cfg, TabBuilder tab) { tab.fields( cfg.fields.text("headline").label("Headline").rows(3) ); } } Thanks a lot for giving some input on how to solve this. Googling didn't help. |
| Comments |
| Comment by TLN [ 13/Jul/15 ] |
|
Sorry for not pinpointing the problem further in my report. I did a few more tests and can now give the following additional input: Caused by: java.lang.NullPointerException at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1069) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1001) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) at javax.servlet.http.HttpServlet.service(HttpServlet.java:618) 3. Even if the contentTab() method is left empty (noop method body), the IllegalStateException is thrown on webapp startup. |
| Comment by Tobias Mattsson [ 13/Jul/15 ] |
|
Which version of Magnolia are you using? For 5.4 there will be a 3.1 version of Blossom released shortly. |
| Comment by TLN [ 13/Jul/15 ] |
|
Hi Tobias, I was using Magnolia 5.4. Thanks for this hint. When they advertised Magnolia 5.4 in the Magnolia newsletter lately, I thought I should start my new project on that version, not aware that Blossom was not yet ready. I guess I should resort to 5.3 then. |
| Comment by Dominika [ 14/Jul/15 ] |
|
Magnolia 5.4 has updated EhCache so it's great news (now we have disabled caching in Mag as we needed newer lib with Blossom). Tried to use it and got the same message.. obviously RenderException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.jcr.Node]: Specified class is an interface info.magnolia.rendering.engine.RenderException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.jcr.Node]: Specified class is an interface at info.magnolia.module.blossom.render.BlossomTemplateRenderer.render(BlossomTemplateRenderer.java:86) at info.magnolia.rendering.engine.DefaultRenderingEngine.render(DefaultRenderingEngine.java:118) |
| Comment by Tobias Mattsson [ 14/Jul/15 ] |
|
tln 3.1 will be released any day now so go with 3.1-SNAPSHOT until its released. dominka That seems to be a separate problem, could you share the full stack trace? Preferably as a new ticket. |
| Comment by Dominika [ 14/Jul/15 ] |
|
@Tobias Mattsson the full stack trace is in this ticket: https://jira.magnolia-cms.com/browse/BLOSSOM-218 |
| Comment by Tobias Mattsson [ 16/Jul/15 ] |
|
3.1 is now available in our maven repository. I'll go ahead and close the ticket. |