You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Eneko Fernández <en...@dunait.es> on 2010/06/01 12:07:28 UTC

Error with tuscany 1.6, component implementation in groovy with ws reference

Hi all,

Its my first time dealing with groovy and Ive been assigned to reproduce in groovy an example (100% working in pure java)  wich involves reference to an external ws and a component with its implementation in groovy but it doesnt work :( Im using the tuscany java 1.6

The several files in the example are given next:

SCA Composite file

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
	xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
	targetNamespace="http://www.mathertel.de/OrteLookupSample" name="ortelookup">
	<component name="OrtelookupServiceComponent">
		<tuscany:implementation.script script="ortelookup/groovy/OrtelookupServiceComponent.groovy" />
		<reference name="orteLookupSoap">
			 <interface.java interface="ortelookup.groovy.OrteLookupSoap"/>
			<binding.ws
				wsdlElement="http://www.mathertel.de/OrteLookup/#wsdl.port(OrteLookup/OrteLookupSoap)"
				uri="http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx" />
		</reference>
	</component>
</composite>

Inteface like this:

@Remotable
@WebService(name = "orteLookupSoap", targetNamespace = "http://www.mathertel.de/OrteLookup/")
public interface OrteLookupSoap {

    @WebMethod(operationName = "OrteStartWith", action = "http://www.mathertel.de/OrteLookup/OrteStartWith")
     public String orteStartWith(String prefix);

    @WebMethod(operationName = "GetPrefixedEntries", action = "http://www.mathertel.de/OrteLookup/GetPrefixedEntries")
     public String getPrefixedEntries(String prefix);

}

Component implementation in groovy :

package ortelookup.groovy;


import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;

@Service(OrteLookupSoap.class)
public class OrtelookupServiceComponent implements OrteLookupSoap {
	@Reference(name="orteLookupSoap", required=true)
	OrteLookupSoap orteLookupSoap;

	public OrteLookupSoap getOrteLookupSoap() {
        System.out.println("Got Injected OrteLookupSoap");
		return orteLookupSoap;
	}

	public void setOrteLookupSoap(OrteLookupSoap orteLookupSoap) {
        System.out.println("Injected OrteLookupSoap");
		this.orteLookupSoap = orteLookupSoap;
	}

	public String getPrefixedEntries(String prefix) {
		// TODO Auto-generated method stub
		return orteLookupSoap.getPrefixedEntries(prefix);
	}

	public String orteStartWith(String prefix) {
		// TODO Auto-generated method stub
		return orteLookupSoap.orteStartWith(prefix);
	}
}

And the Java SCA client

       	public static final void main(String[] args) throws Exception {

		SCADomain scaDomain = SCADomain.newInstance("ortelookup.composite");
		OrteLookupSoap lookupService =(OrteLookupSoap)scaDomain.getService(OrteLookupSoap.class, "OrtelookupServiceComponent");
		String  value = lookupService.orteStartWith("b");
		System.out.println (value);
		scaDomain.close();

	}

The result is a beautiful exception saying:

Caused by: java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.OrteStartWith() is applicable for argument types: (java.lang.String) values: [b]
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:358)
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeFunction(GroovyScriptEngineImpl.java:159)
	at org.apache.tuscany.sca.implementation.script.ScriptInvoker.doInvoke(ScriptInvoker.java:60)
	at org.apache.tuscany.sca.implementation.script.ScriptInvoker.invoke(ScriptInvoker.java:76)
	at org.apache.tuscany.sca.extension.helper.impl.ImplementationImplementationProvider$InvokerProxy.invoke(ImplementationImplementationProvider.java:90)
	at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
	at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
	at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:349)
	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
	... 11 more

Please, any little suggestion will be appreciated



RE: Error with tuscany 1.6, component implementation in groovy with ws reference

Posted by Eneko Fernández <en...@dunait.es>.
Thanks Raymond,

Ive changed to orteStartWith and I get something similar:

Caused by: java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.orteStartWith() is applicable for argument types: (java.lang.String) values: [b]
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:358)
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeFunction(GroovyScriptEngineImpl.java:159)
	at org.apache.tuscany.sca.implementation.script.ScriptInvoker.doInvoke(ScriptInvoker.java:60)
	at org.apache.tuscany.sca.implementation.script.ScriptInvoker.invoke(ScriptInvoker.java:76)
	at org.apache.tuscany.sca.extension.helper.impl.ImplementationImplementationProvider$InvokerProxy.invoke(ImplementationImplementationProvider.java:90)
	at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
	at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
	at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:349)
	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
	... 2 more

Now the interface looks like:

@WebService(name = "orteLookupSoap", targetNamespace = "http://www.mathertel.de/OrteLookup/")
public interface OrteLookupSoap {

