java - Spring cvc-complex-type.2.4.a: Invalid content was found starting with element 'channel' -
i have below contexto.xml file:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd" default-init-method="iniciar" default-destroy-method="destruir"> <import resource="otherfile.xml"/> <import resource="otherfile2.xml"/> <!-- other stuff --> <!-- spring integration channel --> <int:channel id="helloworldchannel" /> <!-- spring integration adapter routes messages sent helloworldchannel bean named "helloserviceimpl"'s hello() method --> <int:service-activator input-channel="helloworldchannel" ref="helloserviceimpl" method="hello" /> when editing file in eclipse, marks 'channel' error. editor says below message:
cvc-complex-type.2.4.a: invalid content found starting element 'channel'. 1 of '{"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"], "http://www.springframework.org/schema/beans":beans}' expected. anyway can build application , execute in run time below exception generated:
exception in thread "main" org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: line 47 in xml document class path resource [contexto.xml] invalid; nested exception org.xml.sax.saxparseexception; linenumber: 47; columnnumber: 39; cvc-complex-type.2.4.a: se ha encontrado contenido no vĂ¡lido partir del elemento 'channel'. se esperaba uno de '{"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"], "http://www.springframework.org/schema/beans":beans}'. @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:399) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:336) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:304) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:181) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:217) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:188) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:252) @ org.springframework.context.support.abstractxmlapplicationcontext.loadbeandefinitions(abstractxmlapplicationcontext.java:127) @ org.springframework.context.support.abstractxmlapplicationcontext.loadbeandefinitions(abstractxmlapplicationcontext.java:93) @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:129) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:609) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:510) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:83) @ com.distributed.analyzer.main.main(main.java:33) caused by: org.xml.sax.saxparseexception; linenumber: 47; columnnumber: 39; cvc-complex-type.2.4.a: se ha encontrado contenido no vĂ¡lido partir del elemento 'channel'. se esperaba uno de '{"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"], "http://www.springframework.org/schema/beans":beans}'. @ 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.handlestartelement(unknown source) @ com.sun.org.apache.xerces.internal.impl.xs.xmlschemavalidator.emptyelement(unknown source) @ com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.scanstartelement(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:76) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloaddocument(xmlbeandefinitionreader.java:429) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:391) ... 14 more if replace below start line in contexto.xml file:
<beans xmlns="http://www.springframework.org/schema/beans" by
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" then 'channel' recognized , editor no longer marks error import line marked error now:
cvc-complex-type.2.4.a: invalid content found starting element 'import'. 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"], "http:// www.springframework.org/schema/beans":beans}' expected. updated
i have added int namespace before chanel continues saying there error. anyway can build , execute app below exception thrown:
exception in thread "main" org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: unable locate spring namespacehandler xml schema namespace [http://www.springframework.org/schema/integration] offending resource: class path resource [contexto.xml] @ org.springframework.beans.factory.parsing.failfastproblemreporter.error(failfastproblemreporter.java:70) @ org.springframework.beans.factory.parsing.readercontext.error(readercontext.java:85) @ org.springframework.beans.factory.parsing.readercontext.error(readercontext.java:80) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.error(beandefinitionparserdelegate.java:301) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1408) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1401) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:168) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.doregisterbeandefinitions(defaultbeandefinitiondocumentreader.java:138) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:94) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:508) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:392) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:336) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:304) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:181) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:217) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:188) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:252) @ org.springframework.context.support.abstractxmlapplicationcontext.loadbeandefinitions(abstractxmlapplicationcontext.java:127) @ org.springframework.context.support.abstractxmlapplicationcontext.loadbeandefinitions(abstractxmlapplicationcontext.java:93) @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:129) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:609) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:510) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:83) @ com.distributed.analyzer.main.main(main.java:33) finally have added below lines xsi:schemalocation:
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd after adding above 2 lines, no errors marked within context.xml when execute app, exception thrown:
exception in thread "main" org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: unable locate spring namespacehandler xml schema namespace [http://www.springframework.org/schema/integration] offending resource: class path resource [contexto.xml] @ org.springframework.beans.factory.parsing.failfastproblemreporter.error(failfastproblemreporter.java:70) @ org.springframework.beans.factory.parsing.readercontext.error(readercontext.java:85) @ org.springframework.beans.factory.parsing.readercontext.error(readercontext.java:80) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.error(beandefinitionparserdelegate.java:301) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1408) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1401) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:168) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.doregisterbeandefinitions(defaultbeandefinitiondocumentreader.java:138) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:94) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:508) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:392) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:336) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:304) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:181) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:217) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:188) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:252) @ org.springframework.context.support.abstractxmlapplicationcontext.loadbeandefinitions(abstractxmlapplicationcontext.java:127) @ org.springframework.context.support.abstractxmlapplicationcontext.loadbeandefinitions(abstractxmlapplicationcontext.java:93) @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:129) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:609) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:510) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:83) @ com.distributed.analyzer.main.main(main.java:33) also have tried specify version in contexto.xml:
http://www.springframework.org/schema/integration/spring-integration.xsd that is:
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd http://www.springframework.org/schema/integration/spring-integration-2.0.xsd but not working, same exception thrown in run time.
last update
some dependencies missed in maven pom.xml file. have added below dependencies:
<dependency> <groupid>org.springframework.integration</groupid> <artifactid>spring-integration-core</artifactid> <version>4.1.2.release</version> </dependency> <dependency> <groupid>org.springframework.integration</groupid> <artifactid>spring-integration-jms</artifactid> <version>4.1.2.release</version> </dependency> now works! ;)
you have use defined namespace resource using, on case:
<int:channel id="helloworldchannel" />
Comments
Post a Comment