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

Ask Your Question

LoadBalanceException - routing index field is not defined in class

Hi all, i'm trying to launch my Gigaspaces application, this are the most important parts of it:

Class: DroolsEmployee

public class DroolsEmployee {

final private Employee employee;

private Integer id;

public DroolsEmployee (final Employee employee) {
this.employee = employee;
this.id = employee.getId();

public DroolsEmployee () {
this.employee = null;

public Integer getId() {
return this.id;


File 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/remo... http://www.openspaces.org/schema/remo... http://www.openspaces.org/schema/sla http://www.openspaces.org/schema/sla/...>

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

    Defines a local Jini transaction manager (will be used for transactional operations with the space).
<os-core:local-tx-manager id="transactionManager" space="space"/>

    A wrapper bean to the space to provide OpenSpaces simplified space API (built on top of IJSpace/JavaSpace).
<os-core:giga-space id="gigaSpace" space="space" tx-manager="transactionManager"/>

    The processor bean
<bean id="Processor" class="it.reynholm.aeg.rem.Job"/>

<os-events:polling-container id="EmployeesPollingEventContainer" giga-space="gigaSpace" pass-array-as-is="true">
    <os-events:tx-support tx-manager="transactionManager"/>
        <bean class="org.openspaces.events.polling.receive.MultiTakeReceiveOperationHandler">
        <property name="maxEntries" value="100"/>

        <bean class="it.reynholm.aeg.rem.DroolsEmployee"/>
        <os-events:method-adapter method-name="processEmployees">
            <os-events:delegate ref="Processor"/>


Feeder class:

public class Feeder {

private JobConfiguration config;

private GigaSpace gigaSpace;

private final String SPACE_URL = "jini:/*/*/jobSpace";

public Feeder(JobConfiguration config) {
this.config = config;

IJSpace space = new UrlSpaceConfigurer(SPACE_URL).space();

this.gigaSpace = new GigaSpaceConfigurer(space).gigaSpace();

public void feed(int threads)
    throws IllegalArgumentException {

if(threads <= 0) {
    throw new IllegalArgumentException("At least one thread is needed to " +
        "do the work!");

// Prepare and start feeding threads
int employeesPerThread = config.getEmployees().size() / threads;
int employeesOnLastThread = employeesPerThread + 
    config.getEmployees().size() % threads;

// Start threads specifying which range of employees list to use
int start = 0;
for(int t = 0; t < threads - 1; t++) {
    new FeederThread(config.getEmployees(), start,
        start + employeesPerThread).start();
    start = start + employeesPerThread;
// And here the last thread
new FeederThread(config.getEmployees(), start, 
    start + employeesOnLastThread).start();

class FeederThread extends Thread {

ArrayList<SimpleEmployee> employees;
final int start,end;

public FeederThread(ArrayList<SimpleEmployee> employees, int start, int end) {
    this.employees = employees;
    this.start = start;
    this.end = end;

public void run() {

    // Feed my range of employees
    for(int i = start; i < end; i++) {

    SimpleEmployee e = employees.get(i); 

    // Fetch employee data for the whole period specified
    for (Date date : config.getPeriod()) {
        // Fetch Employee data for this day
        final Employee employee = EmployeeBuilder
        .getEmployeeByDate(e, date);

        // Wrap Employee info in a DroolsEmployee.
        // In the near future here we'll put DroolEmployees
        // into Gigaspaces space
        gigaSpace.write(new DroolsEmployee(employee));




And this are the errors i got when i try to launch a main that uses the Feeder class (and of course, the processing units are already deployed):

Exception in thread "Thread-6" org.openspaces.core.UncategorizedSpaceException: Broadcast is not supported for 'write' operation. Operation description: class='it.reynholm.aeg.rem.DroolsEmployee', operation=write, transaction=null Operation requires broadcast to all partitions based on: configuration: <broadcast-condition>routing-index-is-null</broadcast-condition> and operation data: <routing index="" field="" is="" not="" defined="" in="" class="" 'it.reynholm.aeg.rem.droolsemployee="" '="" >="" ;="" nested="" exception="" is="" com.gigaspaces.cluster.loadbalance.exception.loadbalanceexception:="" broadcast="" is="" not="" supported="" for="" 'write'="" operation.="" operation="" description:="" class="it.reynholm.aeg.rem.DroolsEmployee" ,="" operation="write," transaction="null" operation="" requires="" broadcast="" to="" all="" partitions="" based="" on:="" configuration:="" <broadcast-condition="">routing-index-is-null</broadcast-condition> and operation data: <routing index="" field="" is="" not="" defined="" in="" class="" 'it.reynholm.aeg.rem.droolsemployee="" '="" ><="" p="">

at org.openspaces.core.exception.DefaultExceptionTranslator.translate(DefaultExceptionTranslator.java:51)
at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:526)
at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:518)
at it.reynholm.aeg.rem.Feeder$FeederThread.run(Feeder.java:180)

Caused by: com.gigaspaces.cluster.loadbalance.exception.LoadBalanceException: Broadcast is not supported for 'write' operation. Operation description: class='it.reynholm.aeg.rem.DroolsEmployee', operation=write, transaction=null Operation requires broadcast to all partitions based on: configuration: <broadcast-condition>routing-index-is-null</broadcast-condition> and operation data: <routing index="" field="" is="" not="" defined="" in="" class="" 'it.reynholm.aeg.rem.droolsemployee="" '="" ><="" p="">

at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.getPOJOHashValue(LoadBalanceImpl.java:2216)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberHashBased_pos(LoadBalanceImpl.java:1140)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberHashBased(LoadBalanceImpl.java:1059)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.getNextFromPolicy(LoadBalanceImpl.java:763)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberForOperationMain(LoadBalanceImpl.java:319)
at com.gigaspaces.cluster.loadbalance.LoadBalanceImpl.selectMemberForOperation(LoadBalanceImpl.java:186)
at com.j_spaces.core.cluster.JSpaceClusteredProxy.selectMember(JSpaceClusteredProxy.java:1518)
at com.j_spaces.core.cluster.JSpaceClusteredProxy.getLBRemoteJSpace(JSpaceClusteredProxy.java:1362)
at com.j_spaces.core.cluster.JSpaceClusteredProxy.prepareForMethodCall(JSpaceClusteredProxy.java:1024)
at com.j_spaces.core.cluster.action.ClusterSpaceWriteActionListener.write(ClusterSpaceWriteActionListener.java:87)
at com.j_spaces.core.cluster.action.ClusterSpaceWriteActionListener.onAction(ClusterSpaceWriteActionListener.java:72)
at com.j_spaces.core.cluster.action.ClusterSpaceWriteActionListener.onAction(ClusterSpaceWriteActionListener.java:25)
at com.j_spaces.core.client.AbstractSpaceProxy.write(AbstractSpaceProxy.java:455)
at com.j_spaces.core.client.AbstractSpaceProxy.write(AbstractSpaceProxy.java:443)
at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:524)
... 2 more

I'm quite new to Gigaspaces, i looked for a solution but i'm unable to find it (even searching on this forum). This problem seems to me quite strange since the @SpaceRouting annotation is correctly placed, and it happens with all the cluster schemas.

I hope you'll answer me soon,


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

asked 2009-03-17 09:47:01 -0500

kappolo gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted


You must have a getter field annotated with @SpaceRouting as part of the space class (or have relevant tag at the gs.xml) and have this field set with a value before writing it into the space when running with partitioned cluster topology.

In many cases the ID field and the routing field should be different fields.

If the routing field is missing the ID field content is used to partition the data. This behavior might not what you want.


answered 2009-03-17 13:40:16 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Fixed using DroolsEmployee.gs.xml and writing the setter for the "id" field.

I think that the problem was exactly the setter absence.

answered 2009-03-17 12:03:23 -0500

kappolo gravatar image
edit flag offensive delete link more


Dear Shay,
as far as you can see in the code posted in the first post, the @SpaceRouting was properly placed.

kappolo gravatar imagekappolo ( 2009-03-17 14:11:16 -0500 )edit

Got it. Yes setter is needed.

shay hassidim gravatar imageshay hassidim ( 2009-03-17 18:45:12 -0500 )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


Asked: 2009-03-17 09:47:01 -0500

Seen: 48 times

Last updated: Mar 17 '09