user1624552 February 2016

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 -->

<!-- A Spring Integration channel -->
<int:channel id="helloWorldChannel" />

<!-- A Spring Integration adapter that routes messages sent to the helloWorldChannel to the bean named "helloServiceImpl"'s hello() method -->
<int:service-activator input-channel="helloWorldChannel" ref="helloServiceImpl" method="hello" />

When editing this file in eclipse, it marks 'channel' as error. Editor says below message:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'channel'. One 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}' is expected.

Anyway I can build the application and execute but in run time below exception is generated:

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 47 in XML document from class path resource [contexto.xml] is invalid;        

Answers


Jorge Campos February 2016

You have to use the defined namespace for the resource you are using, on your case:

<int:channel id="helloWorldChannel" />

Post Status

Asked in February 2016
Viewed 3,148 times
Voted 10
Answered 1 times

Search




Leave an answer