At work I am getting this error intermittently. I have designed a simple test case the same as the one I am using at work. For some reason it was working and then for no reason I can fathom it started failing with 'Dispatcher has no subscribers' . The only thing I can think is that something is being brought up in the wrong order. Here is the test
JaxB annotated object with getters setters etc omitted
Annotated Service taking the object as a parameterCode:@XmlRootElement(name = "object") public class MyObject implements Serializable{ private static final long serialVersionUID = -5373141442895674583L; private String value1; private String value2; }
The test case which should output hello worldCode:@MessageEndpoint public class MyService { @ServiceActivator public void myMethod (MyObject val){ System.out.println(val); } }
Lastly the configurationCode:@ContextConfiguration(locations = {"classpath:/jms-test-int.xml"}) @RunWith(SpringJUnit4ClassRunner.class) public class MyServiceTest { @Autowired private MessageChannel toJMS; @Test public void test() { MessagingTemplate template = new MessagingTemplate(); template.convertAndSend(toJMS, new MyObject("hello", "world")); } }
Now I have not been able to reproduce this error here on my home pc (powerful linux box) but on my slower Windows XP machine at work it is failing intermittently. When I left today it was failing consistently until I removed the message-converters and just changed the service activator to take a string argument. Has anyone run into this before?Code:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-jms="http://www.springframework.org/schema/integration/jms" xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <int:channel id="toJMS"/> <int-jms:outbound-channel-adapter channel="toJMS" destination-name="com.sample.jms" message-converter="marshallingMessageConverter"/> <int-jms:message-driven-channel-adapter channel="fromJMS" destination-name="com.sample.jms" message-converter="marshallingMessageConverter"/> <int:channel id="fromJMS" /> <int:service-activator input-channel="fromJMS" ref="myService"/> <bean id="myService" class="com.sample.jms.MyService"/> <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="vm://localhost"/> </bean> <bean id="marshallingMessageConverter" class="org.springframework.jms.support.converter.MarshallingMessageConverter"> <property name="unmarshaller" ref="jaxbMarshaller" /> <property name="marshaller" ref="jaxbMarshaller" /> </bean> <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller" > <property name="packagesToScan"> <list> <value>com.sample.jms</value> </list> </property> </bean> </beans>
Thanks,
Bill


Reply With Quote
