Hello Francesco, great that you've got it working. Bartosz is on holiday so he most likely won't reply. To be sure, regarding the
<load-on-startup>0</load-on-startup> it is an issue of Glassfish only I suppose? But what i do not understand is, that if you set the correct <load-on-startup>int</load-on-startup>, where int is the order in which they should be loaded, then i would think that it should work, isn't? If that solves the issue, then I think we should have correct numbers in the <load-on-startup>, as they do seem to matter. WDYT? by the way nice digging and good job, and sorry for the trouble. regards Ard 2009/4/5 Francesco Chicchiriccò <[email protected]>: > On 20-03-2009 16:41, Francesco Chicchiriccò wrote: >> >> [...] > > The problem with Glassfish was quite silly, and also the current solution > I've implemented is silly as well ;-) > > As you can remember, the NullPointerException at > nl.hippo.cms.workflow.DashboardWorkflowQueriesGenerator.generate(DashboardWorkflowQueriesGenerator.java:44) > or > nl.hippo.cms.workflow.AvailableActionsGenerator.java(AvailableActionsGenerator.java:96) > was related to the fact that the AvalonSpringBridge instance did not contain > the "serverManager" bean. > > Spending much time on debugging, I finally went to the > AvalonSpringBridgeImpl and MultipleXmlContextLoader / > MultipleXmlContextLoaderServlet; I finally could notice that the call to > AvalonSpringBridge always occurred *before* the initialization in > MultipleXmlContextLoader / MultipleXmlContextLoaderServlet took place. > I went to the web.xml and I found that this servlet had > <load-on-startup>0</load-on-startup>. > > As you can read in [1], under issue 6172006, for Glassfish 2.1, > <load-on-startup>0</load-on-startup> in web.xml means that servlet load > order does not matter. Thus, I tried to change that value, with no success. > > To solve this initialization order issue: > > * I added at the very beginning of > MultipleXmlContextLoader.initWebApplicationContext() the following > code: > > synchronized (this) { > Object wacAsObject = > servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); > if (wacAsObject != null && wacAsObject instanceof > WebApplicationContext) > return (WebApplicationContext) wacAsObject; > } > > * I modified AvalonSpringBridgeImpl.service() so that, when trying > to get > WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE from > context, if null, it instantiates the (modified) > MultipleXmlContextLoader and then call > MultipleXmlContextLoader.initWebApplicationContext() > > Using this approach, the first call that occurs, either from the servlet or > from the AvalonSprinBridge, will do the right initialization. > > Now the application is working correctly in Glassfish 2.1 / Sun Application > Server 9.11. > > Was my approach correct when solving the issue? Is there anything else - > simpler or cleaner - to achieve the same result? > > Thanks. > > [1] http://docs.sun.com/app/docs/doc/820-4329/gawlb?a=view > -- > > Francesco Chicchiriccò > Delivery Manager > > everett Italia ? > TRUSTED TO *KNOW* > > Head Office > Via Torino, 2 - 20123 Milano - Italia > Tel: > +39 02 72546847 > Fax: > +39 02 72546418 > Technology Centre > Via Federico Fellini, 2 G2/1 - 65010 Spoltore (PE) - Italia > Tel: > +39 085 2120342 / +39 085 2120537 > Fax: > +39 085 2120342 / +39 085 2120537 > > Mob: > +39 329 0573276 > e-mail: > [email protected] <mailto:[email protected]> > Web: > http://www.everett.it > ******************************************** > Hippocms-dev: Hippo CMS development public mailinglist > > Searchable archives can be found at: > MarkMail: http://hippocms-dev.markmail.org > Nabble: http://www.nabble.com/Hippo-CMS-f26633.html > > ******************************************** Hippocms-dev: Hippo CMS development public mailinglist Searchable archives can be found at: MarkMail: http://hippocms-dev.markmail.org Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
