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

Ask Your Question
0

Gigaspaces with persistency & Hibernate

Hi, I'm trying to configure GG to work with Hibernate and Oracle for testing, can someone tell me why GG returns this error when i'm trying to deploy a pu? the hibernate jar are located in <gigaspaces_home>/lib/jdbc (also i've tried to put them in <gigaspaces_home>/lib/ext).

Exception : 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.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308) at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:948) at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:702) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:378) at org.openspaces.pu.container.integrated.IntegratedProcessingUnitContainerProvider.createContainer(IntegratedProcessingUnitContainerProvider.java:237) at org.openspaces.pu.container.servicegrid.PUServiceBeanImpl.startPU(PUServiceBeanImpl.java:205) at org.openspaces.pu.container.servicegrid.PUServiceBeanImpl.advertise(PUServiceBeanImpl.java:120) at org.jini.rio.resources.servicecore.ServiceAdminImpl.advertise(ServiceAdminImpl.java:214) 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.gigaspaces.lrmi.DynamicSmartStub._invoke(SourceFile:208) at com.gigaspaces.lrmi.DynamicSmartStub.invokeDirect(SourceFile:290) at com.gigaspaces.lrmi.DynamicSmartStub.invoke(SourceFile:348) at $Proxy13.advertise(Unknown Source) at org.jini.rio.resources.servicecore.ServiceAdminProxy.advertise(ServiceAdminProxy.java:114) at org.jini.rio.cybernode.ServiceBeanLoader.advertise(ServiceBeanLoader.java:452) at org.jini.rio.cybernode.ServiceBeanLoader.advertise(ServiceBeanLoader.java:413) at org.jini.rio.cybernode.JSBDelegate.advertise(JSBDelegate.java:339) at org.jini.rio.cybernode.JSBContainer.activate(JSBContainer.java:194) at org.jini.rio.cybernode.CybernodeImpl.instantiate(CybernodeImpl.java:999) 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.obf.ne.a(SourceFile:332) at com.j_spaces.obf.hq.a(SourceFile:437) at com.j_spaces.obf.hq.a(SourceFile:525) at com.j_spaces.obf.ov.work(SourceFile:174) at com.j_spaces.obf.od.a(SourceFile:211) at com.j_spaces.obf.od.dispatch(SourceFile:201) at com.j_spaces.obf.de.run(SourceFile:62) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595)

Thanks, Oded.

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

asked 2008-07-30 06:52:59 -0500

maimonoded 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
0

U should place these jars under the PU folder/lib.

Shay Sent from my BlackBerry® smartphone with SprintSpeed

answered 2008-07-30 07:08:49 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

getting the same exception

maimonoded gravatar imagemaimonoded ( 2008-07-30 07:12:27 -0500 )edit

Can you post the list of files and folders you have under your PU folder?

Shay

shay hassidim gravatar imageshay hassidim ( 2008-07-30 11:24:00 -0500 )edit

Hi Shai B. Thanks, you are right, I forgot to copy the dependencies, but same error even after I've copied the files.

I've tried saving the files in: GG/lib/jdbc GG/lib/ext GG/deploy/myproject/lib

and nothing works, getting same error:

Exception : 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.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at ... ...

Here is my pu.xml file:

http://www.springframework.org/schema... http://www.openspaces.org/schema/corehttp://www.openspaces.org/schema/core...http://www.openspaces.org/schema/eventshttp://www.openspaces.org/schema/even...http://www.openspaces.org/schema/remo...http://www.openspaces.org/schema/remo...http://www.openspaces.org/schema/slahttp://www.openspaces.org/schema/sla/...>

<os-sla:sla cluster-schema="myclusterschema" number-of-instances="1" number-of-backups="1" max-instances-per-vm="1">
</os-sla:sla>

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@orcl"/>
    <property name="username" value="scott"/>
    <property name="password" value="tiger"/>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="mappingResources">
        <list>
        <!-- this list maps tables to entities in hibernate, each entity has its own file -->
            <value>Emp.hbm.xml</value>
            <value>Dept.hbm.xml</value>
            <value>Bonus.hbm.xml</value>
            <value>Salgrade.hbm.xml</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
            <prop key="hibernate.cache.use_second_level_cache">false</prop>
            <prop key="hibernate.cache.use_query_cache">false</prop>
            <prop key="hibernate.hbm2ddl.auto">update</prop>
        </props>
    </property>
</bean>

<bean id="hibernateDataSource" class="org.openspaces.persistency.hibernate.DefaultHibernateExternalDataSource">
    <property name="sessionFactory" ref="sessionFactory"/>
    <!-- initialloadbatchsize - lazyload -->
    <property name="initialLoadBatchSize" value="20000"/>    
</bean>

<os-core:space id="space" url="/./project" schema="persistent" external-data-source="hibernateDataSource">
    <os-core:properties>
        <props>
            <!-- external-data-source - load data from external datasource -->
            <prop key="cluster-config.cache-loader.external-data-source">true</prop>                
            <!-- central-data-source is when all spaces write to the same single databases -->
            <prop key="cluster-config.cache-loader.central-data-source">true</prop>
        </props>
    </os-core:properties>
</os-core:space>

</beans>

thanks, Oded.

maimonoded gravatar imagemaimonoded ( 2008-08-03 03:32:50 -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

Stats

Asked: 2008-07-30 06:52:59 -0500

Seen: 51 times

Last updated: Aug 08 '13