Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Deploying a WAB with Spring Security 3.0.5 in bundle-classpath(The scenario described in the title throws "org.springframework.beans.FatalBeanException: Class [org.springframework.security.config.SecurityNamespaceHandler] for namespace [http://www.springfram)
Deploying a WAB with Spring Security 3.0.5 in bundle-classpath [message #756334] Sat, 12 November 2011 07:51 Go to next message
Balaji  is currently offline Balaji
Messages: 10
Registered: December 2010
Junior Member
I'm bundling my maven project as a wab, using the maven-bundle-plugin. The wab contain spring-security-config3.0.5.RELEASE in WEB-INF/lib folder.

When start the bundle on the osgi shell, I get the following exception.

org.springframework.beans.FatalBeanException: Class [org.springframework.security.config.SecurityNamespaceHandler] for namespace [www.springframework.org/schema/security] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface


I did a clhas through the shell on the SecurityNamespaceHandler class and my module seems to be the only one which has the class

I did a clload on the same class again and this time, the bundle started without any exceptions and was put to the ACTIVE state.

Questions I have,

1. Virgo uses spring 3.0. Does it have an older version of SecurityNamespaceHandler class in its path? The reason I ask this is because, digging through some code, it seems like the xmlbean factory looks for the class in a specific class loader. I'm not packaging the spring modules (packaging only the security modules) and use spring services provided by virgo. If that is the case, the class in my bundle class path may not have been loaded.

2. If Case1 is true, should i package spring with my app and stop using the provided spring framework?
Re: Deploying a WAB with Spring Security 3.0.5 in bundle-classpath [message #756464 is a reply to message #756334] Sun, 13 November 2011 17:18 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
I think I have an idea why you are getting this exception but to be sure I would need to test it quick.

Can you please post your web.xml and MANIFEST.MF for the bundle in question. Just to make sure that it is not something with configuration. Also, where do you have spring configuration files? In META-INF/spring or outside of that directory?

Regards,
Dmitry
Re: Deploying a WAB with Spring Security 3.0.5 in bundle-classpath [message #756503 is a reply to message #756464] Mon, 14 November 2011 05:46 Go to previous messageGo to next message
Balaji  is currently offline Balaji
Messages: 10
Registered: December 2010
Junior Member
Hi Dimtry,

I have attached my web.xml

I dont have a MANIFEST.MF I'm just letting the framework configure my app.

Some of my configurations like applicationContext.xml are in the METAINF/spring folder. Others like webmvc-config are not.
  • Attachment: web.xml
    (Size: 3.48KB, Downloaded 179 times)
Re: Deploying a WAB with Spring Security 3.0.5 in bundle-classpath [message #756608 is a reply to message #756503] Mon, 14 November 2011 14:05 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
With web applications you have to let web application context load your config. Move all your configuration outside of META-INF/spring and configure "contextConfigLocation" to point somewhere else like "WEB-INF/spring/*.xml". spring-dm extender will ALWAYS look into META-INF/spring to see if this is a spring power bundle and try to create AppContext. spring-dm extender does not know anything about web apps.

See here: http://static.springsource.org/osgi/docs/1.2.1/reference/html/bnd-app-ctx.html#bnd-app-ctx:app-creation
and here: http://static.springsource.org/osgi/docs/1.2.1/reference/html/app-deploy.html#app-deploy:headers

Hope this solves your problem.

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:WEB-INF/spring/applicationContext*.xml</param-value>
    </context-param>

<servlet>
        <servlet-name>tama</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/webmvc-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
Re: Deploying a WAB with Spring Security 3.0.5 in bundle-classpath [message #757115 is a reply to message #756608] Wed, 16 November 2011 14:57 Go to previous messageGo to next message
Balaji  is currently offline Balaji
Messages: 10
Registered: December 2010
Junior Member
Sorry for the late reply. Thanks for your hint. It works.

Can you guys make a direct mention to this somewhere?, because we were stuck in it for a long time. Or have I missed it?

@Dmitry, Just curious, the idea that you mentioned in your first reply had something to do with this? www.osgi.org/blog/2007/04/importance-of-exporting-and-importing.html

PS: Not being able to post links is painful
Re: Deploying a WAB with Spring Security 3.0.5 in bundle-classpath [message #757120 is a reply to message #757115] Wed, 16 November 2011 15:38 Go to previous message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
There is reference to this issue in the docs 6.4 Form Tags Shared Services WAR.

It is in a bit of a obscure place. Click on the link and look for Note in "Accessing the Service and Types from the WAR" section. It is one of the things that we will have to move to an FAQ section. I will submit and issue to do it.

As for the idea that I mentioned in the first reply - it did not have to do with import/export directly but with the way spring-dm 1.2.x implemented namespace handling. Now that I think more of it - it should not have mattered at all anyway. You are not using osgi shared services model.

Regards,
Dmitry
Previous Topic:Why not Jetty 8 in virgo-jetty-server for servlet 3.0
Next Topic:Working with Maven snapshots
Goto Forum:
  


Current Time: Tue Sep 16 03:02:57 GMT 2014

Powered by FUDForum. Page generated in 0.02654 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software