	@WebMethod(operationName = "orteStartWith", action = "http://www.mathertel.de/OrteLookup/OrteStartWith")
	public String orteStartWith(String prefix);

	@WebMethod(operationName = "getPrefixedEntries", action = "http://www.mathertel.de/OrteLookup/GetPrefixedEntries")
	public String getPrefixedEntries(String prefix);

}

Thanks,

Eneko
________________________________________
De: Raymond Feng [cyberfeng@gmail.com]
Enviado el: martes, 01 de junio de 2010 19:00
Para: user@tuscany.apache.org
Asunto: Re: Error with tuscany 1.6, component implementation in groovy with ws reference

It seems that there is a method name mismatch.

 @WebMethod(operationName = "OrteStartWith", action = "http://www.mathertel.de/OrteLookup/OrteStartWith")
    public String orteStartWith(String prefix);

You try to customize the operation name to be OrteStartWith for the method named as orteStartWith. Can you try the same name for now?

Thanks,
Raymond
________________________________________________________________
Raymond Feng
rfeng@apache.org<ma...@apache.org>
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________

On Jun 1, 2010, at 3:07 AM, Eneko Fernández wrote:

Hi all,

Its my first time dealing with groovy and Ive been assigned to reproduce in groovy an example (100% working in pure java)  wich involves reference to an external ws and a component with its implementation in groovy but it doesnt work :( Im using the tuscany java 1.6

The several files in the example are given next:

SCA Composite file

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
targetNamespace="http://www.mathertel.de/OrteLookupSample" name="ortelookup">
<component name="OrtelookupServiceComponent">
<tuscany:implementation.script script="ortelookup/groovy/OrtelookupServiceComponent.groovy" />
<reference name="orteLookupSoap">
<interface.java interface="ortelookup.groovy.OrteLookupSoap"/>
<binding.ws
wsdlElement="http://www.mathertel.de/OrteLookup/#wsdl.port(OrteLookup/OrteLookupSoap)"
uri="http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx" />
</reference>
</component>
</composite>

Inteface like this:

@Remotable
@WebService(name = "orteLookupSoap", targetNamespace = "http://www.mathertel.de/OrteLookup/")
public interface OrteLookupSoap {

   @WebMethod(operationName = "OrteStartWith", action = "http://www.mathertel.de/OrteLookup/OrteStartWith")
    public String orteStartWith(String prefix);

   @WebMethod(operationName = "GetPrefixedEntries", action = "http://www.mathertel.de/OrteLookup/GetPrefixedEntries")
    public String getPrefixedEntries(String prefix);

}

Component implementation in groovy :

package ortelookup.groovy;


import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;

@Service(OrteLookupSoap.class)
public class OrtelookupServiceComponent implements OrteLookupSoap {
@Reference(name="orteLookupSoap", required=true)
OrteLookupSoap orteLookupSoap;

public OrteLookupSoap getOrteLookupSoap() {
       System.out.println("Got Injected OrteLookupSoap");
return orteLookupSoap;
}

public void setOrteLookupSoap(OrteLookupSoap orteLookupSoap) {
       System.out.println("Injected OrteLookupSoap");
this.orteLookupSoap = orteLookupSoap;
}

public String getPrefixedEntries(String prefix) {
// TODO Auto-generated method stub
return orteLookupSoap.getPrefixedEntries(prefix);
}

public String orteStartWith(String prefix) {
// TODO Auto-generated method stub
return orteLookupSoap.orteStartWith(prefix);
}
}

And the Java SCA client

       public static final void main(String[] args) throws Exception {

SCADomain scaDomain = SCADomain.newInstance("ortelookup.composite");
OrteLookupSoap lookupService =(OrteLookupSoap)scaDomain.getService(OrteLookupSoap.class, "OrtelookupServiceComponent");
String  value = lookupService.orteStartWith("b");
System.out.println (value);
scaDomain.close();

}

The result is a beautiful exception saying:

Caused by: java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.OrteStartWith() is applicable for argument types: (java.lang.String) values: [b]
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:358)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeFunction(GroovyScriptEngineImpl.java:159)
at org.apache.tuscany.sca.implementation.script.ScriptInvoker.doInvoke(ScriptInvoker.java:60)
at org.apache.tuscany.sca.implementation.script.ScriptInvoker.invoke(ScriptInvoker.java:76)
at org.apache.tuscany.sca.extension.helper.impl.ImplementationImplementationProvider$InvokerProxy.invoke(ImplementationImplementationProvider.java:90)
at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:349)
at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
... 11 more

Please, any little suggestion will be appreciated




Re: Error with tuscany 1.6, component implementation in groovy with ws reference

