Spring app contexts in a web/portlet application form a tree, contexts further down in the tree can look directly up the tree to resolve dependencies.
There is usually a listener in web.xml that defines the root application context Then each servlet/portlet has its own app context with the root as the parent This allows individual servlets and portlets to have their own view resolvers, controllers, etc without having to worry about stomping on the rest of the system. On Thu, May 21, 2015 at 9:16 AM James Wennmacher <[email protected]> wrote: > IM me and I'll see if I can help you out. > > James Wennmacher - Unicon > 480.558.2420 > > On 05/20/2015 11:48 PM, Benito J. Gonzalez wrote: > > Devs, > > Wondering if someone can help me out. > > I am writing a class in *org.jasig.portal.portlets.groupadmin* that is > similar to the existing helper class there. Both are annotated with > @Service. The existing one uses @Autowired on a setter for > IGroupListHelper. In my class, I use the annotation on the field, which > compiles and deploys just fine. > > In my class, I have three DAOs from the PAGS JPA package. They are > annotated with @Repository. For example, > @Repository("personAttributesGroupDefinitionDao”) is one. My understanding > is that this creates a bean with the specified ID. > > In my class, I have tried > > @Autowired > > private JpaPersonAttributesGroupDefinitionDao > personAttributesGroupDefinitionDao; > > And > > @Resource(name="personAttributesGroupDefinitionDao") > > private JpaPersonAttributesGroupDefinitionDao > personAttributesGroupDefinitionDao; > > Both compile but when the war file is deployed uPortal fails. If I > comment out the annotation for the DAO, uPortal works fine. (The class is > not used yet.) > Exceptions all over catalina.out on failure is: > > java.lang.IllegalStateException: Illegal access: this web application > instance has been stopped already. Could not load > [META-INF/services/javax.xml.stream.XMLInputFactory]. > > @Autowired is suppose to match on class, so I tracked down a duplicate > DAO bean in the import/export context. I removed those beans and switched > the references in that file to the IDs used in the @Repository annotation > in the three DAO classes. The import works fine with this change. > > Digging further, I noticed that some packages are excluded in the main > context scan directive. In particular, the portlets package my class is in > is excluded. The package is included in another context: > *mvcServletContext.xml*. > > I am a bit stumped at this point. Anyone have advice on what to try > next? Any overview on the contexts? > > Thank you and good night! > > Benito J. Gonzalez - Unicon > [email protected] > 480.558.2360 > > > > -- > > You are currently subscribed to [email protected] as: > [email protected] > > > To unsubscribe, change settings or access archives, see > http://www.ja-sig.org/wiki/display/JSG/uportal-dev > > > -- > > You are currently subscribed to [email protected] as: > [email protected] > To unsubscribe, change settings or access archives, see > http://www.ja-sig.org/wiki/display/JSG/uportal-dev > > -- You are currently subscribed to [email protected] as: [email protected] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/uportal-dev
