i want integrate spring-security myapp (i use spring mvc)
i can't understand these problems:
cvc-complex-type.2.3: element 'beans:beans' cannot have character [children], because type's content type element-only. cvc-complex-type.2.3: element 'http' cannot have character [children], because type's content type element-only. cvc-complex-type.2.3: element 'session-management' cannot have character [children], because type's content type element-only. cvc-complex-type.2.4.c: matching wildcard strict, no declaration can found element 'autentication-manager'. below xml configuration.
<?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <!-- global security settings --> <global-method-security pre-post-annotations="enabled" /> <http auto-config="true"> <session-management invalid-session-url="/login?time=1"> <concurrency-control max-sessions="1" expired-url="/login?time=1" /> </session-management> <form-login login-page="/login" login-processing-url="/login.do" default-target-url="/home" always-use-default-target="true" authentication-failure-url="/login?err=1" username-parameter="username" password-parameter="password" /> <logout logout-url="/logout" logout-success-url="/login?out=1" delete-cookies="jsessionid" invalidate-session="true" /> <intercept-url requires-channel="https" pattern="/login*" access="permitall" /> <intercept-url requires-channel="https" pattern="/home/**" access="hasrole('10000_10000')" /> </http> <!-- authentication providers form login --> <autentication-manager alias="authenticationmanager"> <authentication-provider user-service-ref="loginservice"> <password-encoder ref="passwordencoder" /> </authentication-provider> </autentication-manager> <!-- use md5 encoder since user's passwords stored md5 in database --> <beans:bean class="org.springframework.security.authentication.encoding.md5passwordencoder" id="passwordencoder" /> <!-- custom service spring retrieve users , corresponding access levels --> <beans:bean id="loginservice" class="com.pfe.service.imp.loginserviceimp" /> <!-- add datasources here --> </beans:beans> below exception stack trace.
grave: exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: line 24 in xml document servletcontext resource [/web-inf/security-config.xml] invalid; nested exception org.xml.sax.saxparseexception; linenumber: 24; columnnumber: 29; cvc-complex-type.2.3 : l'élément 'session-management' ne doit comporter aucun enfant ([children]) de type caractère, car le type porte le type de contenu "element-only". @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:396) @ 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:131) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:522) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:436) @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:384) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:283) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:111) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:5016) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5528) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source) caused by: org.xml.sax.saxparseexception; linenumber: 24; columnnumber: 29; cvc-complex-type.2.3 : l'élément 'session-management' ne doit comporter aucun enfant ([children]) de type caractère, car le type porte le type de contenu "element-only". @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(unknown source) @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.error(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator$xsierrorreporter.reporterror(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.reportschemaerror(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.elementlocallyvalidcomplextype(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.elementlocallyvalidtype(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.processelementcontent(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.handleendelement(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.endelement(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scanendelement(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.next(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scandocument(unknown source) @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(unknown source) @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(unknown source) @ com.sun.org.apache.xerces.internal.parsers.xmlparser.parse(unknown source) @ com.sun.org.apache.xerces.internal.parsers.domparser.parse(unknown source) @ com.sun.org.apache.xerces.internal.jaxp.documentbuilderimpl.parse(unknown source) @ org.springframework.beans.factory.xml.defaultdocumentloader.loaddocument(defaultdocumentloader.java:75) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:388) ... 22 more juil. 21, 2015 8:35:43 org.apache.catalina.core.standardcontext startinternal grave: 1 or more listeners failed start. full details found in appropriate container log file juil. 21, 2015 8:35:43 org.apache.catalina.core.standardcontext startinternal grave: erreur de démarrage du contexte [/tryged] suite aux erreurs précédentes juil. 21, 2015 8:35:43 org.apache.catalina.core.applicationcontext log infos: closing spring root webapplicationcontext juil. 21, 2015 8:35:43 org.apache.catalina.core.standardcontext listenerstop grave: exception lors de l'envoi de l'évènement contexte détruit (context destroyed) à l'instance de classe d'écoute org.springframework.web.context.contextloaderlistener java.lang.illegalstateexception: beanfactory not initialized or closed - call 'refresh' before accessing beans via applicationcontext @ org.springframework.context.support.abstractrefreshableapplicationcontext.getbeanfactory(abstractrefreshableapplicationcontext.java:172) @ org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:1066) @ org.springframework.context.support.abstractapplicationcontext.doclose(abstractapplicationcontext.java:1040) @ org.springframework.context.support.abstractapplicationcontext.close(abstractapplicationcontext.java:988) @ org.springframework.web.context.contextloader.closewebapplicationcontext(contextloader.java:541) @ org.springframework.web.context.contextloaderlistener.contextdestroyed(contextloaderlistener.java:142) @ org.apache.catalina.core.standardcontext.listenerstop(standardcontext.java:5063) @ org.apache.catalina.core.standardcontext.stopinternal(standardcontext.java:5723) @ org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:160) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source)
these type of errors pops ever there improper parsing of xml files. eclipse tries validate these files , gives cvc-complex-type.2.3 errors.
if have copied these configurations somewhere there possibilities of having invisible strange characters in between spaces, line breaks & @ various places.
try remove spaces & new line/carriage return characters file , save file.
if working on linux environment, below command detect these invisible characters in xml configurations causing problems.
cat -v /path/to/file-name.xml you can use advance text editors, bbedit, notepad++, etc, detect these characters.
Comments
Post a Comment