Posted by Raymond Feng <cy...@gmail.com>.
It seems that there is a method name mismatch.

>  @WebMethod(operationName = "OrteStartWith", action = "http://www.mathertel.de/OrteLookup/OrteStartWith")
>     public String orteStartWith(String prefix);

You try to customize the operation name to be OrteStartWith for the method named as orteStartWith. Can you try the same name for now?

Thanks,
Raymond
________________________________________________________________ 
Raymond Feng
rfeng@apache.org
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________

On Jun 1, 2010, at 3:07 AM, Eneko Fernández wrote:

> Hi all,
> 
> Its my first time dealing with groovy and Ive been assigned to reproduce in groovy an example (100% working in pure java)  wich involves reference to an external ws and a component with its implementation in groovy but it doesnt work :( Im using the tuscany java 1.6
> 
> The several files in the example are given next:
> 
> SCA Composite file
> 
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> 	xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
> 	targetNamespace="http://www.mathertel.de/OrteLookupSample" name="ortelookup">
> 	<component name="OrtelookupServiceComponent">
> 		<tuscany:implementation.script script="ortelookup/groovy/OrtelookupServiceComponent.groovy" />
> 		<reference name="orteLookupSoap">
> 			 <interface.java interface="ortelookup.groovy.OrteLookupSoap"/>
> 			<binding.ws
> 				wsdlElement="http://www.mathertel.de/OrteLookup/#wsdl.port(OrteLookup/OrteLookupSoap)"
> 				uri="http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx" />
> 		</reference>
> 	</component>
> </composite>
> 
> Inteface like this:
> 
> @Remotable
> @WebService(name = "orteLookupSoap", targetNamespace = "http://www.mathertel.de/OrteLookup/")
> public interface OrteLookupSoap {
> 
>    @WebMethod(operationName = "OrteStartWith", action = "http://www.mathertel.de/OrteLookup/OrteStartWith")
>     public String orteStartWith(String prefix);
> 
>    @WebMethod(operationName = "GetPrefixedEntries", action = "http://www.mathertel.de/OrteLookup/GetPrefixedEntries")
>     public String getPrefixedEntries(String prefix);
> 
> }
> 
> Component implementation in groovy :
> 
> package ortelookup.groovy;
> 
> 
> import org.osoa.sca.annotations.Reference;
> import org.osoa.sca.annotations.Service;
> 
> @Service(OrteLookupSoap.class)
> public class OrtelookupServiceComponent implements OrteLookupSoap {
> 	@Reference(name="orteLookupSoap", required=true)
> 	OrteLookupSoap orteLookupSoap;
> 
> 	public OrteLookupSoap getOrteLookupSoap() {
>        System.out.println("Got Injected OrteLookupSoap");
> 		return orteLookupSoap;
> 	}
> 
> 	public void setOrteLookupSoap(OrteLookupSoap orteLookupSoap) {
>        System.out.println("Injected OrteLookupSoap");
> 		this.orteLookupSoap = orteLookupSoap;
> 	}
> 
> 	public String getPrefixedEntries(String prefix) {
> 		// TODO Auto-generated method stub
> 		return orteLookupSoap.getPrefixedEntries(prefix);
> 	}
> 
> 	public String orteStartWith(String prefix) {
> 		// TODO Auto-generated method stub
> 		return orteLookupSoap.orteStartWith(prefix);
> 	}
> }
> 
> And the Java SCA client
> 
>       	public static final void main(String[] args) throws Exception {
> 
> 		SCADomain scaDomain = SCADomain.newInstance("ortelookup.composite");
> 		OrteLookupSoap lookupService =(OrteLookupSoap)scaDomain.getService(OrteLookupSoap.class, "OrtelookupServiceComponent");
> 		String  value = lookupService.orteStartWith("b");
> 		System.out.println (value);
> 		scaDomain.close();
> 
> 	}
> 
> The result is a beautiful exception saying:
> 
> Caused by: java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.OrteStartWith() is applicable for argument types: (java.lang.String) values: [b]
> 	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:358)
> 	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeFunction(GroovyScriptEngineImpl.java:159)
> 	at org.apache.tuscany.sca.implementation.script.ScriptInvoker.doInvoke(ScriptInvoker.java:60)
> 	at org.apache.tuscany.sca.implementation.script.ScriptInvoker.invoke(ScriptInvoker.java:76)
> 	at org.apache.tuscany.sca.extension.helper.impl.ImplementationImplementationProvider$InvokerProxy.invoke(ImplementationImplementationProvider.java:90)
> 	at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
> 	at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
> 	at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:349)
> 	at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
> 	... 11 more
> 
> Please, any little suggestion will be appreciated
> 
>