2012-08-14 30 views
0

運行時無法找到的元素「豆」的聲明,我有以下的架構所使用的我的ActiveMQ代理: -CVC-elt.1:使用INITD

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:amq="http://activemq.apache.org/schema/core" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans 
     file:////u//amqgod//schema//spring-beans.xsd 
     http://activemq.apache.org/schema/core 
     file:////u//amqgod//schema//activemq.xsd"> 

,如果我啓動運行正常我應用程序從命令行但通過initd機制啓動時失敗並出現以下錯誤: -

錯誤:java.lang.RuntimeException:無法執行啓動任務。原因:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:X中的第23行 URL [文件:/prod/tools/base/etc/config/activemq/amq_prod_broker_config.xml]中的ML文檔無效;嵌套異常是org.xml.sax.SAXParseException; l ineNumber:23; columnNumber:52; cvc-elt.1:找不到元素'beans'的聲明。 java.lang.RuntimeException:無法執行啓動任務。原因:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:來自URL [file:/prod/tools/base/etc/config/activemq/amq_prod_broker_config.xml]的XML文檔 中的第23行無效;嵌套異常是org.xml.sax.SAXParseException; lineNumb er:23; columnNumber:52; cvc-elt.1:找不到元素'beans'的聲明。 at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache。 activemq.console.command.ShellCommand.runTask(ShellCommand.java:143) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache.activemq.console.command。 ShellCommand.main(ShellCommand.java:85) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本機方法) 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:43) at java.lang.reflect.Method.invo (org.apache.activemq.console.main.main(Main.java:107) )引起的通過:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:URL中的第23行XML文檔

initd只是一個配置,當linux服務器重新啓動時自動運行我的腳本。 請幫忙嗎?

回答

0

您的模式位置很奇怪:爲什麼用某個文件指定xsd://?

保留原來的xsd(來自spring,apcache,...)。只需用下面的代碼替換文件:// http://像這樣:

<beans 
    xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
    http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd 
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> 
+0

我在這些位置保留spring和activemq xsds'的本地副本。無論如何,當我手動運行腳本時,我沒有得到這個異常。 initd專家是否可以評論腳本在調用期間是否可以訪問網絡,即initd執行的時間是機器上可用的網絡嗎? – Bhanu 2012-08-23 12:01:34

0

我在這件事上有點晚了。我面臨類似的問題。這可以通過包括正確的依賴

<dependency> 
    <groupId>org.apache.activemq</groupId> 
    <artifactId>activemq-all</artifactId> 
    <version>5.10.0</version> 
</dependency> 
解決

,或者可以從here 下載對於XSD是註冊XBeanNamespaceHandler,這些配置已經完成(spring.handlers和spring.schemas出現在METAR-INF文件夾中的罐子