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

Ask Your Question

questions on com.j_spaces.obf.fi Exception, starting space in jboss jvm

I have a few questions on gigaspaces 6.0:
1) I am trying to write an EJB that writes to space a simple object that implements Entry interface and contains two strings. I can get the IJSpace object through the SpaceFinder.find() method, however, when calling
the IJSpace.write() method, a "java.lang.ClassCastException: com.j_spaces.obf.fi" exception is thrown (See attachment Exception.log for details). Note that the same code
succeeds if called from a main method (instead of ejb). I am using the following versions

1. GS 6.0
2. JBOSS 4.2.2
3. JDK 1.5

Jboss security policy:

i. Create server.policy file <jboss-root>\server\default\conf to grant all permissions.

ii. edit <jboss-root>\bin\run.bat and modifed JAVA_OPTS to:
set JAVAOPTS=%JAVAOPTS% -Dprogram.name=%PROGNAME% -Djava.security.manager -Djava.security.policy==C:\programs\jboss-4.2.2.GA\server\default\conf\server.policy -Djava.rmi.server.RMIClassLoaderSpi=default

2) How can a gigaspace instance and jboss server be started in a single jvm. Does the example "ReplicatedSessionBean.ear" start an embedded space within jboss jvm, as mentioned in the example documentation
?The jsp calls SpaceFinder.finder() and CacheFinder.find() which loads two embedded spaces.?
Does the example start a gigaspace instance itself, or does it have to be started manually before running the example.

3) Is there a Gigaspace 6.0 Manual?


  1. Exception.log

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2008-01-27 16:54:36 -0600

wasefmasood gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete


