|WAB context not finding local classes [message #739911]
||Mon, 17 October 2011 21:05
| Mark Elliot
Registered: June 2011
I'm running Virgo Jetty 3.0.1; my setup looks like this:|
baz-context.xml contains (... is the xmlns stuff):
<bean id="baz" class="com.foo.bar.Baz" />
When I start this bundle I get an error:
Caused by: java.lang.ClassNotFoundException: com.foo.bar.Baz
My web.xml contains:
Clearly Baz is a class. Strangely, if I move my spring config to the WEB-INF directory and set it up to be loaded by the servlet loader (using the web.xml stuff), the class is found and things come up just fine -- which leads me to believe the MANIFEST is correct and the actual class is getting included.
Why can't I initialize this class in the spring/ folder?
Supposing I can eventually initialize that bean with a config in the spring/ folder, can beans in servlet specific contexts reference items defined in those configs?
|Re: WAB context not finding local classes [message #740324 is a reply to message #739911]
||Tue, 18 October 2011 07:45
| Chris Frost
Registered: January 2010
Location: Southampton, England
You can either put all your spring context information in the applicationContext.xml file under WEB-INF and no config will be required in the web.xml or keep it in META-INF/spring and specify that as the location with 'contextConfigLocation' context-param.
Yes, servlet specific contexts will have full access to beans in your spring/osgi context, it will be one of its parent contexts due to the config you have put in web.xml as shown in your post.
As a side note, all the Manifest should need is the bundle classpath being set to include WEB-INF/classes where Baz.class should be compiled to.
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
[Updated on: Tue, 18 October 2011 07:46]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02599 seconds