0

我的 activemq 代理使用了以下模式:-

<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:来自 URL [file:/prod/tools/base/etc/config/activemq/amq_prod_broker_config.xml] 的 X ML 文档中的第 23 行无效;嵌套异常是 org.xml.sax.SAXParseException;行号:23;列号: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;行号:23;列号:52;cvc-elt.1:找不到元素“beans”的声明。在组织。

initd 只不过是在重新启动 linux 服务器时自动运行我的脚本的配置。请帮忙?

4

2 回答 2

0

我在这方面有点晚了。我遇到了类似的问题。这可以通过包含正确的依赖关系来解决

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

或者可以从这里下载 对于要注册 XBeanNamespaceHandler 的 xsd,这些配置已经完成(spring.handlers 和 spring.schemas 存在于 jar 的 META-INF 文件夹中

于 2015-02-08T15:32:54.560 回答
0

你的模式位置很奇怪:你为什么用一些 file:// 指定 xsd ?

保留原始 xsd(来自 spring、apcache、...)。只需将 file:// 替换为 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">
于 2012-08-14T12:44:54.827 回答