Hi Lars, I noticed that the Hello World BC has been updated with a long list of TODOs :)
I am still struggling to get the xbean.xml configured correctly (hopefully I manage today by syndicating some other tutorials and documentation around combined with guesswork). I didnt quite understand your <component:...> part and dont know what to add in my xbean yet. I strongly suggest that in the tutorial the full working xbean.xml for the SU is put. I tried to go to jconsole but (I suppose because of the xbean problem) the HelloWorld endpoint is missing from the list of endpoints under ServiceMix->Endpoint. I also tried to follow the namespace (from the BC) but http://org.apache.servicemix.samples.helloworld.bc/1.0 does not exist so not even my IDE can auto-complete the tags. If you are developing your own BC, how do you create your namespace? I dont think it should be referring to servicemix.samples.helloworld.bc right? Thanks again. lhe77 wrote: > > For your testing error: > > Open up a jconsole and connect to your running smx instance. > Then browse to: > > org.apache.servicemix > ServiceMix > Endpoint > > There watch out for your helloWorld endpoint. > Select and expand the item to External and select the > Attributes node. > > Now you can see the serviceName of the endpoint in the list to the right. > This is the uri to send the test messages to I think. > > Just to show you also the JMX opportunities of the smx. :) > > Regards > Lars > > > > Lars Heinemann schrieb: >> I think now I better understand your point of view. >> The tutorial really lacks some important information and is also >> plain wrong in some descriptions. I will update this tutorial asap. >> >> For the meanwhile...see my comments inside your mail: >> >> >> jbx schrieb: >> >>> Hi Lars, >>> >>> The fact that you have to skip from one tutorial to another trying to >>> 'infer' how things should be done (apart from the fact that the latest >>> Maven >>> and its Archetypes do not match the tutorial) simply confuses newbies >>> and >>> creates immense frustration instead of appreciation of the strength of >>> the >>> technology they're trying to learn. >>> >>> How should someone who has just heard about a Service Unit suddenly >>> become >>> an expert and 'know' how to do the SU for a BC if it is not in the >>> tutorial? >>> >>> Just to verify that I am not missing anything out I have done everything >>> from scratch again, sorry if its long: >>> >>> 1. Created directory hello-world-smx and changed the working directory >>> to >>> it. >>> 2. Created the servicemix-binding-component archetype from maven >>> >>> Problem: This does not work: >>> >>> mvn archetype:create \ >>> -DarchetypeGroupId=org.apache.servicemix.tooling \ >>> -DarchetypeArtifactId=servicemix-binding-component \ >>> -DarchetypeVersion=3.2.1 \ >>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \ >>> -DartifactId=hello-world-bc >>> >>> To follow the tutorial in the same way it has to be: >>> mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \ >>> -DarchetypeGroupId=org.apache.servicemix.tooling \ >>> -DarchetypeArtifactId=servicemix-binding-component \ >>> -DarchetypeVersion=3.2.1 \ >>> -DgroupId=org.apache.servicemix.samples.helloworld.bc \ >>> -DartifactId=hello-world-bc >>> >>> It worked for the Getting Started tutorials, so I guess nothing wrong >>> with >>> the above. >>> >>> >> --> This is a known issue for which even a JIRA exists. The solution you >> choose was correct. >> I will put a hint to the section in the tutorial. >> >> >> >> >>> 3. mvn install worked. >>> 4. created the respective IDE project file: mvn idea:idea >>> 5. modified MyProviderEndpoint.processInOut() accordingly >>> 6. modified MySpringComponentTest accordingly and performed mvn install >>> >>> When executing MySpringComponentTest it works fine and the >>> hello-world-bc >>> converts the message. >>> >>> 7. Deploying the BC to ServiceMix. >>> >>> It is not clear if the BC is separate to the SU or the SU is a zip file >>> which also contains the BC. In this tutorial it states that mvn install >>> has >>> created an install zip file which can be deployed into servicemix, but >>> this >>> does not complete the deployment of the BC since it needs an SU. >>> >>> >> --> imho the BC should be deployed standalone as it should a generic >> protocol bridge >> which may be used by several other service units. The zip file of the bc >> is just dropped to the hotdeploy folder of your smx installation and >> will be deployed automatically. >> >> >>> From other places on the service-mix site I learnt that an SU is >>> essentially >>> like a war file. So one thinks, should I create the SU before deploying >>> the >>> BC into servicemix and deploy 1 zip file (like we do for a webapp) which >>> contains the SU which in itself contains the BC. This is quite >>> confusing. >>> >>> >> --> no, the BC should be the first step to create. when the bc is >> deployed you may create a SU and the SA which is in fact only a deploy >> format for the SU and the SA's zip will be dropped into the hotdeploy >> folder as well. If the dependency settings of your SU are pointing to >> your BC then it should even tell you if the BC is not deployed to smx. >> You can try it if you remove the BC and try to deploy only the SA. smx >> will tell you in the console that it now awaits the deployment of the >> hello-world-bc before finishing the deployment of the SA. >> >> >>> I put the BC install file into servicemix /hotdeploy, even though this >>> seems >>> to contradict the above reasoning, but I guess I misunderstood something >>> here. >>> >>> Problem: >>> >>> ERROR - InstallerMBeanImpl - Class not found: >>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap >>> java.lang.ClassNotFoundException: >>> org.apache.servicemix.samples.helloworld.bc.My >>> Bootstrap in classloader >>> org.apache.servicemix.samples.helloworld.bc.MyBootstrap >>> at >>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206) >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:251) >>> at >>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.createBootstrap(InstallerMBeanImpl.java:120) >>> at >>> org.apache.servicemix.jbi.framework.InstallerMBeanImpl.(InstallerMBeanImpl.java:68) >>> at >>> org.apache.servicemix.jbi.framework.InstallationService.initializeInstaller(InstallationService.java:447) >>> at >>> org.apache.servicemix.jbi.framework.InstallationService.doInstallComp >>> onent(InstallationService.java:429) >>> ... >>> >>> The only reference to Bootstrap in the tutorial is struck out, as if it >>> is >>> deprecated, but obviously it is not so. After some reasoning out I >>> created a >>> new MyBootstrap class which implements Bootstrap and implements its >>> methods. >>> Ran again mvn install and tried to deploy it again and it worked (I >>> think). >>> >>> >>> >> --> now as you are telling me this I can remember I had the same >> problems and I did solve them by adding my own bootstrap class. You did >> it correctly I think. Maybe gnodet or some other dev can tell you why >> the archetype for the BC isn't working as it should. >> >> >>> 8. Create the SU. >>> >>> The steps to create the SU are missing. Guesswork again, I jumped around >>> to >>> the Hello World SE tutorial instead. I again assume it is the same for >>> both >>> BC and SE. From now on I am practically on my own jumping from other >>> tutorials and trying to figure things out the hard way: >>> >>> >>> >> --> wow, you are right. I really over-read this fact. It will be added >> soon. >> Basically you can use the archetype "servicemix-service-unit" for the SU >> creation in this case. >> >> >>> I added the following dependency to pom.xml of hello-world-su: >>> >>> >>> org.apache.servicemix.samples.helloworld.bc >>> hello-world-bc >>> 1.0-SNAPSHOT >>> >>> >> --> yes, this is correct if the version of your bc is really 1.0-SNAPSHOT >> >> >>> >>> >>> I added a new xbean.xml file under the resources folder of >>> hello-world-su: >>> >>> >>> >> --> also done correctly. I suppose you used the servicemix-service-unit >> archetype which doesn't provide an own xbean.xml. But you may copy >> almost any other xbean...for example the xbean of the file-poller or >> something similar. Be sure to adapt the xbean file correctly as it uses >> some annotations of the endpoint classes. >> In this case the endpoint should be defined: >> >> <component:provider ...... >> >> or >> >> <component:consumer ...... >> >> The component comes from the >> >> /** >> * @org.apache.xbean.XBean element="component" >> */ >> public class MyComponent extends DefaultComponent { >> >> --> see the annotation, it will be used. >> >> >> for provider or consumer see the corresponding classes >> MyConsumerEndpoint and MyProviderEndpoint...it's same there. >> >> Also have a look at your BC's pom.xml file. There is a important section >> to get your namespace for the SU: >> >> .... >> <plugin> >> <groupId>org.apache.xbean</groupId> >> <artifactId>maven-xbean-plugin</artifactId> >> <version>${xbean-version}</version> >> <executions> >> <execution> >> <configuration> >> >> --> see here the namespace, adapt it if you need to: >> <namespace>http://${packageName}/1.0</namespace> >> >> </configuration> >> <goals> >> <goal>mapping</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> .... >> >> This namespace will be used in your SU's xbean.xml. Just replace the >> part after the xmlns:something="..." with your namespace set in the BC's >> pom. >> >> <?xml version="1.0"?> >> <beans xmlns:something="someuri"> >> <component:consumer .... >> >>> >>> >>> >>> Again even the Hello World SE tutorial has lots of explanations missing. >>> >>> I assume I am done with the SU and try mvn install in its directory. >>> >>> >>> 9. Create the SA >>> >>> Back to the original Hello World BC tutorial again. >>> Created the SA through Maven OK. >>> >>> In the tutorial there is the following confusing statement: >>> >>> The hello-world-smx directory should now contain the following two >>> directories: >>> $ ls >>> hello-world-sa hello-world-bc >>> If the SU is needed, where is its directory?? >>> >>> >> --> it seems the author saw that the SU creation isn't in the wiki so he >> skipped it here as well. of course the SU directory is missing here. >> >> >> >>> The tutorial proceeds with stating that the following needs to be added >>> to >>> the SA pom.xml: >>> >>> >>> org.apache.servicemix.samples.helloworld.bc >>> hello-world-bc >>> 1.0-SNAPSHOT >>> >>> >>> What about the SU?? >>> >>> >> Imho this also makes no sense to me, but maybe there are existing other >> deployment methods which make it possible. >> The SA should only have the SU as dependency. The BC is a dependency of >> the SU. >> >> >>> I proceed blindly with mvn install within the SA directory. >>> >>> 10. The top level project >>> >>> The tutorial states: Now that we have created the SU and SA projects a >>> top >>> level pom.xml must be manually created and made aware of each >>> subproject. >>> pom.xml needs to be edited to include each subproject. >>> >>> >>> >> --> there is an open JIRA for having such a super pom archetype. Until >> it is solved you have to do it manually. >> >> The pom should look like this: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <project xmlns="http://maven.apache.org/POM/4.0.0" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >> http://maven.apache.org/maven-v4_0_0.xsd"> >> >> <modelVersion>4.0.0</modelVersion> >> >> <groupId>org.apache.servicemix.samples.helloworld</groupId> >> <artifactId>hello-world-smx</artifactId> >> <packaging>pom</packaging> >> <version>1.0-SNAPSHOT</version> >> <name>Hello World JBI Component</name> >> >> <modules> >> <module>hello-world-bc</module> >> <module>hello-world-su</module> >> <module>hello-world-sa</module> >> </modules> >> >> </project> >> >> >> Remember this is only a build tool's instruction file. It has nothing to >> do with smx at this moment. It builds the BC first, then the SU and >> finally the SA so all the internal dependencies are fine. >> >> >> >>> <?xml version="1.0" encoding="UTF-8"?> >>> >>> >>> 4.0.0 >>> >>> org.apache.servicemix.samples.helloworld >>> hello-world-smx >>> pom >>> 1.0-SNAPSHOT >>> Hello World JBI Component >>> >>> >>> hello-world-sa >>> hello-world-bc >>> >>> >>> >>> >>> Again, where is the SU? >>> >>> The tutorial proceeds further stating that an ls should list the >>> following >>> files. >>> >>> $ ls >>> hello-world-sa hello-world-bc pom.xml >>> >>> >> no, it better should be: >> >> $ ls >> hello-world-bc hello-world-sa hello-world-su pom.xml >> >> >> >> >>> If the SU is needed, where is it going to be included? >>> >>> >>> 11. Give Each of the Maven Subprojects a Name >>> 12. mvn clean install of the root folder >>> >>> 13. Deploying the Component >>> >>> Now that the SA is built, we're ready to deploy it to the JBI container. >>> This is a work in progress. I will finish this up very soon. >>> >>> Again missing information. >>> >>> I just copied hello-world-sa-1.0-SNAPSHOT.jar. >>> >>> >> You have to copy the BC and the SA zip files to the hotdeploy folder. >> >> >> >> >>> At this point I am really looking forward to test the component out, so >>> I >>> just modified MySpringComponentTest to use the RemoteServiceMixClient in >>> this way: >>> >>> RemoteServiceMixClient rc = new >>> RemoteServiceMixClient("tcp://localhost:61616"); >>> >>> I am shooting blindly at this point since I am not sure what the QName >>> URN >>> should be etc., but assuming that it worked before on the >>> DefaultServiceMixClient I try it out just the same. >>> >>> I get the following error: >>> >>> 3253 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker - >>> ServiceName >>> ({urn:test}service) specified for routing, but can't find it registered >>> ... >>> javax.jbi.messaging.MessagingException: Could not find route for >>> exchange: >>> InOut[ >>> id: ID:10.0.0.1-1191902c607-3:0 >>> status: Active >>> role: provider >>> service: {urn:test}service >>> in: <?xml version="1.0" encoding="UTF-8"?>world >>> ] for service: {urn:test}service and interface: null >>> at >>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:297) >>> at >>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830) >>> ... >>> >>> >>> >> --> the endpoint uri was wrong. See my above comments about the >> namespace thing. >> >> >>> With all the assumptions and guesswork I had to do, this tutorial is >>> definitely NOT straightforward. I would appreciate if someone could >>> correct >>> me where I did a wrong step and tell me what I have to do to eventually >>> test >>> the component with RemoteServiceMixClient. >>> >>> >>> >> --> you are right. it really needs a rework. >> >> Regards >> Lars >> >> >> >>> Thanks. >>> >>> >>> >>> >>> lhe77 wrote: >>> >>> >>>> Yes, the service unit is needed because it configures the BC. >>>> I had a look at the Hello World BC wiki page and it looks not that bad >>>> as you described it. >>>> >>>> Maybe you did not really understand how BC/SE, SU and SA plays >>>> together. >>>> BC and SE are engines, which are deployed to the smx. But when doing >>>> it, >>>> it does not >>>> mean that you have then a working Hello World example. For doing such >>>> example you have to deploy a Hello World ServiceUnit which configures >>>> an >>>> endpoint using the BC in a ServiceAssembly. >>>> >>>> Please re-read the whole wiki page and don't skip out things. If you >>>> still have problems please describe what you already did and what's the >>>> problem exactly. >>>> >>>> Regards >>>> Lars >>>> >>>> >>>> >>>> >>>> jbx schrieb: >>>> >>>> >>>>> Hi all, >>>>> >>>>> First of all I am a newbie, so please ignore my ignorance if my >>>>> question >>>>> is >>>>> obvious. >>>>> >>>>> I have tried to follow the HelloWorld-BC tutorial but it is quite >>>>> incomplete, so I hope to close the gaps here. I tried to look around >>>>> and >>>>> lots of people seemed to have problems too but there are no clear >>>>> answers >>>>> to >>>>> my questions. >>>>> >>>>> 1. Is the Service Unit needed? If yes can I follow some other tutorial >>>>> to >>>>> get it done? I tried to follow the steps from other tutorials, but not >>>>> sure >>>>> if I omitted something. In the Hello-World-BC tutorial there is just >>>>> this: >>>>> >>>>> == 1. Creating a Hello World BC Service Unit >>>>> This is a work in progress >>>>> >>>>> 2. What are the steps to deploy the BC into the actual ServiceMix? >>>>> Same >>>>> problem with the documentation: >>>>> >>>>> == Deploying the Component >>>>> Now that the SA is built, we're ready to deploy it to the JBI >>>>> container. >>>>> >>>>> This is a work in progress. I will finish this up very soon >>>>> >>>>> I tried to reason things out and got to a point where I finally got >>>>> ServiceMix to load my hello-world-sa (created the missing >>>>> MyBootstrap.java >>>>> etc.) However I must have missed something. >>>>> >>>>> I modified the MySpringComponentTest to use the RemoteServiceMixClient >>>>> instead to access the ServiceMix JVM: >>>>> >>>>> RemoteServiceMixClient rc = new >>>>> RemoteServiceMixClient("tcp://localhost:61616"); >>>>> >>>>> but I just got this error: >>>>> >>>>> 4875 [main] WARN org.apache.servicemix.jbi.nmr.DefaultBroker - >>>>> ServiceName >>>>> ({urn:test}service) specified for routing, but can't find it >>>>> registered >>>>> >>>>> >>>>> I suspect that this is something related to endpoints and the way the >>>>> BC >>>>> was >>>>> deployed, but I have no idea what to do next. >>>>> >>>>> In the end I just want to learn how to develop my own BC for a >>>>> specific >>>>> protocol and have it accessible on the [ServiceMix] ESB from other >>>>> clients >>>>> remotely. >>>>> >>>>> Thanks. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/HelloWorld-BC-tp16467761p16535954.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
