启动activemq5.2,端口改成61619,
运行helloworld-ws-reference-jms例子程序的HelloWorldJmsClient.java,代码如下:
public class HelloWorldJmsClient {
public final static void main(String[] args) throws Exception {
SCADomain scaDomain =
SCADomain.newInstance("helloworldwsjmsclient.composite");
HelloWorldService helloWorldService =
scaDomain.getService(HelloWorldService.class,
"HelloWorldServiceComponent");
String value = helloWorldService.getGreetings("World");
System.out.println(value);
scaDomain.close();
}
}
-------------------composite 定义如下:
helloworldwsjms.composite
<composite xmlns="
http://www.osoa.org/xmlns/sca/1.0" xmlns:hw="http://
helloworld" name="helloworldws" targetNamespace="
http://helloworld">
<component name="HelloWorldServiceComponent">
<implementation.java class="helloworld.HelloWorldImpl"/>
<service name="HelloWorldService">
<interface.wsdl interface="http://
helloworld#wsdl.interface(HelloWorld)"/>
<
binding.ws uri="jms:/queue.sample?
transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://
localhost:61619" wsdlElement="http://
helloworld#wsdl.binding(HelloWorldSoapJmsBinding)"/>
</service>
</component>
</composite>
------------------
结果报错:
- Cannot get or lookup JMS destination : queue.sample from url : jms:/
queue.sample?
transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://
localhost:61616 : queue.sample
- Did not receive a JMS response within 30000 ms to destination :
queue://queue.sample
不知道怎么回事。