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

Ask Your Question
0

argument type mismatch exception

hi all, im trying to add some objects to a partitioned space but when i write my first object to space i get this error: ... ... Caused by: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.j_spaces.core.introspect.PojoIntrospector.setValue(SourceFile:299) at com.j_spaces.core.introspect.PojoIntrospector.setID(SourceFile:73) ... 35 more

files are:

pojo, Message.java:

package com.poc.roundtrip;

import com.gigaspaces.annotation.pojo.SpaceClass; import com.gigaspaces.annotation.pojo.SpaceId; import com.gigaspaces.annotation.pojo.SpaceRouting;

@SpaceClass public class Message { public Integer id;

public Integer partitionKey;

public Integer remotePartitionKey;

public Message(){

}

public Message(Integer partitionKey, Integer remotePartitionKey) {
    this.partitionKey = partitionKey;
    this.remotePartitionKey = remotePartitionKey;
}

@SpaceRouting
public Integer getPartitionKey() {
    return partitionKey;
}

public void setPartitionKey(Integer partitionKey) {
    this.partitionKey = partitionKey;
}

public Integer getRemotePartitionKey() {
    return remotePartitionKey;
}

public void setRemotePartitionKey(Integer remotePartitionKey) {
    this.remotePartitionKey = remotePartitionKey;
}

@SpaceId(autoGenerate=true)
public Integer getId() {
    return id;
}

public void setId(Integer id) {
    this.id = id;
}

}

Feeder.java

package com.poc.roundtrip;

import org.openspaces.core.GigaSpace;

public class Feeder {

private GigaSpace space;

public Feeder(GigaSpace space){
    this.space = space;
}

public void start() throws Exception {
    for(int i=0; i < 10; i++){
        System.out.println("Feeder writes " + i);
        Message msg = new Message(i, i*10);
        space.write(msg);
    }
}

}

pu.xml

http://www.springframework.org/schema... http://www.openspaces.org/schema/core http://www.openspaces.org/schema/core... http://www.openspaces.org/schema/events http://www.openspaces.org/schema/even... http://www.openspaces.org/schema/sla http://www.openspaces.org/schema/sla/...>

<bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" /> 

<os-core:space id="roundtripPOC" url="jini://*/*/TrainingSpace" lookup-groups="${LOOKUPGROUPS}" />

<os-core:giga-space id="gigaspace" space="roundtripPOC" />

<bean id="feeder" class="com.poc.roundtrip.Feeder" init-method="start">
    <constructor-arg index="0" ref="gigaspace" ></constructor-arg>
</bean>

<bean id="msg" class="com.poc.roundtrip.Message" />

</beans>

And i run the space using this commands (4 seperated command lines): 1. gsInstance "/./TrainingSpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=1" 2. gsInstance "/./TrainingSpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=1&backup_id=1" 3. gsInstance "/./TrainingSpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=2" 4. gsInstance "/./TrainingSpace?cluster_schema=partitioned-sync2backup&total_members=2,1&id=2&backup_id=1"

do you know what seems to be the problem? h4. Attachments

[deployed_feeder_folder.zip|/upfiles/13759716959598434.zip]

[src.zip|/upfiles/13759716953714934.zip]

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2520]{quote}

asked 2008-08-07 05:16:26 -0600

sabag2 gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Hi,

Please change to:

@SpaceId(autoGenerate=true)
    public String getId() {
        return id;
}

This is something that we're aware of and we'll fix it soon.

Cheers,
Guy

Attachments

  1. deployedfeederfolder.zip
  2. src.zip

answered 2008-08-07 05:31:19 -0600

nirpaz gravatar image
edit flag offensive delete link more

Comments

Hi, It did solve the problem... but now when im adding a polling-container i get another exception, can you tell me why?

I added this to the pu.xml:

<bean id="eater" class="com.poc.roundtrip.Eater" ><="" bean="">

<os-events:polling-container id="eaterPoller" giga-space="gigaspace" concurrent-consumers="3" max-concurrent-consumers="5" >="" <os-core:template="" ref="msg"/> <os-events:listener> <os-events:method-adapter method-name="pollMessage"> <os-events:delegate ref="eater"/> </os-events:method-adapter> </os-events:listener> </os-events:polling-container>

and this is the Eater.java class: package com.poc.roundtrip;

public class Eater { public Eater(){ System.out.println("Eater started!"); }

public void pollMessage(Message msg){
    System.out.println("pollMessage");
}

public void notifyMessage(Message msg){
    System.out.println("notifyMessage");
}

}

this is the exception i get:

SEVERE [org.openspaces.events.polling.SimplePollingEventListenerContainer]: [eaterPoller] Setup of event listener invoker failed - trying to recover org.openspaces.core.UncategorizedSpaceException: Broadcast is not supported for Read/Take Operations with timeout greater than 0. Operation description: class='com.poc.roundtrip.Message', operation=take, routing index field='partitionKey', transaction=null, timeout=60000 Operation requires broadcast to all partitions based on: configuration: <broadcast-condition>routing-index-is-null</broadcast-condition> and operation data: <routing index="" field="" 'partitionkey'="" is="" null="" >="" ;="" nested="" exception="" is="" com.gigaspaces.cluster.loadbalance.exception.loadbalanceexception:="" broadcast="" is="" not="" supported="" for="" read="" take="" operations="" with="" timeout="" greater="" than="" 0.="" operation="" description:="" class="com.poc.roundtrip.Message" ,="" operation="take," routing="" index="" field="partitionKey" ,="" transaction="null," timeout="60000" operation="" requires="" broadcast="" to="" all="" partitions="" based="" on:="" configuration:="" <broadcast-condition="">routing-index-is-null</broadcast-condition> and operation data: <routing index="" field="" 'partitionkey'="" is="" null="" ><="" p="">

