GWT通过Spring问题使用ActiveMQ
我有一个独立的Spring命令和控制应用程序,它通过SpringJMS API使用ActiveMQ广播系统状态。这工作得很好,我已经测试过了,并且有一个测试客户端程序,可以注册来收听这个主题 我还有一个基于Spring的GWT应用程序,我正在尝试将它注册到ActiveMQ主题之一,以便它可以从C&C应用程序接收状态消息。在GWT项目中,我在WEB-INF下有一个applicationContext.xml:GWT通过Spring问题使用ActiveMQ,spring,gwt,maven,jms,activemq,Spring,Gwt,Maven,Jms,Activemq,我有一个独立的Spring命令和控制应用程序,它通过SpringJMS API使用ActiveMQ广播系统状态。这工作得很好,我已经测试过了,并且有一个测试客户端程序,可以注册来收听这个主题 我还有一个基于Spring的GWT应用程序,我正在尝试将它注册到ActiveMQ主题之一,以便它可以从C&C应用程序接收状态消息。在GWT项目中,我在WEB-INF下有一个applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?>
<?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:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd">
<amq:topic id="embedded.sysModel" physicalName="org.apache.activemq.spring.embedded.sysmodel" />
</beans>
当我从Eclipse运行GWT应用程序时,我得到以下错误
15:16:20067错误[org.springframework.web.context.ContextLoader]-
上下文初始化失败
org.springframework.beans.factory.parsing.Bean定义ParsingException:
配置问题:找不到的Spring NamespaceHandler
XML模式命名空间[http://activemq.apache.org/schema/core]
有问题的资源:ServletContext资源
[/WEB-INF/applicationContext.xml]
现在,我在GWT应用程序中甚至没有任何引用ActiveMQ或SpringJMS模板的代码。我一开始是这样做的,但为了找到第一个失败点,我放弃了一切。这似乎是amq:topic一行。如果我在applicationContext.xml文件中注释这一行,我的GWT应用程序就会初始化并正常运行
这是我的用于GWT的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- POM generated by gwt-maven-plugin archetype -->
<modelVersion>4.0.0</modelVersion>
<groupId>gui-spring-gwt</groupId>
<artifactId>ourappgui</artifactId>
<packaging>war</packaging>
<version>2.0</version>
<properties>
<!-- convenience to define GWT version in one place -->
<gwt.version>2.4.0</gwt.version>
<spring.version>3.0.6.RELEASE</spring.version>
<!-- tell the compiler we can use 1.5 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<!-- GWT dependencies (from central repo) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.5.3.0_1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.5.3.0_1</version>
</dependency>
</dependencies>
<build>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0-1</version>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>pevcogui.html</runTarget>
</configuration>
</plugin>
<!-- If you want to use the target/web.xml file mergewebxml produces,
tell the war plugin to use it. Also, exclude what you want from the final
artifact here. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId>
<configuration> <webXml>target/web.xml</webXml> <warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
</configuration> </plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
4.0.0
guispringgwt
奥拉普圭
战争
2
2.4.0
3.0.6.1发布
1.6
1.6
com.google.gwt
gwt servlet
${gwt.version}
运行时
com.google.gwt
gwt用户
${gwt.version}
假如
javax.servlet
servlet api
2.5
org.springframework
弹簧芯
${spring.version}
org.springframework
弹簧网
${spring.version}
org.springframework
spring上下文支持
${spring.version}
org.springframework
春季aop
${spring.version}
org.springframework
春豆
${spring.version}
org.springframework
弹簧试验
${spring.version}
log4j
log4j
1.2.14
朱尼特
朱尼特
4.7
测试
org.apache.derby
德比
10.5.3.0_1
org.apache.derby
德比客户机
10.5.3.0_1
war/WEB-INF/classes
org.codehaus.mojo
GWTMaven插件
2.3.0-1
com.google.gwt
gwt用户
${gwt.version}
com.google.gwt
gwt开发
${gwt.version}
编译
生成同步
测试
pevcogui.html
org.apache.maven.plugins
maven编译器插件
2.0.2
${maven.compiler.source}
${maven.compiler.target}
maven战争插件
2.1-β-1
战争
问题在于http://activemq.apache.org/schema/core
找不到activemq.xsd
是activemq-core-xxx.jar的一部分,当这个jar位于您的类路径中时,就会找到它。但你不需要依赖它
因此,如果使用xmlns:amq
,请将依赖项添加到activemq-core
:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.5.0</version><!-- or whatever version you use -->
</dependency>
org.apache.activemq
activemq内核
5.5.0
问题在于http://activemq.apache.org/schema/core
找不到activemq.xsd
是activemq-core-xxx.jar的一部分,当这个jar位于您的类路径中时,就会找到它。但你不需要依赖它
因此,如果使用xmlns:amq
,请将依赖项添加到activemq-core
:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.5.0</version><!-- or whatever version you use -->
</dependency>
org.apache.activemq
activemq内核
5.5.0
这个问题似乎根源于EclipseGWT插件。我发现了这篇文章:它讨论了一个类似的问题。Spring论坛上的这篇文章讨论了Spring安全性的类似问题
我的解决方法是使用“mvn GWT:run”从命令行运行GWT应用程序。以这种方式启动可以保持类路径完好无损。我在cmd行使用maven获得了一个成功的构建,我可以部署到Glassfish。只有在从Eclipse内部启动时,我才会出现错误。似乎这个问题根源于Eclipse GWT插件。我发现了这篇文章:它讨论了一个类似的问题。Spring论坛上的这篇文章讨论了Spring安全性的类似问题
我的解决方法是使用“mvn GWT:run”从命令行运行GWT应用程序。以这种方式启动可以保持类路径完好无损。我在cmd行使用maven获得了一个成功的构建,我可以部署到Glassfish。只有从Eclipse内部启动时,我才会出现错误。事实上,这是其中的一部分。我这样做了,但仍然遇到同样的问题,并进一步挖掘。谢谢你把我带到那个方向。下面是我关于修复的其他信息。事实上,这是其中的一部分。我这样做了,但仍然遇到同样的问题,并进一步挖掘。谢谢你把我带到那个方向。下面是我的其他修复信息。