java - org.springframework.beans.factory.parsing.BeanDefinitionParsingException -


i use sts - web app works. import eclipse , see following stacktrace:

org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: failed import bean definitions relative location [security_config.xml] offending resource: servletcontext resource [/web-inf/spring/root-context.xml]; nested exception org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: unable locate spring namespacehandler xml schema namespace [http://www.springframework.org/schema/security] offending resource: servletcontext resource [/web-inf/spring/security_config.xml]      @ org.springframework.beans.factory.parsing.failfastproblemreporter.error(failfastproblemreporter.java:68)     @ org.springframework.beans.factory.parsing.readercontext.error(readercontext.java:85)     @ org.springframework.beans.factory.parsing.readercontext.error(readercontext.java:76)     @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.importbeandefinitionresource(defaultbeandefinitiondocumentreader.java:272)     @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsedefaultelement(defaultbeandefinitiondocumentreader.java:197)     @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:182)     @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.doregisterbeandefinitions(defaultbeandefinitiondocumentreader.java:139)     @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:108)     @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:493)     @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:390)     @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334)     @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302)     @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174)     @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209)     @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:180)     @ org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125)     @ org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94)     @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:130)     @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:537)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:451)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:389)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:294)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:112)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4887)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5381)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask$sync.innerrun(unknown source)     @ java.util.concurrent.futuretask.run(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.runtask(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ java.lang.thread.run(unknown source) caused by: org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: unable locate spring namespacehandler xml schema namespace [http://www.springframework.org/schema/security] offending resource: servletcontext resource [/web-inf/spring/security_config.xml] 

i import same resources in sts

i novice in spring.

can explain me how fix ?

my pom.xml show version of spring framework, use.

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>com.epam.hhs</groupid>     <artifactid>ui</artifactid>     <name>hhsystem ui</name>     <packaging>war</packaging>     <version>1.0.0-snapshot</version>     <properties>         <java-version>1.6</java-version>         <org.springframework-version>3.2.3.release</org.springframework-version>         <org.springsecurity-version>3.1.3.release</org.springsecurity-version>         <org.aspectj-version>1.6.10</org.aspectj-version>         <org.slf4j-version>1.6.6</org.slf4j-version>     </properties>     <dependencies>         <!-- spring -->         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-context</artifactid>             <version>${org.springframework-version}</version>             <exclusions>                 <!-- exclude commons logging in favor of slf4j -->                 <exclusion>                     <groupid>commons-logging</groupid>                     <artifactid>commons-logging</artifactid>                 </exclusion>             </exclusions>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-webmvc</artifactid>             <version>${org.springframework-version}</version>         </dependency>          <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-beans</artifactid>             <version>${org.springframework-version}</version>         </dependency>          <!-- spring security -->         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-web</artifactid>             <version>${org.springsecurity-version}</version>         </dependency>         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-config</artifactid>             <version>${org.springsecurity-version}</version>         </dependency>         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-core</artifactid>             <version>${org.springsecurity-version}</version>         </dependency>         <dependency>             <groupid>org.springframework.security</groupid>             <artifactid>spring-security-taglibs</artifactid>             <version>${org.springsecurity-version}</version>             <exclusions>                 <exclusion>                     <artifactid>spring-aop</artifactid>                     <groupid>org.springframework</groupid>                 </exclusion>             </exclusions>         </dependency>          <!-- core -->         <dependency>             <groupid>com.epam.hhs</groupid>             <artifactid>core</artifactid>             <version>1.0.8-snapshot</version>         </dependency>          <!-- aspectj -->         <dependency>             <groupid>org.aspectj</groupid>             <artifactid>aspectjrt</artifactid>             <version>${org.aspectj-version}</version>         </dependency>          <!-- logging -->         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-api</artifactid>             <version>${org.slf4j-version}</version>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>jcl-over-slf4j</artifactid>             <version>${org.slf4j-version}</version>             <scope>runtime</scope>         </dependency>         <dependency>             <groupid>org.slf4j</groupid>             <artifactid>slf4j-log4j12</artifactid>             <version>${org.slf4j-version}</version>             <scope>runtime</scope>         </dependency>         <dependency>             <groupid>log4j</groupid>             <artifactid>log4j</artifactid>             <version>1.2.15</version>             <exclusions>                 <exclusion>                     <groupid>javax.mail</groupid>                     <artifactid>mail</artifactid>                 </exclusion>                 <exclusion>                     <groupid>javax.jms</groupid>                     <artifactid>jms</artifactid>                 </exclusion>                 <exclusion>                     <groupid>com.sun.jdmk</groupid>                     <artifactid>jmxtools</artifactid>                 </exclusion>                 <exclusion>                     <groupid>com.sun.jmx</groupid>                     <artifactid>jmxri</artifactid>                 </exclusion>             </exclusions>             <scope>runtime</scope>         </dependency>          <!-- @inject -->         <dependency>             <groupid>javax.inject</groupid>             <artifactid>javax.inject</artifactid>             <version>1</version>         </dependency>          <!-- servlet -->         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>servlet-api</artifactid>             <version>2.5</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet.jsp</groupid>             <artifactid>jsp-api</artifactid>             <version>2.1</version>             <scope>provided</scope>         </dependency>         <dependency>             <groupid>javax.servlet</groupid>             <artifactid>jstl</artifactid>             <version>1.2</version>         </dependency>          <!-- test -->         <dependency>             <groupid>junit</groupid>             <artifactid>junit</artifactid>             <version>4.7</version>             <scope>test</scope>         </dependency>     </dependencies>      <build>         <plugins>             <plugin>                 <artifactid>maven-eclipse-plugin</artifactid>                 <version>2.9</version>                 <configuration>                     <additionalprojectnatures>                         <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>                     </additionalprojectnatures>                     <additionalbuildcommands>                         <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>                     </additionalbuildcommands>                     <downloadsources>true</downloadsources>                     <downloadjavadocs>true</downloadjavadocs>                 </configuration>             </plugin>             <plugin>                 <groupid>org.apache.maven.plugins</groupid>                 <artifactid>maven-compiler-plugin</artifactid>                 <version>2.5.1</version>                 <configuration>                     <source>1.6</source>                     <target>1.6</target>                     <compilerargument>-xlint:all</compilerargument>                     <showwarnings>true</showwarnings>                     <showdeprecation>true</showdeprecation>                 </configuration>             </plugin>             <plugin>                 <groupid>org.codehaus.mojo</groupid>                 <artifactid>exec-maven-plugin</artifactid>                 <version>1.2.1</version>                 <configuration>                     <mainclass>org.test.int1.main</mainclass>                 </configuration>             </plugin>         </plugins>     </build> </project> 

security_config.xml

<beans:beans xmlns="http://www.springframework.org/schema/security"     xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-3.1.xsd     http://www.springframework.org/schema/security      http://www.springframework.org/schema/security/spring-security-3.1.xsd">      <http use-expressions="true">         <intercept-url pattern="/*" access="permitall" />         <form-login login-page="/home.jsp"             authentication-failure-url="/loginfailed" default-target-url="/index" />         <logout logout-success-url="/logout" />     </http>     <authentication-manager>         <authentication-provider ref="provider" />     </authentication-manager> </beans:beans> 

root-context.xml

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:aop="http://www.springframework.org/schema/aop"     xmlns:context="http://www.springframework.org/schema/context"     xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"     xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"     xmlns:util="http://www.springframework.org/schema/util"     xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd         http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">     <!-- root context: defines shared resources visible other web components -->     <!-- Настраивает управление транзакциями с помощью аннотации @transactional -->      <import resource="classpath:*spring/beanconfig.xml" />     <!-- Файл с настройками security -->     <import resource="security_config.xml" />  </beans> 

please replace following root-context.xml, security_config.xml files. change according version. caused namespace problem

    <?xml version="1.0" encoding="utf-8"?>     <beans xmlns="http://www.springframework.org/schema/beans"           xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"           xmlns:aop="http://www.springframework.org/schema/aop"           xmlns:context="http://www.springframework.org/schema/context"           xsi:schemalocation="http://www.springframework.org/schema/beans                      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd                     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd                     http://www.springframework.org/schema/context                     http://www.springframework.org/schema/context/spring-context.xsd"      default-lazy-init="false" >         //your beans         <bean id="x" class="com.sample.x"/>         <bean id="y" class="com.sample.y"/>    </beans> 

update

can replace following content in root-context.xml. added security

    <?xml version="1.0" encoding="utf-8"?>     <beans xmlns="http://www.springframework.org/schema/beans"          xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:aop="http://www.springframework.org/schema/aop"          xmlns:context="http://www.springframework.org/schema/context"          xmlns="http://www.springframework.org/schema/security"          xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"          xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"          xmlns:util="http://www.springframework.org/schema/util"          xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd     http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd     http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd     http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -