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

Ask Your Question
0

Persistent Read/Write through configuration issues

I'm trying to start a persistent space to enable read/write through data grid. I have all the necessary Spring configurations defining a data source, session factory and the space.

When I try to start the space and provide the following properties...

space-config.persistent.enabled=true space-config.persistent.StorageAdapterClass=com.j_spaces.sadapter.datasource.DataAdapter space-config.external-data-source.data-source-class=com.gigaspaces.datasource.hibernate.HibernateDataSource space-config.engine.cache_policy=0

I get the following error...

org.jini.rio.core.JSBInstantiationException: org.jini.rio.core.JSBControlException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'space': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/Session Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session

Somehow org.hibernate.Session class is not included in the classpath, although the lib/hibernate dir in the install directory has the hibernate3.jar. Although setenv.sh seems to set HIBERNATE_JARS I can't seem how I would add it to the classpath of the container or space when I start that space. Also, I added the hibernate jars to the ext directory, just to see if that will work, but then it's complaining about the lack of...

org/dom4j/DocumentException

Either way, I'm just looking for documentation and/or comments on how to start a gsm/gsc and deploy a persistent space. The documentation out there goes over the configuration, but nothing states anything about setting the classpath and where is the best place to do so.

Ilya h4. Attachments

[pu.xml|/upfiles/13759721038239283.xml]

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

asked 2008-03-08 15:56:36 -0600

isterin 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

Use the jars from :
\GigaSpacesXAP6.0.3\examples\Advanced\Data_Grid\Database-Integration\lib

You can download the full examples package from:
http://www.gigaspaces.com/wiki/display/GS6/GigaSpacesStarterExamples

See simple Read/Write Through example at:
\GigaSpacesXAP6.0.3\examples\Advanced\Data_Grid\Database-Integration\HibernateDataSource

See the relevant jars the above example use at:
\GigaSpacesXAP6.0.3\examples\Advanced\Data_Grid\Database-Integration\HibernateDataSource\bin\setExampleEnv.bat/sh

See example Read/Write Through examples page:
http://www.gigaspaces.com/wiki/display/OLH/Read-ThroughandWrite-ThroughExamples

See more here:
http://www.gigaspaces.com/wiki/display/GS6/GigaSpacesforHibernateORMUsers#GigaSpacesforHibernateORMUsers-HowtoAddtheGigaSpacesDataGrid

Shay

Attachments

  1. pu.xml

answered 2008-03-08 16:33:38 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Shay, thanks for the quick reply. I looked at the examples. I still can't really get how the application is launched. The start scripts all seem to use the SpaceLauncher class which basically uses SpaceFinder to locate a space url. I can't seem to understand at which point is the gsm, gsc deployed and how does the actual PU get's deployed. Maybe I'm missing something?

Here is my dilemma. I have a working PU. Well, it worked before I decided to make it access a persistent embedded space. I need to basically read/write objects to this space, which in turn is a read/write through for hibernate related datasource. I'm using hibernate annotations, though most of your examples seem to be using the arcane way of using hibernate (before JPA spec). I'm sure there are still folks that use hibernate mapping files for persistence, but I doubt new projects are utilizing it.

Either way, I have all the dependencies for this PU copied to deploy/pu_name/shared-libs directory. This includes the dom4j lib. But when I try to deploy that pu, I get the below error. I'm attaching my pu.xml file as well, so that you can see how things are configured...

Is the shared-lib dir a part of the pu startup classpath? Or is it only used for runtime or is a part of a different classloader than is used to actually init the space?

########org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'athletes': Cannot resolve reference to bean 'hibernateDataSource' while setting bean property 'externalDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDataSource' defined in resource loaded from byte array: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource loaded from byte array: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDataSource' defined in resource loaded from byte array: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource loaded from byte array: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource loaded from byte array: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException Caused by: org.springframework.beans.BeanInstantiationException ...(more)

isterin gravatar imageisterin ( 2008-03-08 17:08:34 -0600 )edit

It seems that the problem is with the directory name. It should be deploy/pu_name/shared-lib instead of deploy/pu_name/shared-libs.

For further information you can use :

[ http://gigaspaces.com/wiki/display/GS... ]

anna pavtulov gravatar imageanna pavtulov ( 2008-03-10 04:03:02 -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-03-08 15:56:36 -0600

Seen: 104 times

Last updated: Mar 08 '08