[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [virgo-dev] Virgo Snaps Question

Within a snap you have to scope your app context to a dispatcher servlet. Move your context config to the servlet init params and it should work. 

Can you also raise a bugzilla issue?  I think snaps can be made smarter in regards to the Root web application  context handling within a snap. Not sure how to implement that properly. Might need a change in spring mvc code. Root web app context key is a static final in spring mvc. 

Regards
Dmitry

Sent from my iPhone

On Nov 2, 2010, at 20:09, pphelan@xxxxxxxx wrote:

> Hi,
> I was wondering if anyone has used applicationContext.xml within a snap.
> I have been trying to pull in some OSGI services to be autowired to my
> MVC controller in a snap but it doesn't appear to be finding the OSGi
> service when it trys to create the controller.
> 
> Just curious if it is just me or if anyone else has tried this.
> 
> Thanks,
> 
> ~Patsy
> 
> I do have the following in the web.xml of the snap:
> 
>   <listener>
>                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>        </listener>
> 
>        <context-param>
>                <param-name>contextClass</param-name>
>                <param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
>        </context-param>
> 
> and I use the file applicationContext.xml in the WEB-INF folder with an
> osgi:reference in it for my service. The interface used by my service is
> org.jnode.driver.DeviceManager (in the error below).
> 
> When I look in the Virgo console, there is no sign of the snap consuming
> the requested service and I am seeing the following error in the logs:
> 
> Context initialization failed org.springframework.beans.fac
> tory.UnsatisfiedDependencyException: Error creating bean with name
> 'nodeController' defined in file
> [/Users/pphelan/development/virgo/virgo-web-server-2.1.0.RELEASE/work/osgi/confi
> guration/org.eclipse.osgi/bundles/36/data/store/org.eclipse.osgi/bundles/100/1/bundlefile/WEB-INF/classes/org/pouzinsociety/web/console/devices/NodeController.class]:
> Unsatisfied d
> ependency expressed through constructor argument with index 0 of type
> [org.jnode.driver.DeviceManager]: : No matching bean of type
> [org.jnode.driver.DeviceManager] found for depend
> ency: expected at least 1 bean which qualifies as autowire candidate for
> this dependency. Dependency annotations: {}; nested exception is
> org.springframework.beans.factory.NoSuchBe
> anDefinitionException: No matching bean of type
> [org.jnode.driver.DeviceManager] found for dependency: expected at least 1
> bean which qualifies as autowire candidate for this depen
> dency. Dependency annotations: {}
> 
> 
> _______________________________________________
> virgo-dev mailing list
> virgo-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/virgo-dev