The beans in my "applicationContext.xml" are never loaded. To double check I added some XML parsing errors to the "applicationContext.xml" file in the "org.eclipse.virgo.snaps.sample.cat-3.0.2.RELEASE.jar" example snap and deployed it. There were no errors and the snap installs fine. This indicates that the application context is not loading at all.
Is there a way to get the application context to load in a Snap?
Chris Frost Messages: 230 Registered: January 2010 Location: Southampton, England
Being a Snap should make no difference, to really eliminate any influence from Snaps, try deploying it on Virgo without the Snaps bundles installed. Also, what location in the WAB have you got the "applicationContext.xml" file. Unless it's the default one (under WEB-INF I think) you have to specify the location in the web.xml.
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Based on my analysis of the snaps 3.0.2 source code (doubt that 3.0.3 has changed it significantly) the web.xml of the snap is NOT processed fully, as would be done by Tomcat. Instead it is processed by Snaps code itself and it only uses the following parts of the web.xml, the rest is simply ignored:
So, servlet context listeners are not supported, and neither are mime mappings, etc..
I presume that most if not all of the excluded information make no sense within a snap. Listeners could be useful but they are listening to the state of the ServletContext and the user guide does say:
Remember that a host and all its snaps use a single ServletContext.
As the host is created before the snap that means that the ServletContext is created before any snaps have been installed and after all snaps have been removed and so during the lifetime of a span there is no change in the state of the ServletContext and so the listener is not invoked.
It would be useful if this sort of information was made much clearer in the snaps user guide.