Announcement Announcement Module
Collapse
No announcement yet.
Configuration problem: 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

  • Configuration problem: spring-security-web classes are not available

    Hello all,

    I'm trying to follow the simple example on spring security + flex:
    http://static.springsource.org/sprin...html/ch04.html

    The problem is that no matter what I try, I get this error when trying to compile / deploy using maven :
    Code:
    Configuration problem: spring-security-web classes are not available. You need these to use <filter-chain-map>
    I have of course the needed spring libraries (maven managed and included in build path) :

    Code:
    ...
    spring-beans-3.0.5.RELEASE.jar
    spring-core-3.0.5.RELEASE.jar
    spring-context-3.0.5.RELEASE.jar
    spring-flex-core-1.5.0.M1.jar
    ...
    spring-security-core-3.0.5.RELEASE.jar
    spring-security-config-3.0.5.RELEASE.jar
    spring-security-web-3.0.5.RELEASE.jar
    ...
    Everything else works as expected.

    full stack trace :

    Code:
    Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1484a05] to prepare test instance [com.xxx.service.ServiceTest@f39b3a]>
    java.lang.IllegalStateException: Failed to load ApplicationContext
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
    	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
    	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
    	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
    	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:146)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
    	at $Proxy0.invoke(Unknown Source)
    	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:145)
    	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:87)
    	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [securityContext.xml]
    Offending resource: URL [file:src/main/resources/META-INF/spring/applicationContext.xml]; nested exception is 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 [file:src/main/resources/META-INF/spring/securityContext.xml]
    	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:218)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
    	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.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    	... 30 more
    Caused by: 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 [file:src/main/resources/META-INF/spring/securityContext.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:123)
    	at org.springframework.security.config.SecurityNamespaceHandler.parse(SecurityNamespaceHandler.java:80)
    	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:135)
    	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.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:202)
    	... 45 more
    Am I doing something wrong ?

    Thank you in advance

  • #2
    Looks like you're having this issue when running a unit test. How have you declared the dependencies in your POM?

    Comment


    • #3
      Originally posted by pmularien View Post
      Looks like you're having this issue when running a unit test. How have you declared the dependencies in your POM?
      Yes, the simple test is failing because of the Spring Security configuration.

      spring dependencies in the pom.xml (<spring.version>3.0.5.RELEASE</spring.version>) :

      Code:
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-core</artifactId>
      			<version>${spring.version}</version>
      			<scope>runtime</scope>
      			<exclusions>
      			   <exclusion>
      			      <groupId>org.slf4j</groupId>
      			      <artifactId>slf4j-api</artifactId>
      			   </exclusion>
      			</exclusions>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-core</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-context</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-context-support</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-aop</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-aspects</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-orm</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-web</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-webmvc</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework.security</groupId>
      			<artifactId>spring-security-core</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework.security</groupId>
      			<artifactId>spring-security-config</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework.security</groupId>
      			<artifactId>spring-security-web</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-test</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-flex-core</artifactId>
      			<version>${spring-flex.version}</version>
      		</dependency>

      Comment


      • #4
        Alright, I needed to add (scope provided or else server will complain) :

        Code:
        <dependency>
            <groupId>javax.j2ee</groupId>
            <artifactId>j2ee</artifactId>
            <version>1.4</version>
            <scope>provided</scope>
        </dependency>

        Comment


        • #5
          Similar problem

          I'm facing the same error trying to follow the sample code in Spring Security 3 (nice book) chapter 2 where we're to import a dependencies folder and then import a simple security project. No doubt, I'm not linking the dependencies folder correctly, so I'm getting this error in the security project that just says my dependent classes (spring-security-web classes, in particular) are not available (see attached screenshots that I hope pulled in). Any help on how to properly link the Dependencies folder correctly...I tried numerous things from the project's Properties -> Java Build Path, but no good.

          Incidentally, being horribly new, how do I paste code in these reply blocks so they format in the 'code' blocks nicely? Thanks for your help (and patience)

          Comment


          • #6
            @William,

            I'll follow up with a private message, since your question is book-related and not Spring Sec in general.

            @astronaute,

            Glad you solved the issue!

            Comment

            Working...
            X