在CloudFoundry中运行RabbitMQ的NoSuchMethodError

时间:2011-11-27 00:58:28

标签: rabbitmq cloudfoundry

我最近设置了一个SpringSource CloudFoundry微云实例,并尝试使用此处的RabbitMQ(带代码)运行他们相当简短的消息传递示例:

http://support.cloudfoundry.com/entries/20322602-getting-started-with-the-rabbitmq-service-from-a-spring-application

此处提供了该应用的公共工作实例:

http://rabbit-simple.cloudfoundry.com

当我尝试这个时,环境设置正确,代码构建,部署(使用vmc命令行工具)并绑定到rabbitmq服务而没有问题。以下是运行'vmc apps'的控制台输出:

Macintosh-2:target wlaprise$ vmc push rabbit-simple
Would you like to deploy from the current directory? [Yn]: y
Application Deployed URL ["rabbit-simple.c3works.cloudfoundry.me"]: 
Detected a Java SpringSource Spring Application, is this correct? [Yn]: y
Memory Reservation ("64M", "128M", "256M", "512M", "1G") ["512M"]: 
Creating Application: OK
Would you like to bind any services to 'rabbit-simple'? [yN]: y
The following system services are available
1: mongodb
2: mysql
3: postgresql
4: rabbitmq
5: redis
Please select one you wish to provision: 4
Specify the name of the service ["rabbitmq-fad62"]: 
Creating Service: OK
Binding Service [rabbitmq-fad62]: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (2K): OK   
Push Status: OK
Staging Application: OK                                                         
Starting Application: OK                                                        

Macintosh-2:target wlaprise$ vmc apps

+---------------+----+---------+---------------------------------------+----------------+
| Application   | #  | Health  | URLS                                  | Services       |
+---------------+----+---------+---------------------------------------+----------------+
| rabbit-simple | 1  | RUNNING | rabbit-simple.c3works.cloudfoundry.me | rabbitmq-fad62 |
+---------------+----+---------+---------------------------------------+----------------+

当我尝试从浏览器运行应用程序时,它最初会正确显示输入表单,但是当我输入消息并点击“发布”时,我会收到此500错误:

Exception--------
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.amqp.core.MessageProperties.getReplyTo()Lorg/springframework/amqp/core/Address;
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:839)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause
java.lang.NoSuchMethodError: org.springframework.amqp.core.MessageProperties.getReplyTo()Lorg/springframework/amqp/core/Address;
    org.springframework.amqp.rabbit.support.DefaultMessagePropertiesConverter.fromMessageProperties(DefaultMessagePropertiesConverter.java:120)
    org.springframework.amqp.rabbit.core.RabbitTemplate.doSend(RabbitTemplate.java:365)
    org.springframework.amqp.rabbit.core.RabbitTemplate$1.doInRabbit(RabbitTemplate.java:164)
    org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:330)
    org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:162)
    org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:179)
    org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:175)
    com.c3works.msg.HomeController.publish(HomeController.java:25)

有没有人成功地解决了这个问题并且知道我可能做错了什么(RabbitMQ问题,CloudFoundry问题,我自己的问题:0)?

我做的唯一与SpringSource的教程代码不同的是改变HomeController中的返回字符串: 返回“WEB-INF / views / home.jsp”; 至 “home”与在spring-context.xml文件中设置viewResolver的方式一致(这甚至可以使输入表单正确显示)。

感谢。

1 个答案:

答案 0 :(得分:0)

我在没有使用STS编辑器的情况下从头开始重新构建它并且它正常运行。我无法解释为什么从STS IDE内部的Maven项目构建它会导致我遇到的问题,但只使用文本编辑器和vmc命令行指令就可以实现所有内容的干净构建。