Question

I recently set a SpringSource CloudFoundry micro cloud instance and am trying to run through their fairly brief messaging example using RabbitMQ found here (with code):

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

A public working instance of the app is provided here:

http://rabbit-simple.cloudfoundry.com

When I attempt this, the environment sets up properly, the code builds, deploys (using the vmc command line tools) and binds to a rabbitmq service without issue. Here is the console output from running ‘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 |
+---------------+----+---------+---------------------------------------+----------------+

When I try to run the app from a browser, it initially displays the input form properly, but when I enter a message and hit ‘Publish’ I get this 500 error returned:

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)

Has anyone worked this successfully and know what I might be doing wrong (RabbitMQ issue, CloudFoundry issue, my own issue :0 )?

The only thing I did that wasn’t identical to SpringSource's tutorial code was to change the return string in the HomeController from : return "WEB-INF/views/home.jsp"; to “home” to be consistent with the way the viewResolver was set up in the spring-context.xml file (this was necessary to even get the input form to display properly).

Thanks.

Was it helpful?

Solution

I built this again from scratch without using STS editor and it functions properly. I can't really explain why building it from a Maven project inside the STS IDE led to the problem I experienced, but a clean build of everything using just a text editor and vmc command line instructions worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top