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.

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. 

>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.

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).


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:

I added the following dependency to pom.xml of hello-world-su:

    
      org.apache.servicemix.samples.helloworld.bc
      hello-world-bc
      1.0-SNAPSHOT
    

I added a new xbean.xml file under the resources folder of hello-world-su:


  


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??

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??

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.

<?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

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.

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)
...


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.

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-tp16467761p16490902.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to