-
1. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 10, 2013 6:46 AM (in response to puttime)1 of 1 people found this helpfulTo do either of those things, you need to right-click on the green service icon and not the component. If you are using tooling from 0.8.0.Final then you can hover over the green service icon and use the resulting "button bar" menu to promote and generate test.
-
2. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
puttime Apr 10, 2013 7:32 AM (in response to kcbabo)[Thanks that worked]
7. I right-click on the "green" component and do a "promote service".
8. I use the "WSDL" option.
9. Then I drag & drop the "JMS" component to the promoted service.
I give the queue name as "MyQueue1"
I deploy this on the server. Now I want to test this setup.
I used the "HornetQClient.java" file that is supplied with the quickstart sample.
But I get a "unresolved error" for the following 3 lines:
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
Are there libraries that I need to add specifically?
How do I fix that error?
-
3. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 10, 2013 7:35 AM (in response to puttime)You need this dependency in your application's pom.xml for the test client:
<dependency> <groupId>javax.jms</groupId> <artifactId>jms</artifactId> <version>1.1</version> <scope>test</scope> </dependency>
-
4. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 10, 2013 7:36 AM (in response to kcbabo)1 of 1 people found this helpfulActually, if you are running the class as a standalone java application from the IDE and not a unit test, then I would remove the <scope>test</scope>, so
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency> -
5. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
puttime Apr 10, 2013 7:52 AM (in response to kcbabo)Ok, thanks again, That worked. Now on to other details::
[BTW, after I'm done with this, I'll probably publish this exercise as a video or blog article. That way it'll help others.]
Now I get this error. How do I get around this?
javax.jms.InvalidDestinationException: Destination MyQueue1 does not exist
at org.hornetq.jms.client.HornetQSession.createProducer(HornetQSession.java:337)
at com.example.switchyard.episode9_hornetq_test1.HornetQClientTest.main(HornetQClientTest.java:68)
at com.example.switchyard.episode9_hornetq_test1.HornetQClientTest.defaultExecute(HornetQClientTest.java:91)
at com.example.switchyard.episode9_hornetq_test1.HornetQClientTest.main(HornetQClientTest.java:60)
One difference that I see is that the XML file "switchyard-quickstart-jca-inflow-hornetq-jms.xml" which is in the folder <quickstarts\jca-inflow-hornetq\src\test\resources>.
This is the file that needs to be copied to the "deployments" folder.
I don't see a similar one in my project. How do I generate this file? Or do I just create it by hand and use it?
-
6. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 10, 2013 11:27 AM (in response to puttime)That's the queue definition which you can create by hand (you should also be able to create via AS admin interfaces). I would just take the example in jca-inflow-hornetq-jms.xml and change both instances of JCAInflowGreetingServiceQueue to be MyQueue1. Then deploy that file by copying it into your standalone/deployments directory.
-
7. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
puttime Apr 10, 2013 12:25 PM (in response to kcbabo)I created the XML and also copied it to deployments folder, and the above mentioned error was fixed. Thanks for that.
[The error that I'm getting now is mentioned at the end of this post]
Just reiterating the steps:
Here's the list of steps so far:
1. Create a new "SwitchYard project".
2. Select "Bean", "JMS" and "HornetQ Mixin" components.
Now we see the switchyard GUI.
3. Now drag and drop "Bean" component.
4. I'll call the interface as "HornetQTestService" and the bean as "HornetQTestServiceBean"
5. In the "HornetQTestService" interface, I'll add two methods called
void english(Person person);
void spanish(Person person);
6. I'll then create the class "Person" and it's contents are like this:
@XmlRootElement
public class Person {
String _name;
String _language;
public String getName() {
return _name;
}
public void setName(String name) {
this._name = name;
}
public String getLanguage() {
return _language;
}
public void setLanguage(String language) {
this._language = language;
}
}
7. I right-click on the "green" component and do a "promote service".
8. I use the "WSDL" option.
9. The I go into "Create Transformers" and select JAXB.
9. Then I drag & drop the "JMS" component to the promoted service.
I give the queue name as "MyQueue1"
10. I then create a XML like this and copy it to "deployments" folder.
<?xml version="1.0" encoding="UTF-8"?>
<messaging-deployment xmlns="urn:jboss:messaging-deployment:1.0">
<hornetq-server>
<jms-destinations>
<jms-queue name="MyQueue1">
<entry name="MyQueue1"/>
</jms-queue>
</jms-destinations>
</hornetq-server>
</messaging-deployment>
11. I create a standalone test class to test this. So in pom.xml, I add the following block:
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>12. My switchyard.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:jms="urn:switchyard-component-camel-jms:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:transform="urn:switchyard-config:transform:1.0" name="episode9-hornetq-test1" targetNamespace="urn:com.example.switchyard:episode9-hornetq-test1:1.0">
<sca:composite name="episode9-hornetq-test1" targetNamespace="urn:com.example.switchyard:episode9-hornetq-test1:1.0">
<sca:component name="HornetQTestServiceBean">
<bean:implementation.bean class="com.example.switchyard.episode9_hornetq_test1.HornetQTestServiceBean"/>
<sca:service name="HornetQTestService">
<sca:interface.java interface="com.example.switchyard.episode9_hornetq_test1.HornetQTestService"/>
</sca:service>
</sca:component>
<sca:service name="HornetQTestServicePortType" promote="HornetQTestServiceBean/HornetQTestService">
<sca:interface.wsdl interface="HornetQTestService.wsdl#wsdl.porttype(HornetQTestServicePortType)"/>
<jms:binding.jms>
<operationSelector.xpath expression="//person/language"/>
<jms:queue>MyQueue1</jms:queue>
<jms:connectionFactory>#ConnectionFactory</jms:connectionFactory>
</jms:binding.jms>
</sca:service>
</sca:composite>
<transforms>
<transform:transform.jaxb from="{urn:com.example.switchyard:episode9-hornetq-test1:1.0}english" to="java:com.example.switchyard.episode9_hornetq_test1.Person"/>
<transform:transform.jaxb from="{urn:com.example.switchyard:episode9-hornetq-test1:1.0}spanish" to="java:com.example.switchyard.episode9_hornetq_test1.Person"/>
</transforms>
</switchyard>
--------------------------------------
Now when I run the test app, I get this error on the server:
Exception occurred during execution on the exchange: Exchange[JmsMessage[JmsMessageID: ID:01bc4de9-a1fa-11e2-a487-7d92151f35e9]]: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[JmsMessage[JmsMessageID: ID:01bc4de9-a1fa-11e2-a487-7d92151f35e9]]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1296) [camel-core-2.10.0.jar:2.10.0]
at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:282) [camel-core-2.10.0.jar:2.10.0]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:64) [camel-core-2.10.0.jar:2.10.0]
Caused by: java.lang.NoClassDefFoundError: org/slf4j/Logger
at org.switchyard.component.camel.SwitchYardProducer.getOperationName(SwitchYardProducer.java:130) [switchyard-component-camel-switchyard-0.8.0.Final.jar:0.8.0.Final]
at org.switchyard.component.camel.SwitchYardProducer.lookupOperationNameFor(SwitchYardProducer.java:167) [switchyard-component-camel-switchyard-0.8.0.Final.jar:0.8.0.Final]
at org.switchyard.component.camel.SwitchYardProducer.createSwitchyardExchange(SwitchYardProducer.java:152) [switchyard-component-camel-switchyard-0.8.0.Final.jar:0.8.0.Final]
at org.switchyard.component.camel.SwitchYardProducer.process(SwitchYardProducer.java:89) [switchyard-component-camel-switchyard-0.8.0.Final.jar:0.8.0.Final]
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core-2.10.0.jar:2.10.0]
how can I fix this error?
-
8. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 10, 2013 9:37 PM (in response to puttime)Not sure on why you are hitting that in getOperationName(). Can you zip up your project and send it? Are you able to deploy and test the jca-inflow-quickstart on the same installation following the instructions in the Readme? If you get the same error with that quickstart, I suspect there's somethign funky in your SY runtime and would recommend a clean install of the server. If you don't see the issue with the quickstart, then I would have to check out your app to say more.
-
9. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
puttime Apr 10, 2013 9:56 PM (in response to kcbabo)The quickstart "jca-inflow" app works fine now.
I'm having problems with my app, because I tried to build it from scratch.
Attached is the zipped up project.
Thanks
-
episode9-hornetq-test1.zip 11.7 KB
-
-
10. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 10, 2013 10:06 PM (in response to puttime)Just tried your app against a clean 0.8.0.Final runtime and it worked fine. I built your app, copied it into the deployments directory along with the queue definition, then ran mvn exec:java. Here's what I see:
<?xml version="1.0" encoding="UTF-8"?> <qs:person xmlns:qs="urn:com.example.switchyard:episode9-hornetq-test1:1.0"> <name>Trippy</name> <language>english</language> </qs:person> Sent message [HornetQMessage[ID:05ed54c5-a24c-11e2-9752-20c9d0433ba5]:PERSISTENT]
I recommend nuking your SY runtime install or creating another fresh install and trying it again.
-
11. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
puttime Apr 10, 2013 10:14 PM (in response to kcbabo)The test app (client) works, the problem is on the server side. If you see the server logs, you can see the exception there.
Thanks
-
12. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 11, 2013 6:26 AM (in response to puttime)I did check the server log when running the deployment and it was clean. Looking again at the app you attached, there's no composite service or binding in it, which would explain why I'm not seeing an error. You have a binding definition in the switchyard.xml snippet you pasted earlier, so maybe you attached the wrong version of the app?
I did notice that this thread's title that you are trying to recreate the jca-inflow-hornetq quickstart and yet the binding you are using is binding.jms instead of binding.jca. It's possible that there is a module dependency missing for our JMS gateway on slf4j. That would explain why the JCA quickstart works for you and your recreated app doesn't.
-
13. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
puttime Apr 11, 2013 12:17 PM (in response to kcbabo)So sorry about that. I was experimenting a lot, trying to get to the root of the problem, and had totally messed up the project.
So I thought I'd start from scratch again. But this time i'm running into a stranger problem.
1. I create the project.
2. I create the bean service and the interface.
Now when I try to promote the service, through a WSDL interface, I get this error saying: "local part cannot be "null".
Please see attached screenshot.
How do I get around this?
-
jBoss-Error_01.jpg 69.5 KB
-
-
14. Re: Implementing "quickstart\jca-inflow-hornetq" sample.
kcbabo Apr 11, 2013 12:27 PM (in response to puttime)Did you add operations to the Java interface?