Hi, As Shay said, the starting point for you should be the [JBoss integration wiki page|http://www.gigaspaces.com/wiki/display/GS6/J2EE+JBoss+Integration+-+6.0] and [example|http://www.gigaspaces.com/wiki/display/GS6/J2EE+JBoss+ReplicatedSessionBean+Example+-+6.0]. Please build the ear and use it for reference how to write an EJB which starts an embedded instance (within JBoss VM). By changing the space url you can "ask" the EJB to connect to a remote (external to JBoss) space instance.

About the ClassCastException, please send us the Entry you write to space. Any chance you have added GigaSpaces jars into the JBoss classpath (can cause to Class loader hierarchy issues), or might be that you have different GigaSpaces version/build running in parallel on same subnet? What is the version and build you use within the JBoss? Can you send also the JBoss complete console?

?The jsp calls SpaceFinder.finder() and CacheFinder.find() which loads two embedded spaces.?

You are right, the example starts two spaces instances (inside the JBoss JVM), one using the SpaceFinder which returns the IJSpace for the Space API and another using CacheFinder which returns IMap for Map/JCache like API. Obviously it was only for the demonstration proposes and you can simply using the SpaceFinder.

Regards Gershon

gershond gravatar imagegershond ( 2008-01-28 00:22:41 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted

Two more questions on GS 6.0: 1. If there are several jboss instances running on different hosts with embedded space instances, how do you configure one space as the primary, and all other space instances as backups of the primary. Note that all applications write to the primary, and the the backups just pull(or get pushed) data from the primary space. I am looking for configuration details related to actual implementation in a step by step how-to, and links to examples appreciated. 2. If i need to update an entry instance in space using IJSpace.update(), how do I lock the entry instance.

Thanks, sm.

answered 2008-01-30 16:06:04 -0600

wasefmasood gravatar image
edit flag offensive delete link more


  1. By default you will have one space running in primary mode and the other running in backup mode. The spaces communicating via the lookup to determine who will be the primary space. In general the first one started will be the primary. You can't enforce a space to be a backup if there is no a primary running.

Please note that with the approach above one jboss instance will access its embedded space without any remote calls involved and the other one will perform remote calls when interacting with the primary space (running embedded within the first JBoss instance).

It sounds like you may need to have one jboss instance running the backup in a stand-by mode to switch into an active mode once there is a failover (JBoss instance running the primary space fails). Please note the SLA driver container where the business logic deployed into the GSC provides this capability out of the box.

  1. You should use transactions. The update call should use a transaction object. The object will be released once you commit the transaction. If your transaction involves multiple objects coming from multiple spaces (i.e partitions clustered space) you should use distributed transaction manager (mahalo). If it involves only a single space (i.e JBoss instance accessing only its embedded space) you should use local transaction manager. The local transaction manager is faster than the distributed one since the interaction within involves less remote calls.

Please note the timeout parameter as part of the update call is very important. This allows the client to wait a certain amount of time in case another client locking the entry.

You can use the GU-UI transactions view to see the existing transactions and their locked objects.


shay hassidim gravatar imageshay hassidim ( 2008-01-30 16:20:16 -0600 )edit

Please explain in more detail the following statement, especially the term "SLA-driven container", and how the jboss container can utilize it.
"Please note the SLA driver container where the business logic deployed into the GSC provides this capability out of the box"

wasefmasood gravatar imagewasefmasood ( 2008-01-30 21:25:00 -0600 )edit

GigaSpaces is a grid based transactional universal application server for real-time application based on Java, C++ and .Net.

GigaSpaces encapsulating messaging , event driven containers, caching and object and SQL in-memory-data-grid running as part of SLA-Driven container.

The SLA-Driven container is a lightweight spring container that provides self-healing and continuous availability capabilities. It is based on OGSI and Jini technologies.

You may deploy your business logic Java Bean/C++/.Net based classes into it and make these grid enabled without changing your application code using the OpenSpaces framework. As part of the development phase - you may run these as part of your favorite IDE or as part of the grid based environment.

The unit of scale called processing unit where this may include pure business logic , data grid instance or a mix of these - both running within the same process sharing the same memory address.

See more here: http://www.gigaspaces.com/wiki/displa...http://www.gigaspaces.com/wiki/displa...http://www.gigaspaces.com/wiki/displa...

In some cases the SLA-Driven container can be alternative to J2EE container allowing you distribute your application in better manner. In other cases the J2EE server acting as a client invoking functionality across the different nodes running within GigaSpaces. In most cases this is done via remoting. See: http://www.gigaspaces.com/wiki/displa...

You may also run the different OpenSpaces framework components as part of a web container see: http://www.gigaspaces.com/wiki/displa...


Edited by: Shay Hassidim on Feb 5, 2008 3:54 AM

shay hassidim gravatar imageshay hassidim ( 2008-01-30 21:49:14 -0600 )edit

Three questions : 1. Is there a rule of thumb for the timeoutValue for the call to ijSpace.read(template, transaction, timeoutValue)

Note that large values cause jboss to abort the transaction:

Eventually, the following error is shown by JBOSS: 2008-01-31 13:16:51,334 WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id a0a2e7b:747:47a20848:68 invoked while multiple threads active within it. 2008-01-31 13:16:51,334 WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action a0a2e7b:747:47a20848:68 aborting with 1 threads active!

  1. How to redirect GS output stream to not write to JBOSS errror stream, which causes GS INFO level messages logged as ERRORS in the server log eg: 2008-01-31 12:42:14,764 ERROR [STDERR] Jan 31, 2008 12:42:14 PM INFO [com.gigaspaces.container]: INFO [com.gigaspaces.container]: * Welcome to the GigaSpaces world ! - GigaSpaces Platform(TM) 6.0 XAP edition (build 2040) *

3.is there a recommended time or rule of thumb to set for leaseTime when creating transaction? I am constructing the TransactionManager using the following snippet: // create a local transaction manager TransactionManager trManager = LocalTransactionManager.getInstance(ijSpace);

    // create a transaction
      Transaction.Created tCreated = TransactionFactory.create(trManager, leaseTime);
      Transaction transaction = tCreated.transaction;

      return transaction;

Thanks, sm.

wasefmasood gravatar imagewasefmasood ( 2008-01-31 15:45:30 -0600 )edit
  1. Make it 5 seconds where the transaction timeout should be at least twice (10 sec). I do not think your transaction will be longer than 10 sec.
  2. check with support
  3. you can always renew the transaction lease using the Lease Renewal Manager. See the wiki for example how to use this client side utility.


shay hassidim gravatar imageshay hassidim ( 2008-01-31 15:53:50 -0600 )edit

New question asked. See post above.

Edited by: s m on Mar 27, 2008 3:07 PM

answered 2008-03-27 14:07:04 -0600

wasefmasood gravatar image
edit flag offensive delete link more


When using a transaction , the associated object is locked according the locking rules until the transaction is committed/aborted.

If you need to ?lock? the object for long duration , something that is beyond the boundary of a space transaction you will need to build a semaphore on top of the space ? i.e. use a space object that represent the lock. Any access to the relevant data requires the existence of this lock object to be in relevant state.


shay hassidim gravatar imageshay hassidim ( 2008-03-29 15:41:46 -0600 )edit
  1. Something is wrong with your Entry class implementation. Can you post it?
  2. run the space in embedded mode (JBoss and space running within the same JVM) : i.e. have the space URL to be: "/./mySpace" instead of accessing remote one : "jini:///mySpace"
  3. See: http://www.gigaspaces.com/wiki/displa... ? Manual http://www.gigaspaces.com/wiki/displa... ? Tutorial Shay

answered 2008-01-27 22:27:38 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Thanks for the suggestions: It was an issue with mixing versions 6.0.x (x<3) and 6.0.3. Some more questions 1. How is the version determined from a space installation (eg: <gs-root>/bin/gsIntance --version ?) 2. What is the workflow for the embedded space startup, i.e, is it right to assume the first call to SpaceFinder.find() method with url="/./mySpace" starts a space instance, and all subsequent calls return the previously started space instance, and if the space instance were to die in between one of the calls, then the next call to find() would automatically start a new instance. 3. Should space instances be "released", similar to JDBC connections. The ReplicatedSessionBean example holds a reference to the instance for the duration of the ejb's lifecycle, but I want to adopt a "i.getInstance ii. (read|write) iii. release instance" strategy for each service method. 4. I was looking for a pdf manual, but thanks for the links.

answered 2008-01-28 14:42:18 -0600

wasefmasood gravatar image
edit flag offensive delete link more


Hi, Im happy it solved your issues. About your questions: 1. You can run the +bin\PlatformInfo.bat which also prints the version and build. In 6.5 you will also see it as part of the instalation. 2. Correct, calling using SAME space url in embedded mode /./ or java:// to start a space, will use same proxy instance if exists already 3. The proxy does not have any "close" method, you simply leave it to the GC. 4. We plan to have a pdf offline copy of each major realease. Since the online wiki documentation is constantly being updated so it has an advantage over the the offline.. Any way try this one - it is on the lower right hand side on the [Wiki dashboard|http://www.gigaspaces.com/wiki/dashboard.action], see the manual in [PDF format |http://www.gigaspaces.com/docs/GigaSpaces60_Manual_Oct2007.pdf].

Regard Gershon

Edited by: Gershon Diner on Jan 28, 2008 11:17 PM

gershond gravatar imagegershond ( 2008-01-28 15:16:57 -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


Asked: 2008-01-27 16:54:36 -0600

Seen: 284 times

Last updated: Mar 27 '08