On 10/11/07, Ana Belén Antón Gironés <[EMAIL PROTECTED]> wrote:
>
> Hi Simon!
>
> First of all, thank you very much for your help.
>
> I have some problems running my application. When I run my isClient.java I
> get this exception:
>
> Starting ...
> 11-oct-2007 16:45:23
> org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1problem
> ADVERTENCIA: [WARNING] No targets for reference: getInformationObject null
> 11-oct-2007 16:45:23
> org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1problem
> ADVERTENCIA: [WARNING] No targets for reference: getAllInformationObject
> null
> Information.composite ready
> Exception in thread "main" org.osoa.sca.ServiceUnavailableException: No
> service invoker is available for reference default
> (bindingURI=InformationGroundingServiceComponent
> operation=getGroundingService).
> at
>
> org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAReferenceBindingProvider.c
> reateInvoker(RuntimeSCAReferenceBindingProvider.java:192)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.addBindingInterceptor
> (R
> untimeWireImpl.java:214)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.initInvocationChains
> (Ru
> ntimeWireImpl.java:156)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.getInvocationChains
> (Run
> timeWireImpl.java:97)
> at
>
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.getInvocationCha
> in(JDKInvocationHandler.java:190)
> at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke
> (JDKInvoca
> tionHandler.java:124)
> at $Proxy7.getInformationObject(Unknown Source)
> at Client.isClient.main(igsClient.java:34)
>
>
> I know that I am missing some refence to getInformationObject and
> getAllInformationObject and something is missing in the composite, but I
> don't know what it is. My application has a complex estructure but I am
> going to try to explain it.
>
>
> isClient.java is:
>
>
> ****************************************************************************
> *****************************
> package Client;
>
> import org.apache.tuscany.sca.host.embedded.SCADomain;
> import eu.services.information.exceptions.ISNotFoundException;
> import eu.services.information.io.InformationObject;
> import eu.services.information.is.InformationService;
>
> public class isClient {
>
> public static void main(String[] args) throws Exception {
>
> System.out.println("Starting ...");
> SCADomain scaDomain = SCADomain.newInstance("Information.composite");
> System.out.println("Information.composite ready");
>
> InformationService is = scaDomain.getService(InformationService.class,
> "InformationServiceComponent");
>
> InformationObject iobj;
> try {
> iobj = is.getInformation("c1dee5cd");
>
> System.out.println("Description: " + iobj.getDescription());
> System.out.println("Lang: " + iobj.getLang());
> System.out.println("Name: " + iobj.getName());;
> System.out.println("Protocol: " + iobj.getProtocol());
> System.out.println("URL: " + iobj.getURL());
> System.out.println("ID: " + iobj.getID());
> } catch (ISNotFoundException e1) {
> e1.printStackTrace();
> }
> scaDomain.close();
> }
> }
>
> ****************************************************************************
> *********************************
>
>
> the composite:
>
>
> ****************************************************************************
> *********************************
> <?xml version="1.0" encoding="UTF-8"?>
>
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> name="InformationComposite">
>
> <component name="InformationServiceComponent">
> <implementation.java class=
> "eu.services.information.rh.InformationServiceImpl"/>
> </component>
>
> </composite>
>
> ****************************************************************************
> *********************************
>
>
> my src structure is:
>
>
> ****************************************************************************
> *********************************
>
> -Client
> -isClient.java
> -eu.services.information.exceptions
> -GCException.java
> -InconsistentIOConstraintException.java
> -InconsistentIOException.java
> -ISNotFoundException.java
> -eu.services.information.ior
> -InformationObjectRepository.java
> -eu.services.information.io
> -InformationObject.java
> -eu.services.information.isr
> -ISRequest.java
> -mainISRequest.java
> -eu.services.information.is
> -InformationService.java
> -InformationObjectConstraint.java
> -eu.services.information.rh
> -InformationServiceImpl.java
> -InformationObjectImpl.java
> -InformationService.composite
>
>
> ****************************************************************************
> *********************************
>
>
> the InformationService.java is
>
>
> ****************************************************************************
> ********************************
> package eu.services.information.is;
>
> import java.util.List;
>
> import org.osoa.sca.annotations.Remotable;
>
> import eu.services.information.exceptions.*;
> import -eu.services.information.io.InformationObject;
>
>
> @Remotable
> public interface InformationService {
>
>
> public InformationObject getInformationObject (String id)
> throws ISNotFoundException;
>
>
> public List<InformationObject>
> getAllInformationObject(List<InformationObjectConstraint> constraintsList)
> throws ISNotFoundException;
> }
>
> ****************************************************************************
> *********************************
>
>
> and the InformationServiceImpl.java:
>
> ****************************************************************************
> *********************************
> package eu.esdihumboldt.informationgrounding.requesthandler;
>
> import java.io.IOException;
> import java.util.ArrayList;
> import java.util.List;
>
> import org.dom4j.Document;
> import org.dom4j.DocumentException;
> import org.dom4j.DocumentHelper;
> import org.dom4j.Node;
> import org.osoa.sca.annotations.Reference;
> import org.osoa.sca.annotations.Service;
>
> import eu.services.information.exceptions.*;
> import eu.services.information.ior.InformationObjectRepository;
> import eu.services.information.io.InformationObject;
> import eu.services.information.is.*;
>
>
> @Service(InformationGroundingService.class)
> public class InformationServiceImpl implements InformationService{
>
> //
>
> ----------------------------------------------------------------------------
> ------------------------------
>
> @Reference
> public List<InformationObject>
> getAllInformationObject(List<InformationObjectConstraint> constraintsList)
> throws ISNotFoundException {
> List<InformationObject> ioList = new ArrayList<GroundingService>();
> //code
> return ioList;
> }
>
>
> // ----------------------------------------------------------------------
>
> @Reference
> public InformationObject getInformationObject(String id) throws
> ISNotFoundException{
>
> InformationObject io = null;
> //code
> return io;
> }
>
> // ----------------------------------------------------------------------
>
> private boolean checkConstaintList(List<GroundingServiceConstraint>
> constraints){
> boolean isRight = true;
> //code
> return isRight;
> }
>
> // ----------------------------------------------------------------------
> private String buildXPath (List<GroundingServiceConstraint> constraints){
> //code
> String path = "";
> return path;
> }
>
> // ----------------------------------------------------------------------
>
> private String getPath (Integer id ){
> //code
> String path = "";
> return path;
> }
>
> }
>
>
> ****************************************************************************
> *********************************
>
> I hope you can follow and understand my explanation.
>
> Thank you very much for your help! Regards,
>
> Ana Belen
>
>
> Hi
Disregarding that warnings you are getting about missing references (as you
say you are expecting that) the error you are getting:
Exception in thread "main" org.osoa.sca.ServiceUnavailableException: No
service invoker is available for reference default
(bindingURI=InformationGroundingServiceComponent
operation=getGroundingService).
Means that when you make the call in the client to get a proxy to a service:
InformationService is = scaDomain.getService(InformationService.class
,"InformationServiceComponent");
The runtime is not able to find the service you are asking for. Now the
interesting thing to note here is that the bindingURI =
InformationGroundingServiceComponent. This is clearly not the name of the
component in the .composite file or the name of the component you asked for.
There is a similar name in the @Service annotation you have on you service
implementation:
@Service(InformationGroundingService.class)
public class InformationServiceImpl implements InformationService{
Not sure how Component is getting added to the end though. Anyhow you should
make the @Service annotation match the interface that the service
implementation implementats. @Service is used to tell the Tuscany runtime
which interfaces provide SCA services. So try.
@Service(InformationService.class)
In this case you can get away without the @Service annotation altogether as
the runtime will assume that you want to expose the single interface that
you implement as a service.
If this doesn't have any +ve effect let me know and I'll look a little
closer, i.e. run up the sample, and see what's going on
Regards
Simon