You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Patrick Vanhuyse <pv...@greisch.com> on 2007/06/01 09:38:56 UTC
RE: Simple use case problem
Hi Simon,
I removed sca-contibutions.xml from provider. I copied Provider.composite to
consumer/src/main/resource. I add ProviderComposite to the consumer
sca-contribution.xml. And it works.
I have had a look at the code in SCADomain.newInstance(). It loads only one
sca-contribution.xml, the first found by the class loader, I think. To solve
this, it should look at all the sca-contribution.xml (conflict : they are
all in the same folder) from the various jars on the classpath in place of
using only one (depends on the ClassLoader). I don't know if it's possible
(the class loading mechanism is a mystery to me !). Furthermore, there is
the SCA loading mechanism used which is yet a greater mystery.
I will go on with my other tests. Afterwards, if I dare, I will throw myself
into all this loading stuff.
Thanks for your help.
Patrick
-----Message d'origine-----
De : Simon Laws [mailto:simonslaws@googlemail.com]
Envoyé : mercredi 30 mai 2007 18:11
À : tuscany-user@ws.apache.org
Objet : Re: Simple use case problem
Hi Patrick
What is going on here is that the consumer module is not loading the
provider composite. I can make this work by doing the following...
1 - Make the provider composite available to the consumer runtime
copy the Provider.composite to consumer/src/main/resource
2 - Make the ProviderComposite deployable
add the ProviderComposite to the consumer
sca-contributions.xmlfile
Now I kind of expected to have to do 2 so that the runtime knows that the
composite exists and should be deployed.
However I don't know how to get round 1. I would like to be able to specify
a jar to load alongside the consumer composite that is loaded. However I
took a look at the code and there seems to be more work to do in making the
runtime and contribution service flexible in this way. All help is
gratefully received if you feel like getting your hands dirty ;-)
Regards
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
RE: Simple use case problem
Posted by Patrick Vanhuyse <pv...@greisch.com>.
Hi Luciano,
I have attached the full code of my sample to the jira issue.
All is in it !
I now use 2 different resolvers. But it doesn't help !
Regards.
Patrick
> -----Message d'origine-----
> De : Luciano Resende [mailto:luckbr1975@gmail.com]
> Envoyé : mercredi 6 juin 2007 23:44
> À : tuscany-user@ws.apache.org
> Objet : Re: Simple use case problem
>
>
> Hi Patrick
>
> Thanks for finding a workaround for a bug in the code that process
> the contribution metadata side file, I have created a jira for it [1].
>
> Looking into the code you provided, I noticed you are using the
> same resolver while contributing both contributions, and you should be
> using two different ones....
>
> Could you also provide us with the full stack trace and the
> composite files you are using ? In the mean time, I'll try to simulate
> what I think you are doing in a test case and made it available in
> Tuscany.
>
> [1] https://issues.apache.org/jira/browse/TUSCANY-1329
>
> On 6/6/07, Patrick Vanhuyse <pv...@greisch.com> wrote:
> > Luciano,
> >
> > First try with url = "file://.../provider.jar" doesn't work because :
> >
> > In ContributionServiceImpl.java, initializeContributionMetadata
> (line 134) :
> >
> > URL[] clUrls = {sourceURL};
> > URLClassLoader cl = new URLClassLoader(clUrls);
> >
> > contributionMetadataURL =
> > cl.getResource(Contribution.SCA_CONTRIBUTION_META);
> >
> > sourceURL = "file://.../provider.jar"
> > contributionMetadataURL =
> > "file://.../consumer/target/classes/META-INF/sca-contribution.xml"
> > because of the parent class loader in cl.
> >
> > If I put a null parent class loader in the creation of cl :
> >
> > URL[] clUrls = {sourceURL};
> > URLClassLoader cl = new URLClassLoader(clUrls, null);
> >
> > contributionMetadataURL =
> > cl.getResource(Contribution.SCA_CONTRIBUTION_META);
> >
> > it finds the good sca-contribution :
> > contributionMetadataURL =
> > "jar:file://.../provider.jar!/META-INF/sca-contribution.xml"
> >
> > and it loads the ProviderComposite and the ProviderComponent in it.
> >
> > But in my test :
> >
> > // Determine my class loader and my test SCA contribution location
> > String url =
> > "file:///h:/it/logiciel_gi/sca/provider/target/provider.jar";
> >
> > ContributionService contributionService =
> > domain.getContributionService();
> > DomainCompositeHelper helper = domain.getDomainCompositeHelper();
> > ModelResolver myResolver = new
> > ModelResolverImpl(getClass().getClassLoader());
> >
> > // Contribute the SCA contribution
> > List<Contribution> contributions = new ArrayList<Contribution>(2);
> >
> > Contribution contribution = contributionService
> > .contribute("http://www.greisch.com/provider", new URL(url),
> > myResolver, false);
> > assertNotNull(contribution);
> > contributions.add(contribution);
> >
> > url = "file:///h:/it/logiciel_gi/sca/consumer/target/classes/";
> >
> > contribution = contributionService
> > .contribute("http://www.greisch.com/consumer", new URL(url),
> > myResolver, false);
> > assertNotNull(contribution);
> > contributions.add(contribution);
> >
> > for (Contribution contrib : contributions) {
> > for (Composite composite : contrib.getDeployables()) {
> > helper.addComposite(composite);
> > }
> > for (Composite composite : contrib.getDeployables()) {
> > helper.startComposite(composite);
> > }
> > }
> >
> >
> > Consumer consumer = domain.getService(Consumer.class,
> > "ConsumerComponent");
> > consumer.consume("Test");
> >
> > I get a NullPointerException when running consumer.consume("Test"). It
> > doesn't link consumer with my ProviderComponent as required in
> > Consumer.composite.
> >
> > I keep going on with all this.
> >
> > Thanks for your help.
> >
> >
> > > -----Message d'origine-----
> > > De : Luciano Resende [mailto:luckbr1975@gmail.com]
> > > Envoyé : mardi 5 juin 2007 19:49
> > > À : tuscany-user@ws.apache.org
> > > Objet : Re: Simple use case problem
> > >
> > >
> > > Patrick
> > >
> > > The contribution service package processor takes care of
> > > identifying what is the package type and creating the proper jar url
> > > for jar archives. Have you tried to pass a regular file url to the jar
> > > ? Something like :
> > >
> > > String url = "file://.../provider.jar"
> > >
> > > The contribution service iTest [1] gives an example of contributing
> > > a jar directly to the contribution service, just look for
> > > testContributeJAR.
> > >
> > > Please let me know if it works for you after you pass the
> > > simple file url.
> > >
> > >
> > > [1]
> > > https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/
> > > contribution/src/test/java/org/apache/tuscany/sca/test/contributio
> > > n/ContributionServiceTestCase.java
> > >
> > >
> > >
> > > On 6/5/07, Mike Edwards <mi...@gmail.com> wrote:
> > > > Patrick,
> > > >
> > > > One point to make here is that separate contributions are
> intended to
> > > > have different addresses, which in a simple file system equates to
> > > > different directories. If you want multiple composites in the same
> > > > directory, then you should make them part of one
> contribution, which is
> > > > allowed.
> > > >
> > > >
> > > > Yours, Mike.
> > > >
> > > > Patrick Vanhuyse wrote:
> > > > > Hi Simon,
> > > > >
> > > > > I removed sca-contibutions.xml from provider. I copied
> > > Provider.composite to
> > > > > consumer/src/main/resource. I add ProviderComposite to
> the consumer
> > > > > sca-contribution.xml. And it works.
> > > > >
> > > > > I have had a look at the code in SCADomain.newInstance(). It
> > > loads only one
> > > > > sca-contribution.xml, the first found by the class loader, I
> > > think. To solve
> > > > > this, it should look at all the sca-contribution.xml
> > > (conflict : they are
> > > > > all in the same folder) from the various jars on the
> > > classpath in place of
> > > > > using only one (depends on the ClassLoader). I don't know if
> > > it's possible
> > > > > (the class loading mechanism is a mystery to me !).
> > > Furthermore, there is
> > > > > the SCA loading mechanism used which is yet a greater mystery.
> > > > >
> > > > > I will go on with my other tests. Afterwards, if I dare, I
> > > will throw myself
> > > > > into all this loading stuff.
> > > > >
> > > > > Thanks for your help.
> > > > >
> > > > > Patrick
> > > > >
> > > > > -----Message d'origine-----
> > > > > De : Simon Laws [mailto:simonslaws@googlemail.com]
> > > > > Envoyé : mercredi 30 mai 2007 18:11
> > > > > À : tuscany-user@ws.apache.org
> > > > > Objet : Re: Simple use case problem
> > > > >
> > > > >
> > > > > Hi Patrick
> > > > >
> > > > > What is going on here is that the consumer module is not
> loading the
> > > > > provider composite. I can make this work by doing the following...
> > > > >
> > > > > 1 - Make the provider composite available to the consumer runtime
> > > > > copy the Provider.composite to
> consumer/src/main/resource
> > > > > 2 - Make the ProviderComposite deployable
> > > > > add the ProviderComposite to the consumer
> > > > > sca-contributions.xmlfile
> > > > >
> > > > > Now I kind of expected to have to do 2 so that the runtime
> > > knows that the
> > > > > composite exists and should be deployed.
> > > > >
> > > > > However I don't know how to get round 1. I would like to be
> > > able to specify
> > > > > a jar to load alongside the consumer composite that is
> > > loaded. However I
> > > > > took a look at the code and there seems to be more work to do
> > > in making the
> > > > > runtime and contribution service flexible in this way. All help is
> > > > > gratefully received if you feel like getting your hands dirty ;-)
> > > > >
> > > > > Regards
> > > > >
> > > > > Simon
> > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > > > >
> > > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Luciano Resende
> > > Apache Tuscany Committer
> > > http://people.apache.org/~lresende
> > > http://lresende.blogspot.com/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
>
> --
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: Simple use case problem
Posted by Luciano Resende <lu...@gmail.com>.
Hi Patrick
Thanks for finding a workaround for a bug in the code that process
the contribution metadata side file, I have created a jira for it [1].
Looking into the code you provided, I noticed you are using the
same resolver while contributing both contributions, and you should be
using two different ones....
Could you also provide us with the full stack trace and the
composite files you are using ? In the mean time, I'll try to simulate
what I think you are doing in a test case and made it available in
Tuscany.
[1] https://issues.apache.org/jira/browse/TUSCANY-1329
On 6/6/07, Patrick Vanhuyse <pv...@greisch.com> wrote:
> Luciano,
>
> First try with url = "file://.../provider.jar" doesn't work because :
>
> In ContributionServiceImpl.java, initializeContributionMetadata (line 134) :
>
> URL[] clUrls = {sourceURL};
> URLClassLoader cl = new URLClassLoader(clUrls);
>
> contributionMetadataURL =
> cl.getResource(Contribution.SCA_CONTRIBUTION_META);
>
> sourceURL = "file://.../provider.jar"
> contributionMetadataURL =
> "file://.../consumer/target/classes/META-INF/sca-contribution.xml"
> because of the parent class loader in cl.
>
> If I put a null parent class loader in the creation of cl :
>
> URL[] clUrls = {sourceURL};
> URLClassLoader cl = new URLClassLoader(clUrls, null);
>
> contributionMetadataURL =
> cl.getResource(Contribution.SCA_CONTRIBUTION_META);
>
> it finds the good sca-contribution :
> contributionMetadataURL =
> "jar:file://.../provider.jar!/META-INF/sca-contribution.xml"
>
> and it loads the ProviderComposite and the ProviderComponent in it.
>
> But in my test :
>
> // Determine my class loader and my test SCA contribution location
> String url =
> "file:///h:/it/logiciel_gi/sca/provider/target/provider.jar";
>
> ContributionService contributionService =
> domain.getContributionService();
> DomainCompositeHelper helper = domain.getDomainCompositeHelper();
> ModelResolver myResolver = new
> ModelResolverImpl(getClass().getClassLoader());
>
> // Contribute the SCA contribution
> List<Contribution> contributions = new ArrayList<Contribution>(2);
>
> Contribution contribution = contributionService
> .contribute("http://www.greisch.com/provider", new URL(url),
> myResolver, false);
> assertNotNull(contribution);
> contributions.add(contribution);
>
> url = "file:///h:/it/logiciel_gi/sca/consumer/target/classes/";
>
> contribution = contributionService
> .contribute("http://www.greisch.com/consumer", new URL(url),
> myResolver, false);
> assertNotNull(contribution);
> contributions.add(contribution);
>
> for (Contribution contrib : contributions) {
> for (Composite composite : contrib.getDeployables()) {
> helper.addComposite(composite);
> }
> for (Composite composite : contrib.getDeployables()) {
> helper.startComposite(composite);
> }
> }
>
>
> Consumer consumer = domain.getService(Consumer.class,
> "ConsumerComponent");
> consumer.consume("Test");
>
> I get a NullPointerException when running consumer.consume("Test"). It
> doesn't link consumer with my ProviderComponent as required in
> Consumer.composite.
>
> I keep going on with all this.
>
> Thanks for your help.
>
>
> > -----Message d'origine-----
> > De : Luciano Resende [mailto:luckbr1975@gmail.com]
> > Envoyé : mardi 5 juin 2007 19:49
> > À : tuscany-user@ws.apache.org
> > Objet : Re: Simple use case problem
> >
> >
> > Patrick
> >
> > The contribution service package processor takes care of
> > identifying what is the package type and creating the proper jar url
> > for jar archives. Have you tried to pass a regular file url to the jar
> > ? Something like :
> >
> > String url = "file://.../provider.jar"
> >
> > The contribution service iTest [1] gives an example of contributing
> > a jar directly to the contribution service, just look for
> > testContributeJAR.
> >
> > Please let me know if it works for you after you pass the
> > simple file url.
> >
> >
> > [1]
> > https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/
> > contribution/src/test/java/org/apache/tuscany/sca/test/contributio
> > n/ContributionServiceTestCase.java
> >
> >
> >
> > On 6/5/07, Mike Edwards <mi...@gmail.com> wrote:
> > > Patrick,
> > >
> > > One point to make here is that separate contributions are intended to
> > > have different addresses, which in a simple file system equates to
> > > different directories. If you want multiple composites in the same
> > > directory, then you should make them part of one contribution, which is
> > > allowed.
> > >
> > >
> > > Yours, Mike.
> > >
> > > Patrick Vanhuyse wrote:
> > > > Hi Simon,
> > > >
> > > > I removed sca-contibutions.xml from provider. I copied
> > Provider.composite to
> > > > consumer/src/main/resource. I add ProviderComposite to the consumer
> > > > sca-contribution.xml. And it works.
> > > >
> > > > I have had a look at the code in SCADomain.newInstance(). It
> > loads only one
> > > > sca-contribution.xml, the first found by the class loader, I
> > think. To solve
> > > > this, it should look at all the sca-contribution.xml
> > (conflict : they are
> > > > all in the same folder) from the various jars on the
> > classpath in place of
> > > > using only one (depends on the ClassLoader). I don't know if
> > it's possible
> > > > (the class loading mechanism is a mystery to me !).
> > Furthermore, there is
> > > > the SCA loading mechanism used which is yet a greater mystery.
> > > >
> > > > I will go on with my other tests. Afterwards, if I dare, I
> > will throw myself
> > > > into all this loading stuff.
> > > >
> > > > Thanks for your help.
> > > >
> > > > Patrick
> > > >
> > > > -----Message d'origine-----
> > > > De : Simon Laws [mailto:simonslaws@googlemail.com]
> > > > Envoyé : mercredi 30 mai 2007 18:11
> > > > À : tuscany-user@ws.apache.org
> > > > Objet : Re: Simple use case problem
> > > >
> > > >
> > > > Hi Patrick
> > > >
> > > > What is going on here is that the consumer module is not loading the
> > > > provider composite. I can make this work by doing the following...
> > > >
> > > > 1 - Make the provider composite available to the consumer runtime
> > > > copy the Provider.composite to consumer/src/main/resource
> > > > 2 - Make the ProviderComposite deployable
> > > > add the ProviderComposite to the consumer
> > > > sca-contributions.xmlfile
> > > >
> > > > Now I kind of expected to have to do 2 so that the runtime
> > knows that the
> > > > composite exists and should be deployed.
> > > >
> > > > However I don't know how to get round 1. I would like to be
> > able to specify
> > > > a jar to load alongside the consumer composite that is
> > loaded. However I
> > > > took a look at the code and there seems to be more work to do
> > in making the
> > > > runtime and contribution service flexible in this way. All help is
> > > > gratefully received if you feel like getting your hands dirty ;-)
> > > >
> > > > Regards
> > > >
> > > > Simon
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > >
> > >
> >
> >
> > --
> > Luciano Resende
> > Apache Tuscany Committer
> > http://people.apache.org/~lresende
> > http://lresende.blogspot.com/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
--
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
RE: Simple use case problem
Posted by Patrick Vanhuyse <pv...@greisch.com>.
Luciano,
First try with url = "file://.../provider.jar" doesn't work because :
In ContributionServiceImpl.java, initializeContributionMetadata (line 134) :
URL[] clUrls = {sourceURL};
URLClassLoader cl = new URLClassLoader(clUrls);
contributionMetadataURL =
cl.getResource(Contribution.SCA_CONTRIBUTION_META);
sourceURL = "file://.../provider.jar"
contributionMetadataURL =
"file://.../consumer/target/classes/META-INF/sca-contribution.xml"
because of the parent class loader in cl.
If I put a null parent class loader in the creation of cl :
URL[] clUrls = {sourceURL};
URLClassLoader cl = new URLClassLoader(clUrls, null);
contributionMetadataURL =
cl.getResource(Contribution.SCA_CONTRIBUTION_META);
it finds the good sca-contribution :
contributionMetadataURL =
"jar:file://.../provider.jar!/META-INF/sca-contribution.xml"
and it loads the ProviderComposite and the ProviderComponent in it.
But in my test :
// Determine my class loader and my test SCA contribution location
String url =
"file:///h:/it/logiciel_gi/sca/provider/target/provider.jar";
ContributionService contributionService =
domain.getContributionService();
DomainCompositeHelper helper = domain.getDomainCompositeHelper();
ModelResolver myResolver = new
ModelResolverImpl(getClass().getClassLoader());
// Contribute the SCA contribution
List<Contribution> contributions = new ArrayList<Contribution>(2);
Contribution contribution = contributionService
.contribute("http://www.greisch.com/provider", new URL(url),
myResolver, false);
assertNotNull(contribution);
contributions.add(contribution);
url = "file:///h:/it/logiciel_gi/sca/consumer/target/classes/";
contribution = contributionService
.contribute("http://www.greisch.com/consumer", new URL(url),
myResolver, false);
assertNotNull(contribution);
contributions.add(contribution);
for (Contribution contrib : contributions) {
for (Composite composite : contrib.getDeployables()) {
helper.addComposite(composite);
}
for (Composite composite : contrib.getDeployables()) {
helper.startComposite(composite);
}
}
Consumer consumer = domain.getService(Consumer.class,
"ConsumerComponent");
consumer.consume("Test");
I get a NullPointerException when running consumer.consume("Test"). It
doesn't link consumer with my ProviderComponent as required in
Consumer.composite.
I keep going on with all this.
Thanks for your help.
> -----Message d'origine-----
> De : Luciano Resende [mailto:luckbr1975@gmail.com]
> Envoyé : mardi 5 juin 2007 19:49
> À : tuscany-user@ws.apache.org
> Objet : Re: Simple use case problem
>
>
> Patrick
>
> The contribution service package processor takes care of
> identifying what is the package type and creating the proper jar url
> for jar archives. Have you tried to pass a regular file url to the jar
> ? Something like :
>
> String url = "file://.../provider.jar"
>
> The contribution service iTest [1] gives an example of contributing
> a jar directly to the contribution service, just look for
> testContributeJAR.
>
> Please let me know if it works for you after you pass the
> simple file url.
>
>
> [1]
> https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/
> contribution/src/test/java/org/apache/tuscany/sca/test/contributio
> n/ContributionServiceTestCase.java
>
>
>
> On 6/5/07, Mike Edwards <mi...@gmail.com> wrote:
> > Patrick,
> >
> > One point to make here is that separate contributions are intended to
> > have different addresses, which in a simple file system equates to
> > different directories. If you want multiple composites in the same
> > directory, then you should make them part of one contribution, which is
> > allowed.
> >
> >
> > Yours, Mike.
> >
> > Patrick Vanhuyse wrote:
> > > Hi Simon,
> > >
> > > I removed sca-contibutions.xml from provider. I copied
> Provider.composite to
> > > consumer/src/main/resource. I add ProviderComposite to the consumer
> > > sca-contribution.xml. And it works.
> > >
> > > I have had a look at the code in SCADomain.newInstance(). It
> loads only one
> > > sca-contribution.xml, the first found by the class loader, I
> think. To solve
> > > this, it should look at all the sca-contribution.xml
> (conflict : they are
> > > all in the same folder) from the various jars on the
> classpath in place of
> > > using only one (depends on the ClassLoader). I don't know if
> it's possible
> > > (the class loading mechanism is a mystery to me !).
> Furthermore, there is
> > > the SCA loading mechanism used which is yet a greater mystery.
> > >
> > > I will go on with my other tests. Afterwards, if I dare, I
> will throw myself
> > > into all this loading stuff.
> > >
> > > Thanks for your help.
> > >
> > > Patrick
> > >
> > > -----Message d'origine-----
> > > De : Simon Laws [mailto:simonslaws@googlemail.com]
> > > Envoyé : mercredi 30 mai 2007 18:11
> > > À : tuscany-user@ws.apache.org
> > > Objet : Re: Simple use case problem
> > >
> > >
> > > Hi Patrick
> > >
> > > What is going on here is that the consumer module is not loading the
> > > provider composite. I can make this work by doing the following...
> > >
> > > 1 - Make the provider composite available to the consumer runtime
> > > copy the Provider.composite to consumer/src/main/resource
> > > 2 - Make the ProviderComposite deployable
> > > add the ProviderComposite to the consumer
> > > sca-contributions.xmlfile
> > >
> > > Now I kind of expected to have to do 2 so that the runtime
> knows that the
> > > composite exists and should be deployed.
> > >
> > > However I don't know how to get round 1. I would like to be
> able to specify
> > > a jar to load alongside the consumer composite that is
> loaded. However I
> > > took a look at the code and there seems to be more work to do
> in making the
> > > runtime and contribution service flexible in this way. All help is
> > > gratefully received if you feel like getting your hands dirty ;-)
> > >
> > > Regards
> > >
> > > Simon
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
>
> --
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: Simple use case problem
Posted by Luciano Resende <lu...@gmail.com>.
Patrick
The contribution service package processor takes care of
identifying what is the package type and creating the proper jar url
for jar archives. Have you tried to pass a regular file url to the jar
? Something like :
String url = "file://.../provider.jar"
The contribution service iTest [1] gives an example of contributing
a jar directly to the contribution service, just look for
testContributeJAR.
Please let me know if it works for you after you pass the simple file url.
[1] https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
On 6/5/07, Mike Edwards <mi...@gmail.com> wrote:
> Patrick,
>
> One point to make here is that separate contributions are intended to
> have different addresses, which in a simple file system equates to
> different directories. If you want multiple composites in the same
> directory, then you should make them part of one contribution, which is
> allowed.
>
>
> Yours, Mike.
>
> Patrick Vanhuyse wrote:
> > Hi Simon,
> >
> > I removed sca-contibutions.xml from provider. I copied Provider.composite to
> > consumer/src/main/resource. I add ProviderComposite to the consumer
> > sca-contribution.xml. And it works.
> >
> > I have had a look at the code in SCADomain.newInstance(). It loads only one
> > sca-contribution.xml, the first found by the class loader, I think. To solve
> > this, it should look at all the sca-contribution.xml (conflict : they are
> > all in the same folder) from the various jars on the classpath in place of
> > using only one (depends on the ClassLoader). I don't know if it's possible
> > (the class loading mechanism is a mystery to me !). Furthermore, there is
> > the SCA loading mechanism used which is yet a greater mystery.
> >
> > I will go on with my other tests. Afterwards, if I dare, I will throw myself
> > into all this loading stuff.
> >
> > Thanks for your help.
> >
> > Patrick
> >
> > -----Message d'origine-----
> > De : Simon Laws [mailto:simonslaws@googlemail.com]
> > Envoyé : mercredi 30 mai 2007 18:11
> > À : tuscany-user@ws.apache.org
> > Objet : Re: Simple use case problem
> >
> >
> > Hi Patrick
> >
> > What is going on here is that the consumer module is not loading the
> > provider composite. I can make this work by doing the following...
> >
> > 1 - Make the provider composite available to the consumer runtime
> > copy the Provider.composite to consumer/src/main/resource
> > 2 - Make the ProviderComposite deployable
> > add the ProviderComposite to the consumer
> > sca-contributions.xmlfile
> >
> > Now I kind of expected to have to do 2 so that the runtime knows that the
> > composite exists and should be deployed.
> >
> > However I don't know how to get round 1. I would like to be able to specify
> > a jar to load alongside the consumer composite that is loaded. However I
> > took a look at the code and there seems to be more work to do in making the
> > runtime and contribution service flexible in this way. All help is
> > gratefully received if you feel like getting your hands dirty ;-)
> >
> > Regards
> >
> > Simon
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
--
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: Simple use case problem
Posted by Mike Edwards <mi...@gmail.com>.
Patrick,
One point to make here is that separate contributions are intended to
have different addresses, which in a simple file system equates to
different directories. If you want multiple composites in the same
directory, then you should make them part of one contribution, which is
allowed.
Yours, Mike.
Patrick Vanhuyse wrote:
> Hi Simon,
>
> I removed sca-contibutions.xml from provider. I copied Provider.composite to
> consumer/src/main/resource. I add ProviderComposite to the consumer
> sca-contribution.xml. And it works.
>
> I have had a look at the code in SCADomain.newInstance(). It loads only one
> sca-contribution.xml, the first found by the class loader, I think. To solve
> this, it should look at all the sca-contribution.xml (conflict : they are
> all in the same folder) from the various jars on the classpath in place of
> using only one (depends on the ClassLoader). I don't know if it's possible
> (the class loading mechanism is a mystery to me !). Furthermore, there is
> the SCA loading mechanism used which is yet a greater mystery.
>
> I will go on with my other tests. Afterwards, if I dare, I will throw myself
> into all this loading stuff.
>
> Thanks for your help.
>
> Patrick
>
> -----Message d'origine-----
> De : Simon Laws [mailto:simonslaws@googlemail.com]
> Envoyé : mercredi 30 mai 2007 18:11
> À : tuscany-user@ws.apache.org
> Objet : Re: Simple use case problem
>
>
> Hi Patrick
>
> What is going on here is that the consumer module is not loading the
> provider composite. I can make this work by doing the following...
>
> 1 - Make the provider composite available to the consumer runtime
> copy the Provider.composite to consumer/src/main/resource
> 2 - Make the ProviderComposite deployable
> add the ProviderComposite to the consumer
> sca-contributions.xmlfile
>
> Now I kind of expected to have to do 2 so that the runtime knows that the
> composite exists and should be deployed.
>
> However I don't know how to get round 1. I would like to be able to specify
> a jar to load alongside the consumer composite that is loaded. However I
> took a look at the code and there seems to be more work to do in making the
> runtime and contribution service flexible in this way. All help is
> gratefully received if you feel like getting your hands dirty ;-)
>
> Regards
>
> Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
RE: Simple use case problem
Posted by Patrick Vanhuyse <pv...@greisch.com>.
Hi Jean-Sebastien,
When I try to load a contributions using
Contribution contribution =
contributionService.contribute("http://test/contribution", new URL(url),
myResolver, false);
with the url pointing to a jar ("jar:file://.../provider.jar!/"), I get the
following error :
Running consumer.ConsumerEmbeddedTestCase
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.11 sec <<<
FAILURE!
testDomain(consumer.ConsumerEmbeddedTestCase) Time elapsed: 0.079 sec <<<
ERROR!
java.io.IOException: no entry name specified
at
sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.ja
va:112)
at java.net.URL.openStream(URL.java:1007)
at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.add
Contribution(ContributionServiceI
mpl.java:237)
at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.con
tribute(ContributionServiceImpl.j
ava:119)
at
consumer.ConsumerEmbeddedTestCase.testDomain(ConsumerEmbeddedTestCase.java:5
8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35
)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62
)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(Ab
stractDirectoryTestSuite.java:138
)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractD
irectoryTestSuite.java:125)
at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireB
ooter.java:290)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818
)
When I remove the "!/" at the end, I have an error saying that "!/" is
missing !
If I try with a file in the jar, I get a
org.apache.tuscany.sca.contribution.service.UnsupportedContentTypeException.
Any idea ?
Thanks.
Patrick
> -----Message d'origine-----
> De : Jean-Sebastien Delfino [mailto:jsdelfino@apache.org]
> Envoyé : samedi 2 juin 2007 4:13
> À : tuscany-user@ws.apache.org
> Objet : Re: Simple use case problem
>
>
> Patrick Vanhuyse wrote:
> > Hi Simon,
> >
> > I removed sca-contibutions.xml from provider. I copied
> Provider.composite to
> > consumer/src/main/resource. I add ProviderComposite to the consumer
> > sca-contribution.xml. And it works.
> >
> > I have had a look at the code in SCADomain.newInstance(). It
> loads only one
> > sca-contribution.xml, the first found by the class loader, I
> think. To solve
> > this, it should look at all the sca-contribution.xml (conflict
> : they are
> > all in the same folder) from the various jars on the classpath
> in place of
> > using only one (depends on the ClassLoader). I don't know if
> it's possible
> > (the class loading mechanism is a mystery to me !).
> Furthermore, there is
> > the SCA loading mechanism used which is yet a greater mystery.
> >
> > I will go on with my other tests. Afterwards, if I dare, I will
> throw myself
> > into all this loading stuff.
> >
> > Thanks for your help.
> >
> > Patrick
> >
> > -----Message d'origine-----
> > De : Simon Laws [mailto:simonslaws@googlemail.com]
> > Envoyé : mercredi 30 mai 2007 18:11
> > À : tuscany-user@ws.apache.org
> > Objet : Re: Simple use case problem
> >
> >
> > Hi Patrick
> >
> > What is going on here is that the consumer module is not loading the
> > provider composite. I can make this work by doing the following...
> >
> > 1 - Make the provider composite available to the consumer runtime
> > copy the Provider.composite to consumer/src/main/resource
> > 2 - Make the ProviderComposite deployable
> > add the ProviderComposite to the consumer
> > sca-contributions.xmlfile
> >
> > Now I kind of expected to have to do 2 so that the runtime
> knows that the
> > composite exists and should be deployed.
> >
> > However I don't know how to get round 1. I would like to be
> able to specify
> > a jar to load alongside the consumer composite that is loaded.
> However I
> > took a look at the code and there seems to be more work to do
> in making the
> > runtime and contribution service flexible in this way. All help is
> > gratefully received if you feel like getting your hands dirty ;-)
> >
> > Regards
> >
> > Simon
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
> >
>
> Hi,
>
> DefaultSCADomain is a minimal domain bootstrap utility initially
> designed to work with a single SCA contribution (one JAR or folder).
>
> If you want to try, you should be able to add multiple contributions to
> a domain using EmbeddedSCADomain instead of DefaultSCADomain.
> EmbeddedSCADomain is a more flexible domain bootstrap class that allows
> you to add/remove contributions, add/remove composites to the domain,
> and start/stop components contained in these composites. The
> EmbeddedSCADomainTestCase [1] test case shows how to use
> EmbeddedSCADomain, to create a domain, populate it and use it.
>
> [1]
> http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules
> /host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/
> impl/EmbeddedSCADomainTestCase.java
>
> Line 62:
> Contribution contribution =
> contributionService.contribute("http://test/contribution", new URL(url),
> myResolver, false);
> adds a contribution, the URL can point to a contribution folder or JAR.
>
> Maybe you can try to add multiple contributions this way? let me know
> how it goes... Thanks.
>
> Hope this helps.
>
> --
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: Simple use case problem
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Patrick Vanhuyse wrote:
> Hi Simon,
>
> I removed sca-contibutions.xml from provider. I copied Provider.composite to
> consumer/src/main/resource. I add ProviderComposite to the consumer
> sca-contribution.xml. And it works.
>
> I have had a look at the code in SCADomain.newInstance(). It loads only one
> sca-contribution.xml, the first found by the class loader, I think. To solve
> this, it should look at all the sca-contribution.xml (conflict : they are
> all in the same folder) from the various jars on the classpath in place of
> using only one (depends on the ClassLoader). I don't know if it's possible
> (the class loading mechanism is a mystery to me !). Furthermore, there is
> the SCA loading mechanism used which is yet a greater mystery.
>
> I will go on with my other tests. Afterwards, if I dare, I will throw myself
> into all this loading stuff.
>
> Thanks for your help.
>
> Patrick
>
> -----Message d'origine-----
> De : Simon Laws [mailto:simonslaws@googlemail.com]
> Envoyé : mercredi 30 mai 2007 18:11
> À : tuscany-user@ws.apache.org
> Objet : Re: Simple use case problem
>
>
> Hi Patrick
>
> What is going on here is that the consumer module is not loading the
> provider composite. I can make this work by doing the following...
>
> 1 - Make the provider composite available to the consumer runtime
> copy the Provider.composite to consumer/src/main/resource
> 2 - Make the ProviderComposite deployable
> add the ProviderComposite to the consumer
> sca-contributions.xmlfile
>
> Now I kind of expected to have to do 2 so that the runtime knows that the
> composite exists and should be deployed.
>
> However I don't know how to get round 1. I would like to be able to specify
> a jar to load alongside the consumer composite that is loaded. However I
> took a look at the code and there seems to be more work to do in making the
> runtime and contribution service flexible in this way. All help is
> gratefully received if you feel like getting your hands dirty ;-)
>
> Regards
>
> Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
>
Hi,
DefaultSCADomain is a minimal domain bootstrap utility initially
designed to work with a single SCA contribution (one JAR or folder).
If you want to try, you should be able to add multiple contributions to
a domain using EmbeddedSCADomain instead of DefaultSCADomain.
EmbeddedSCADomain is a more flexible domain bootstrap class that allows
you to add/remove contributions, add/remove composites to the domain,
and start/stop components contained in these composites. The
EmbeddedSCADomainTestCase [1] test case shows how to use
EmbeddedSCADomain, to create a domain, populate it and use it.
[1]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
Line 62:
Contribution contribution =
contributionService.contribute("http://test/contribution", new URL(url),
myResolver, false);
adds a contribution, the URL can point to a contribution folder or JAR.
Maybe you can try to add multiple contributions this way? let me know
how it goes... Thanks.
Hope this helps.
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org