On Mon, Sep 27, 2010 at 10:42 AM, Millies, Sebastian
<[email protected]> wrote:
> Hello there,
>
> I'm having a problem with nested composites, that is composites included
> as a component implementation in another composite. This seems to work only
> when the XML file containing the referenced composite sits in the same
> directory as the XML file with the including composite. It is not enough
> that the referenced composite is in a file somewhere on the classpath, e. g.
> in some jar-file.
>
> I'm using Tuscany 1.6. Has anyone else noticed this? Perhaps it has something
> to do with things on the classpath not being considered part of the 
> contribution
> being loaded. But I'd find that exceedingly strange.
>
> What I would really like to do is have an Eclipse project for each composite,
> export them in jar-files, put those jar files on the class path, and start a
> main composite in which I define components with reference to some of those
> ready-made parts. I certainly don't want to compile all the projects to
> the same location.
>
> See below for an example.
>
> -- Sebastian
>
> Here's an example:
> Main composite (in file ./com/foobaz/main.composite):
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>  <sca:composite xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"; 
> xmlns:logservice-container="http://foobaz.com/logservice-container/"; 
> xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"; name="main" 
> targetNamespace="http://foobaz.com/";>
>  <sca:component name="LogServiceContainer">
>    <sca:implementation.composite 
> name="logservice-container:logservice-container"/> <!-- ** here ** -->
>    <sca:reference name="LogService">
>      <sca:interface.java interface="foobaz.com.LogService"/>
>      <sca:binding.jms 
> initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
>  jndiURL="tcp://localhost:61619" uri="jms:/LoggerComponent/LogService">
>        <sca:destination create="ifnotexist" name="LoggingRequestQueue" 
> type="queue"/>
>        <tuscany:wireFormat.jmsTextXML/>
>      </sca:binding.jms>
>    </sca:reference>
>  </sca:component>
>  </sca:composite>
>
> Included composite, referenced by main composite at marked line above:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <sca:composite xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"; 
> xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"; 
> name="logservice-container" 
> targetNamespace="http://foobaz.com/logservice-container/";>
>  <sca:component name="LogServiceContainer">
>    <sca:implementation.java class="foobaz.com.LogServiceContainer"/>
>    <sca:reference name="LogService"/>
>  </sca:component>
>  <sca:reference name="LogService" promote="LogServiceContainer/LogService"/>
> </sca:composite>
>
> I would start a domain in the root directory with
> SCADomain.newInstance( "com/foobaz/main.composite" );
>
> This works fine if both composite files are in the same directory. However,
> if the included composite is not in the same directory (i. e. also under 
> com/foobaz),
> but inside a jar-file somewhere on the classpath of my Eclipse launch 
> configuration,
> I get errors:
>
> FATAL: Reference not found for component reference: Component = 
> LogServiceContainer Reference = LogService
> WARNING: Component implementation not found: Component = LogServiceContainer 
> Uri = null
>
>

If I remember correctly, in 1.6 we only discover classes from
classPath, other type of resources such as composites, wsdl, xsd are
resolved by URI or by contribution import/export. From what you
described, the composite referenced in the impl.composite might be on
a folder outside of the current contribution thus you have to
contribute that other contribution to the domain, and use
import/export.

See this for an example
https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/itest/contribution-import-export/


-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Reply via email to