Dear Simon,

First of all, my latter problem (regarding "No service invoker is available
for reference default" error)  was saved. I think dependencies wasn't
causing this problem. Certainly, I use another dependencies, but I had
followed your steps and it was right. I think the problem was with the
composite file: the component name it was wrong. Thank you very much.

Now, it seems I have a problem with the JavaBeans, I think:

============================================================================
============================

Starting ...
InformationService.composite ready
Exception in thread "main" java.lang.IllegalArgumentException: Pass-by-value
is not supported for the given object
 at
org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding.copy(JavaB
eansDataBinding.java:84)
 at
org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint$LazyData
Binding.copy(DefaultDataBindingExtensionPoint.java:171)
 at
org.apache.tuscany.sca.core.databinding.wire.PassByValueInteceptor.copy(Pass
ByValueInteceptor.java:90)
 at
org.apache.tuscany.sca.core.databinding.wire.PassByValueInteceptor.invoke(Pa
ssByValueInteceptor.java:54)
 at
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvoca
tionHandler.java:233)
 at
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvoca
tionHandler.java:130)
 at $Proxy5.getInformationObject(Unknown Source)
 at Client.isClient.main(igsClient.java:21)
Caused by: java.io.NotSerializableException:
eu.services.information.repository.Repository
 at java.io.ObjectOutputStream.writeObject0(Unknown Source)
 at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
 at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
 at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
 at java.io.ObjectOutputStream.writeObject0(Unknown Source)
 at java.io.ObjectOutputStream.writeObject(Unknown Source)
 at
org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding.copy(JavaB
eansDataBinding.java:68)
 ... 7 more

============================================================================
==============================

 If you remember I had this java class:

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 = null;  
 try {
   io = new InformationObject();
   io.setID(id);
 } catch (MalformedURLException e) {
  e.printStackTrace();
 } catch (ISNotFoundException e) {
   io = null;
   throw new ISNotFoundException("Information Object with id ["+
     id+"] doesn't exist");
  }
 return io;  
 }

}

The method getInformationObject return an "InformationObject" given by its
"id". For that I use a JavaBean. Please, note that I have added some of code
to this method because of that. The InformationObject,java is the following:

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

import java.io.Serializable;
import eu.services.information.io.InformationObject;
import eu.services.information.repository.Repository;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Node;

public class InformationObjectImpl implements InformationObject,
Serializable {
    private String Text = null;
    private String ID = null;
    
    private Repository repository = null;
    
    public InformationObjectImpl() {
    }
     
    public String getText(){
        return this.Text;
    }
    
    public String getId(){
        return this.ID;
    }
    
    private void setDescription(Document document) {
  this.Description = repository.getUniqueValue(Repository.PATH_TEXT,
document);
  }
  
  private void setID(Document document) {
  this.ID = repository.getUniqueValue(Repository.PATH_ID, document);
  }
 
  public void setID(String id)  {   
   repository= new Repository();
   Node myNode = repository.getUniqueRegister(Repository.PATH_ID, id); 
   if (gsNode!= null) {
    Document myDocument = DocumentHelper.parseText(myNode.asXML());
    setText(myDocument);
    setID(myDocument);
   }
 }
}

Repository.java
===============
package eu.services.information.repository;

import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;

public class Repository {

 private String Repository_FILE = "Repository.xml"; 
 private Document myrepository = null;

 
//--------------------------------------------------------------------------
----------------------------------------------
 // --> Paths
 
//--------------------------------------------------------------------------
----------------------------------------------
 public final static String PATH_RELATIVE_TEST = "//test";
 public final static String PATH_ID    = "//id";
 private final static String NAME_REGISTER = "Register";
 
//--------------------------------------------------------------------------
----------------------------------------------
 // --> /Paths
 
//--------------------------------------------------------------------------
----------------------------------------------
   
 public Repository () throws DocumentException{
  SAXReader xmlReader = new SAXReader();
  repository = xmlReader.read(new File(getPath()));
 }
 
 public Document readRepository(){
  return this.myrepository;
 }
 
 public String getPath(){
  String path = ClassLoader.getSystemResource(Repository_FILE).getPath();
  path=path.replace("%20"," ");
  return path;
 }
 
 public boolean existRepository(){
  if (this.myrepository != null) return true;
  else return false;
 }
 
 public String getUniqueValue(String path, Document register){
  String value = null;
   List nodesList = register.selectNodes(path);
    if (nodesList.size()!= 0 ){
     Iterator iterator = nodesList.iterator();       
       while(iterator.hasNext()){     
         Element element = (Element)iterator.next();
         value = element.getText();
       }
    }
    return value;
 }
}
public Node getUniqueRegister(String path, String value){
  Node registerFound = null;
  int index = -1;
  boolean found = false;
  
        List nodesList = myrepository.selectNodes(path);
        if (nodesList.size()!= 0 ){
         Iterator iterator = nodesList.iterator();       
         while(iterator.hasNext() & !found){     
          Element element = (Element)iterator.next();
          index++;
          if (element.getText().equals(value)){
           found = true;
           //If some one is found, the node parent is searched until find
the register parent...
           Node nodeFound = (Node)nodesList.get(index);
           while (nodeFound.getName()!=NAME_REGISTER){
            nodeFound = nodeFound.getParent();
           }
           registerFound = nodeFound;
          }
         }
        }
        return registerFound;
 }
}

Do you have any idea about what I am using in wrong way?

Thanks and best regards,

Ana Belen

Reply via email to