On 10/11/07, b anton.etra-id <[EMAIL PROTECTED]> wrote:
>
> Dear Simon,
>
> I have tried that you propose. I have modified the @Service annotation to
> @Service(InformationService.class).
>
> I had changed some names of classes before and some of them had been
> missed
> by me. Sorry. However I am getting the same error:
>
> Exception in thread "main" org.osoa.sca.ServiceUnavailableException: No
>
> service invoker is available for reference default
> (bindingURI=InformationServiceComponent
> operation=getInformationObject).
> at
> ...
>
> Thanks,
>
> Ana Belen
>
> -----Original Message-----
>
> From: "Simon Laws" <[EMAIL PROTECTED]>
>
> To: tuscany-user@ws.apache.org
>
> Date: Thu, 11 Oct 2007 17:17:20 +0100
>
> Subject: Re: New using Tuscany
>
>
>
>
> 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.javaI
>
> > 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(isClient.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
> [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
>
Hi Ana Belen

I took your classes, cut them down a little bit and gave it a spin. I listed
the files I ended up with below. Running isClient.java gives.

Buildfile: build.xml

run-classes:
     [java] Starting ...
     [java] Information.composite ready
     [java] String: a string

BUILD SUCCESSFUL

Can you see if you can get running with these files. If you still have
problems then its likely to be some environment issue. From your fist post
it looks like you are running against the 1.0 distribution. I created a
simple sample project (by copying the calculator sample)  to run this with
the 1.0 distribution. This is the ant target I used is.

<property name="test.class" value="Client.isClient" />
    <target name="run-classes">
        <java classname="${test.class}"
              fork="true">
            <classpath>
                <pathelement path="target/classes"/>
                <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
            </classpath>
        </java>
    </target>

Regards

Simon


Information.composite (This is the same as your copy)
========================================
<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>

InformationService.java
=================
package eu.services.information.is;

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;
}

InformationServiceImpl.java
====================
package eu.services.information.rh;

import org.osoa.sca.annotations.Service;
import eu.services.information.exceptions.*;
import eu.services.information.io.InformationObject;
import eu.services.information.is.*;

@Service(InformationService.class)
public class InformationServiceImpl implements InformationService{

//----------------------------------------------------------------------------------------------------------
 public InformationObject getInformationObject(String id) throws
ISNotFoundException{

 InformationObject io = new InformationObjectImpl();
 //code
 return io;
 }

}

InformationObject.java (I just made this up:-)
===============================
package eu.services.information.io;

public interface InformationObject {
    public String getText();
}

InformationObjectImpl.java
===================
package eu.services.information.rh;

import java.io.Serializable;
import eu.services.information.io.InformationObject;

public class InformationObjectImpl implements InformationObject,
Serializable {
    public String getText(){
        return "a string";
    }

}

isClient.java
=========
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.getInformationObject("c1dee5cd");

  System.out.println("String: " + iobj.getText());

 } catch (ISNotFoundException e1) {
  e1.printStackTrace();
 }
 scaDomain.close();
 }
}

Reply via email to