我想創建一個'jdbc:出站通道適配器'。這是我的xml文件:如何爲'jdbc:outbound-channel-adapter'創建聲明?
<?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:integration="http://www.springframework.org/schema/integration"
xmlns:jdbc="http://www.springframework.org/schema/integration/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/jdbc
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- store delayed notifications -->
<integration:channel id="delayedNotificationChannel">
<integration:interceptors>
<integration:wire-tap channel="logDelayedNotificationChannel"/>
</integration:interceptors>
</integration:channel>
<integration:transformer input-channel="delayedNotificationChannel"
ref="unicodeEncoderServiceImpl"
method="encode"
output-channel="delayedNotificationOutChannel"/>
<integration:channel id="delayedNotificationOutChannel"/>
<jdbc:outbound-channel-adapter channel="delayedNotificationOutChannel" data-source="dataSource">
<jdbc:query>
insert into Notification.......................
</jdbc:query>
</jdbc:outbound-channel-adapter>
<!-- log -->
<integration:channel id="logDelayedNotificationChannel"/>
<integration:logging-channel-adapter channel="logDelayedNotificationChannel"
level="INFO"
expression="'Delaying IVR, EventTypeName:' + headers['eventTypeName'] + ', Recipient:' + headers['recipient'] + ', ContactType:' + headers['contactType'] + ', ContactCode:' + headers['contactCode']+ ', Until: ' + new java.util.Date(headers['delayUntil'])"/>
</beans>
,但它不能正常工作,輸出:
異常線程 「main」 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:26號線在XML來自類路徑資源[META-INF/spring/integration/ivr-send-delay-context.xml]的文檔無效;嵌套異常是org.xml.sax.SAXParseException; lineNumber:26; columnNumber:101; cvc-complex-type.2.4.c:匹配的通配符是嚴格的,但是對元素'jdbc:outbound-channel-adapter'沒有聲明。 在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) ...................
你可以嘗試更改爲'int-jdbc:outbound-channel-adapter'而不是'jdbc:outbound-channel-adapter'嗎?同樣的事情也適用於'jdbc:query'。只需將其更改爲'int-jdbc:query'並嘗試一次。 –
否;他的名字空間被設置爲'jdbc' - 'xmlns:jdbc =「...'不是'int-jdbc'。 –
@GaryRussell,是的..你是對的。 –