Skip to main content

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

Hi All,
 Ignore the bit below. I went and spent some time reading the
documentation for MVCs a refresher course of sorts and I have tidied
these little things away via configuration file changes. Just minor
moving of jsp files around to match the returned view and tweaks to the
InternalResourceViewResolver. All is well. It was a long time since I had
been coding with MVCs.

Thanks,

~Patsy

>  I can tidy up some of the code a bit and provide a working sample which
> could be added to the snaps codebase - this would be a host and a snap
> (or two) with two other bundles (exporting services to those
> snaps). Maybe you or others could check this as I found some slight
> weirdnesses in the paths used to map in the controllers but this may be
> lack of knowledge on my part in relation to the web.xml and/or
> snap-servlet.xml.
>
> e.g. :   (attached the config files)
>
> SNAP : takes over /devices   , the HOST is /console
>
> So the full path to my MVC controller method  is /console/devices/index
>
>    In the MVC:
>
> @RequestMapping("/devices/index")
>
> and I have to return the following ModelAndView to get it to work (leave
> out the devices bit) :
>
> 	return new ModelAndView("index")        // I have a corresponding
> index.jsp,
>              // if I leave it I get resource not found on the jsp file.
>
> The snap-servlet.xml is as follows:
>
>   <osgi:reference ....>
>
>  < context:component-scan base-package="....."/>
>
>  <bean
> class="org.springframework.web.servlet.view.InternalResourceViewResolver"
> p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
>
>
> The web.xml
> ~Patsy
>
>
>
>
> On 6 Nov 2010, at 15:24, Dmitry Sklyut wrote:
>
>> 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
>> _______________________________________________
>> virgo-dev mailing list
>> virgo-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/virgo-dev
>
> Patsy Phelan
> pphelan@xxxxxxxx
>
> ----------------------------------------------------------------------------------
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive  this
> e-mail in error, please notify the sender immediately and destroy it.  As
> its integrity cannot be secured on the Internet, the Waterford Institute
> of Technology  group liability cannot be triggered for the message
> content. Although  the sender endeavours to maintain a computer virus-free
> network,  the sender does not warrant that this transmission is virus-free
> and  will not be liable for any damages resulting from any virus
> transmitted.
> -----------------------------------------------------------------------------------
>
>
> _______________________________________________
> virgo-dev mailing list
> virgo-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/virgo-dev
>




Back to the top