You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Bruce Snyder <br...@gmail.com> on 2007/10/03 11:33:23 UTC

Re: Unable to discover service endpoint.

On 9/20/07, ericnygma <pr...@gmail.com> wrote:
>
> Hi,
>
> My aim is to write to a File using the File BC.
>
> 1)I followed the instructions on
> http://incubator.apache.org/servicemix/24-beginner-configuring-the-servicemix-file-su.html
> to create the SU for the service-file BC. Also wrote an SA and deployed onto
> Servicemix.
>
> 2) The xbean.xml of the SU looks as :
> <beans xmlns:file="http://servicemix.apache.org/file/1.0"
>        xmlns:sm="http://servicemix.apache.org/config/1.0"
>        xmlns:myns="http://hellothere.com/jbi/">
>       <file:sender service="myns:myFile"
>              endpoint="myFile"
>              directory="file:D:/space/svcmix/trial/" >
>                  <sm:marshaler>
>     <sm:defaultFileMarshaler>
>       <sm:fileName>
>         <sm:xpathString xpath="concat('testing', '.xml')"/>
>       </sm:fileName>
>     </sm:defaultFileMarshaler>
>   </sm:marshaler>
>     </file:sender>
> </beans>
>
> 3)Because of the above xbean.xml , I assume the File SA can be discovered in
> the JBI container with the QName : {http://hellothere.com/jbi}myFile.
>
> 4)I have written an SE and deployed it into servicemix. The SE code has
> something as below to discover ServiceEndpoints.
> ServiceEndpoint serviceEndpoint =
> getServiceUnit().getComponent().getComponentContext()
>                        .getEndpoint(new
> QName("http://hellothere/jbi","myFile"),myFile );
>
> 5)I find that the above serviceEndpoint is NULL, its unable to find the File
> SU.
> I intend to use this variable further down in
> messageExchange.setEndpoint(serviceEndpoint); to send a message to that
> endpoint, with the aim of writing the message content.
>
> Can someone please advice on the error in my code/SU's xbean.xml.I am not
> able to figure out how to accomplish this.

Well, I don't see any errors in your code. In fact, I've used the
ComponentContext.getEndpoint() method myself to locate endpoints and
it has worked well. I recommend bringing up jconsole to look at the
endpoints in the ServiceMix JMX domain to make sure that the endpoint
is actually deployed and available via JMX.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/