at org.openspaces.core.exception.DefaultExceptionTranslator.translate(DefaultExceptionTranslator.java:50)
at org.openspaces.core.DefaultGigaSpace.take(DefaultGigaSpace.java:273)
at org.openspaces.events.polling.receive.SingleTakeReceiveOperationHandler.doReceiveBlocking(SingleTakeReceiveOperationHandler.java:34)
at org.openspaces.events.polling.receive.AbstractNonBlockingReceiveOperationHandler.receive(AbstractNonBlockingReceiveOperationHandler.java:60)
at org.openspaces.events.polling.AbstractPollingEventListenerContainer.receiveEvent(AbstractPollingEventListenerContainer.java:410)
at org.openspaces.events.polling.AbstractPollingEventListenerContainer.doReceiveAndExecute(AbstractPollingEventListenerContainer.java:335)
at org.openspaces.events.polling.AbstractPollingEventListenerContainer.receiveAndExecute(AbstractPollingEventListenerContainer.java:330)
at org.openspaces.events.polling.SimplePollingEventListenerContainer$AsyncEventListenerInvoker.invokeListener(SimplePollingEventListenerContainer.java:676)
at org.openspaces.events.polling.SimplePollingEventListenerContainer$AsyncEventListenerInvoker.run(SimplePollingEventListenerContainer.java:617)
at java.lang.Thread.run(Thread.java:595)

Caused by: com.gigaspaces.cluster.loadbalance.exception.LoadBalanceException: Broadcast is not supported for Read/Take Operations with timeout greater than 0. Operation description: class='com.poc.roundtrip.Message', operation=take, routing index field='partitionKey', transaction=null, timeout=60000 Operation requires broadcast to all partitions based on: configuration: <broadcast-condition>routing-index-is-null</broadcast-condition> and operation data: <routing index="" field="" 'partitionkey'="" is="" null="" ><="" p="">

at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.getFieldBasedHashValueAbs(SourceFile:1597)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberHashBased_pos(SourceFile:1354)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberHashBased(SourceFile:1286)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.getNextFromPolicy(SourceFile:974)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberForOperationMain(SourceFile:377)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberForOperation(SourceFile:209)
at com.j_spaces.core.cluster.JSpaceClusteredProxy.selectMember(SourceFile:1338)
at com.j_spaces.core.cluster.JSpaceClusteredProxy.getLBRemoteJSpace(SourceFile:1240)
at com.j_spaces.core.cluster.JSpaceClusteredProxy.prepareForMethodCall(SourceFile:962)
at com.j_spaces.core.cluster.JSpaceClusteredProxy.readBasic(SourceFile:1834)
at com.j_spaces.core ...
(more)
sabag2 gravatar image sabag2  ( 2008-08-07 07:52:42 -0600 )edit

Since we do not support (yet - will be supported via async take with 6.6) blocking read/take (timeout >0) with remote partitioned space when the routing field = null - You will need to use non blocking take operation or batch take. http://www.gigaspaces.com/wiki/displa...

  _pollingContainer = new SimplePollingContainerConfigurer(_serviceSpace).template(template).eventListenerAnnotation(this).receiveTimeout(1000).pollingContainer();
    SingleTakeReceiveOperationHandler handler = new SingleTakeReceiveOperationHandler();
    handler.setNonBlocking(true);
    _pollingContainer.setReceiveOperationHandler(handler);

Shay h4. Attachments

[deployed_feeder_folder.zip|/upfiles/13759716967165503.zip]

[src.zip|/upfiles/13759716969086703.zip]

shay hassidim gravatar image shay hassidim  ( 2008-08-07 16:35:55 -0600 )edit

but my routing field is not null, as you can see in the Feeder.java, i initialize it with a int.

am i missing something in your explaination? h4. Attachments

[deployed_feeder_folder.zip|/upfiles/13759716961821224.zip]

[src.zip|/upfiles/13759716965868524.zip]

sabag2 gravatar image sabag2  ( 2008-08-10 06:46:00 -0600 )edit

The message shows you got null as part of the routing field within the template object:
"operation data: <routing index field 'partitionKey' is null >"

Shay

Attachments

  1. deployedfeederfolder.zip
  2. src.zip
shay hassidim gravatar image shay hassidim  ( 2008-08-10 07:49:44 -0600 )edit

hi shay,
i know what is written in the message :)

but if you'll check my code (Feeder.java)
you would notice that im initializing the partition key before writing it to the space

....
Message msg = new Message(i, i*10);
...

so, there are two options:
1) i don't initialize the partition key well. (if im missing something in the code do tell me)
2) the error message is wrong.

what do you say?

Avi.

Attachments

  1. deployedfeederfolder.zip
  2. src.zip
sabag2 gravatar image sabag2  ( 2008-08-11 05:20:15 -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: 2008-08-07 05:16:26 -0600

Seen: 532 times

Last updated: Aug 07 '08