Announcement Announcement Module
Collapse
No announcement yet.
Spring Security 3.0.2 - spring-security-web classes are not available Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Security 3.0.2 - spring-security-web classes are not available

    We are trying to setup spring-security 3.0.2.RELEASE in our OSGi application and are experiencing an exception which seems little confusing.

    Here is the exception:
    Code:
    Thread-3                     <AG0000E> Application context creation failure for bundle 'abc-webapp' version '1.0.0'. org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: spring-security-web classes are not available. You need these to use <filter-chain-map>
    Offending resource: URL [bundleentry://67.fwk14679795/META-INF/spring/security-config.xml]
    	at org.springframework.beans.factory.parsing.FailFastProblemReporter.fatal(FailFastProblemReporter.java:59)
    	at org.springframework.beans.factory.parsing.ReaderContext.fatal(ReaderContext.java:68)
    	at org.springframework.beans.factory.parsing.ReaderContext.fatal(ReaderContext.java:55)
    	at org.springframework.security.config.SecurityNamespaceHandler.reportMissingWebClasses(SecurityNamespaceHandler.java:90)
    	at org.springframework.security.config.SecurityNamespaceHandler.parse(SecurityNamespaceHandler.java:50)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:136)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    	at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:164)
    	at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:136)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
    	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)
    	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)
    	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)
    	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
    	at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)
    	at com.springsource.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:106)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:619)
    Here is the manifest file:
    Code:
    Manifest-Version: 1.0
    Import-Bundle: org.springframework.osgi.core;version="[1.2.1,1.2.1]",c
     om.springsource.server.web.dm
    Bundle-Vendor: Abc Company
    Module-Type: Web
    Bundle-Version: 1.0.0
    Tool: Bundlor 1.0.0.RELEASE
    Bundle-Name: Abc_webapp
    Bundle-ManifestVersion: 2
    Bundle-SymbolicName: abc-webapp
    Web-ContextPath: abc-webapp
    Import-Package: com.springsource.server.web.dm,javax.servlet.http,org.
     apache.log4j,org.springframework.stereotype,org.springframework.ui,or
     g.springframework.web.bind.annotation,org.springframework.web.filter,
     org.springframework.web.servlet,org.springframework.web.servlet.view
    And here is the pom section:
    Code:
    <properties>
    		<org.springframework.version>3.0.2.RELEASE</org.springframework.version>
    		<spring-security.version>3.0.2.RELEASE</spring-security.version>
    		<org.slf4j.version>1.6.0</org.slf4j.version>
    	</properties>
    
    <!--  Spring -->
        <dependency>
    	    <groupId>org.springframework</groupId>
    	    <artifactId>org.springframework.spring-library</artifactId>
    	    <type>libd</type>
    	    <version>${org.springframework.version}</version>
    	</dependency>
    	
    	<dependency>
    	    <groupId>org.springframework.osgi</groupId>
    	    <artifactId>org.springframework.osgi-library</artifactId>
    	    <type>libd</type>
    	    <version>1.1.2.B</version>
    	</dependency>
    
    	<!-- Spring security -->
    	<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-core</artifactId>
    			<version>${spring-security.version}</version>
    			<scope>compile</scope>
    	</dependency>
    	<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>org.springframework.security.taglibs</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-acl</artifactId>
                <version>${spring-security.version}</version>
        </dependency>
    	<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
    With the spring-security-web dependency included (and active on the Spring dm Server's bundle list), why doesn't Spring dm Server like starting the app?

  • #2
    Based on the error message you included, it looks like the Spring Security classes are not available to your bundle.

    Configuration problem: spring-security-web classes are not available. You need these to use <filter-chain-map>

    I would suggest that you try adding the following "Import-Bundle" statements.

    org.springframework.security.config;version="[3.0.0.RELEASE,3.0.0.RELEASE]"
    org.springframework.security.core;version="[3.0.0.RELEASE,3.0.0.RELEASE]"
    org.springframework.security.taglibs;version="[3.0.0.RELEASE,3.0.0.RELEASE]"
    org.springframework.security.web;version="[3.0.0.RELEASE,3.0.0.RELEASE]"

    This should import the basic Spring Security classes. If you use other features like LDAP or CAS you'll need to add import bundles for those as well.

    Comment


    • #3
      That solved the problem. I had those references in the Import-Package section which didn't satisfy things. Once I added the above mentioned part to the manifest, I still kept getting the nice "failed to start. Check the logs for more details." error, but that was satisfied with the import of the Spring library by adding this to the manifest:

      Code:
      Import-Library: org.springframework.spring;version="[3.0.0.RELEASE,3.0
       .2.RELEASE]"
      Now we have the Spring dm Server wired with Spring-Security 3.0.2.

      Thanks for your help.

      Comment

      Working...
      X