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

Reply via email to