java - Can <beans> have a definition of <bean> inside when being used with profile? -


i getting error when deploying web application on weblogic server.

:org.xml.sax.saxparseexception:cvc-complex-type.2.4.a: invalid content found starting element 'beans'. 1 of '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, wc[##other:"http://www.springframework.org/schema/beans"]}' expected. 

this xml file loading beans from:

<?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:context="http://www.springframework.org/schema/context"     xmlns:aop="http://www.springframework.org/schema/aop"     xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">      <beans profile="dev">      <!-- define component scan targets -->      <context:component-scan base-package="com.sheidaei.chnlsales.web.service" />      <bean id="ewuser" class="com.sheidaei.chnlsales.web.model.ewuser" scope="session">         <aop:scoped-proxy proxy-target-class="true"/>     </bean>  </beans>  </beans> 

any ideas on why getting error? seems expecting other profile @ point. can't use profile after beans? using spring 3.2 , according spring can use profiles after spring 3.1 http://spring.io/blog/2011/02/11/spring-framework-3-1-m1-released/

this stack trace:

<jun 27, 2014 1:28:43 pm edt> <warning> <deployer> <bea-149004> <failures detected while initiating deploy task application 'toolintweb [version=1.0]'.> <jun 27, 2014 1:28:43 pm edt> <warning> <deployer> <bea-149078> <stack trace message 149004 weblogic.application.moduleexception: :org.xml.sax.saxparseexception:cvc-complex-type.2.4.a: invalid content found starting element 'beans'. 1 of '{"http://www.springframework.org/schema/beans":descr iption, "http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, wc[##other:"http://www.springframework.org/ schema/beans"]}' expected.         @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(errorhandlerwrapper.java:195)         @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.error(errorhandlerwrapper.java:131)         @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:384)         @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:318)         @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator$xsierrorreporter.reporterror(xmlschemavalidator.java:417)         truncated. see log file complete stacktrace > <jun 27, 2014 1:28:43 pm edt> <error> <console> <bea-240003> <console encountered following error weblogic.application.moduleexception: :org.xml.sax.saxparseexception:cvc-complex-type.2.4.a: invalid content  found starting element 'beans'. 1 of '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans": alias, "http://www.springframework.org/schema/beans":bean, wc[##other:"http://www.springframework.org/schema/beans"]}' expected.         @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(errorhandlerwrapper.java:195)         @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.error(errorhandlerwrapper.java:131)         @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:384)         @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:318)         @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator$xsierrorreporter.reporterror(xmlschemavalidator.java:417)         @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.reportschemaerror(xmlschemavalidator.java:3182)         @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.handlestartelement(xmlschemavalidator.java:1806)         @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.startelement(xmlschemavalidator.java:705)         @ com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.scanstartelement(xmlnsdocumentscannerimpl.java:400)         @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next(xmldocumentfragmentscannerimpl.java:2755)         @ com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(xmldocumentscannerimpl.java:648)         @ com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.next(xmlnsdocumentscannerimpl.java:140)         @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scandocument(xmldocumentfragmentscannerimpl.java:511)         @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:808)         @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:737)         @ com.sun.org.apache.xerces.internal.parsers.xmlparser.parse(xmlparser.java:119)         @ com.sun.org.apache.xerces.internal.parsers.domparser.parse(domparser.java:235)         @ com.sun.org.apache.xerces.internal.jaxp.documentbuilderimpl.parse(documentbuilderimpl.java:284)         @ weblogic.xml.jaxp.registrydocumentbuilder.parse(registrydocumentbuilder.java:163)         @ org.springframework.beans.factory.xml.defaultdocumentloader.loaddocument(defaultdocumentloader.java:75)         @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:388)         @ 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)         @ weblogic.servlet.internal.eventsmanager$firecontextlisteneraction.run(eventsmanager.java:481)         @ weblogic.security.acl.internal.authenticatedsubject.doas(authenticatedsubject.java:321)         @ weblogic.security.service.securitymanager.runas(securitymanager.java:120)         @ weblogic.servlet.internal.eventsmanager.notifycontextcreatedevent(eventsmanager.java:181)         @ weblogic.servlet.internal.webappservletcontext.preloadresources(webappservletcontext.java:1872)         @ weblogic.servlet.internal.webappservletcontext.start(webappservletcontext.java:3153)         @ weblogic.servlet.internal.webappmodule.startcontexts(webappmodule.java:1508)         @ weblogic.servlet.internal.webappmodule.start(webappmodule.java:482)         @ weblogic.application.internal.flow.modulestatedriver$3.next(modulestatedriver.java:425)         @ weblogic.application.utils.statemachinedriver.nextstate(statemachinedriver.java:52)         @ weblogic.application.internal.flow.modulestatedriver.start(modulestatedriver.java:119)         @ weblogic.application.internal.flow.scopedmoduledriver.start(scopedmoduledriver.java:200)         @ weblogic.application.internal.flow.modulelistenerinvoker.start(modulelistenerinvoker.java:247)         @ weblogic.application.internal.flow.modulestatedriver$3.next(modulestatedriver.java:425)         @ weblogic.application.utils.statemachinedriver.nextstate(statemachinedriver.java:52)         @ weblogic.application.internal.flow.modulestatedriver.start(modulestatedriver.java:119)         @ weblogic.application.internal.flow.startmodulesflow.activate(startmodulesflow.java:27)         @ weblogic.application.internal.basedeployment$2.next(basedeployment.java:636)         @ weblogic.application.utils.statemachinedriver.nextstate(statemachinedriver.java:52)         @ weblogic.application.internal.basedeployment.activate(basedeployment.java:205)         @ weblogic.application.internal.singlemoduledeployment.activate(singlemoduledeployment.java:43)         @ weblogic.application.internal.deploymentstatechecker.activate(deploymentstatechecker.java:161)         @ weblogic.deploy.internal.targetserver.appcontainerinvoker.activate(appcontainerinvoker.java:79)         @ weblogic.deploy.internal.targetserver.operations.abstractoperation.activate(abstractoperation.java:569)         @ weblogic.deploy.internal.targetserver.operations.activateoperation.activatedeployment(activateoperation.java:150)         @ weblogic.deploy.internal.targetserver.operations.activateoperation.docommit(activateoperation.java:116)         @ weblogic.deploy.internal.targetserver.operations.abstractoperation.commit(abstractoperation.java:323)         @ weblogic.deploy.internal.targetserver.deploymentmanager.handledeploymentcommit(deploymentmanager.java:844)         @ weblogic.deploy.internal.targetserver.deploymentmanager.activatedeploymentlist(deploymentmanager.java:1253)         @ weblogic.deploy.internal.targetserver.deploymentmanager.handlecommit(deploymentmanager.java:440)         @ weblogic.deploy.internal.targetserver.deploymentservicedispatcher.commit(deploymentservicedispatcher.java:163)         @ weblogic.deploy.service.internal.targetserver.deploymentreceivercallbackdeliverer.docommitcallback(deploymentreceivercallbackdeliverer.java:195)         @ weblogic.deploy.service.internal.targetserver.deploymentreceivercallbackdeliverer.access$100(deploymentreceivercallbackdeliverer.java:13)         @ weblogic.deploy.service.internal.targetserver.deploymentreceivercallbackdeliverer$2.run(deploymentreceivercallbackdeliverer.java:68)         @ weblogic.work.selftuningworkmanagerimpl$workadapterimpl.run(selftuningworkmanagerimpl.java:528)         @ weblogic.work.executethread.execute(executethread.java:209)         @ weblogic.work.executethread.run(executethread.java:178) >  

instead of "spring-beans-3.0.xsd", use "spring-beans.xsd" in "xsi:schemalocation".

as best practice, not specify version number in spring schema references. spring automatically pick highest version project dependencies.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -