Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

RemoteService Proxy creation error

Hi,

I've run into a problem following the guide here: http://docs.gigaspaces.com/xap101/executor-based-remoting.html

I can export my RemoteService fine using the specified configuration, my problem occurs when trying to create the service proxy object in a separate client PU. I follow the namespace config defined here in my PU.xml: http://docs.gigaspaces.com/xap101/executor-based-remoting.html#using-the-service-on-the-client-side

I can see that this is due to not having an exporter defined in the local context, but I thought the Exporter is only required on the Server side when deploying the Space + RemoteService implementation?

I receive the following stacktrace:

2015-08-28 11:29:06,857 GSC INFO [com.gigaspaces.grid.gsc] - Instantiating clientPU [1]
2015-08-28 11:29:11,933 clientPU [1] INFO [com.sun.jini.mahalo.startup] - Started Mahalo (duration=0.036): com.sun.jini.mahalo.TransientMahaloImpl@72e0454c
2015-08-28 11:29:12,199 GSC SEVERE [com.gigaspaces.grid.gsc] - Failed to instantiate clientPU [1]; Caused by: org.jini.rio.core.JSBInstantiationException: java.lang.IllegalArgumentException: No service exporters are defined within the context, can't register remote service bean [myRemoteServiceImpl]
    at org.openspaces.remoting.RemotingAnnotationBeanPostProcessor.postProcessAfterInitialization(RemotingAnnotationBeanPostProcessor.java:90)

My SpacePU xml:

<!-- Support @RemotingService component scanning -->
<context:component-scan base-package="com.mycompany.api.remote"/>        

<!-- Support the @RemotingService annotation on a service-->
<os-remoting:annotation-support />  

<!-- A bean representing a space (an IJSpace implementation). -->
<os-core:space id="mySpace" url="/./mySpace" />    

<os-remoting:service-exporter id="serviceExporter" />

My ClientPU xml:

<!-- Defines a distributed Jini transaction manager. -->
    <os-core:distributed-tx-manager id="myTxManager" default-timeout="15" >
        <os-core:renew pool-size="1" duration="1000" round-trip-time="500" />        
    </os-core:distributed-tx-manager>

    <!-- Creates an OpenSpaces proxy for the specified url. This is versioned for optimistic locking. -->
    <os-core:space id="mySpace" url="${url}" versioned="true"/>

    <!-- Creates a GigaSpaces proxy -->
    <os-core:giga-space id="myGigaSpace" space="mySpace" tx-manager="myTxManager" />     

<!-- Construct a local proxy of the deployed @RemoteService -->
    <os-remoting:executor-proxy id="remoteService" giga-space="myGigaSpace" 
        interface="com.myCompany.api.remote.MyRemoteService" >
    </os-remoting:executor-proxy>    

    <!-- Set the API's reference to the @RemoteService -->
    <bean id="remoteServiceWrapper" class="com.myCompany.api.remote.RemoteServiceReference">
        <property name="myRemoteService" ref="remoteService" />
    </bean>

asked 2015-08-28 05:13:47 -0600

jmg gravatar image

updated 2015-08-28 05:20:53 -0600

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

Yes, you are correct. Let's take a step back for a second. The message is saying you can't register a remote service bean. Why does the client PU think it's trying to register a remote service bean? Is your remote service implementation being packaged in the the client PU? The remote service implementation should only be on the space itself. Also in the client pu.xml, what is the value that is being picked up by ${url}, can you try hard-coding a url to see what happens? Make sure you are using the jini:// format since you are a remote client here. Hope this helps, Dixson

answered 2015-08-28 13:27:59 -0600

Dixson Huie gravatar image
edit flag offensive delete link more

Comments

"Why does the client PU think it's trying to register a remote service bean? Is your remote service implementation being packaged in the the client PU? The remote service implementation should only be on the space itself."

You hit the nail on the head there, my clientPU was scanning the same package as the spacePU for certain API references. I excluded my RemotingService from this scan using an exclude-filter and everything worked fine. I suppose the clientPU was trying to export a RemoteService while processing the annotation. I might just remove the @RemoteService annotation and wire it up the old-fashioned way to prevent this problem in future.

Thank you.

jmg gravatar imagejmg ( 2015-08-28 15:01:45 -0600 )edit
1

Please make sure that you have annotated the RemoteServerReference with the executorproxy annotation.

From the docs: http://docs.gigaspaces.com/xap101/exe... public class DataRemoting {

@ExecutorProxy
private IDataProcessor dataProcessor;

// ...

}

So yours will look like:

public class RemoteServerReference

@ExecutorProxy private MyRemoteService myRemoteService

answered 2015-08-28 10:05:11 -0600

Dixson Huie gravatar image
edit flag offensive delete link more

Comments

But isn't that just setting the proxy reference through an Annotation rather than the xml based way I'm currently using:

<bean id="remoteServiceWrapper" class="com.myCompany.api.remote.RemoteServiceReference"> <property name="myRemoteService" ref="remoteService" /> </bean>

jmg gravatar imagejmg ( 2015-08-28 10:11:09 -0600 )edit
1

Yes, you are correct. Let's take a step back for a second. The message is saying you can't register a remote service bean. Why does the client PU think it's trying to register a remote service bean? Is your remote service implementation being packaged in the the client PU? The remote service implementation should only be on the space itself. Also in the client pu.xml, what is the value that is being picked up by ${url}, can you try hard-coding a url to see what happens? Make sure you are using the jini:// format since you are a remote client here. Hope this helps, Dixson

Dixson Huie gravatar imageDixson Huie ( 2015-08-28 11:17:00 -0600 )edit

"Why does the client PU think it's trying to register a remote service bean? Is your remote service implementation being packaged in the the client PU? The remote service implementation should only be on the space itself."

You hit the nail on the head there, my clientPU was scanning the same package as the spacePU for certain API references. I excluded my RemotingService from this scan using an exclude-filter and everything worked fine. I suppose the clientPU was trying to export a RemoteService while processing the annotation. I might just remove the @RemoteService annotation and wire it up the old-fashioned way to prevent this problem in future.

Thank you.

EDIT: Add your comment above as a full answer if you wish and I'll mark it correct.

jmg gravatar imagejmg ( 2015-08-28 11:34:34 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-28 05:13:47 -0600

Seen: 1,202 times

Last updated: Aug 28 '15