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

Ask Your Question
0

NoClassDefFoundError on deploying Mirror service

I'm deploying the Mirror service with mvn os:deploy and get NoClassDefFoundError at the GSC for org/hibernate/Session.

This happens both when I include the Hibernate jar 'hibernate-3.2.6.ga.jar' which gets included with the Maven dependency

<dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate</artifactid> <version>3.2.6.ga</version> </dependency>

This jar includes the org.hibernate.Session class.

However the gigaspaces-xap-6.5-m11/lib/hibernate/hibernate3.jar also includes the org.hibernate.Session , but I don't know if the GSC has it in its classpath.

This is my 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/...>

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

    <bean id="hsqlServerFactory" class="com.gigaspaces.training.HSQLServerBeanFactory" />

    <bean id="hsqlServer" class="org.hsqldb.Server" factory-bean="hsqlServerFactory" factory-method="getInstance" />

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" depends-on="hsqlServer" 
   destroy-method="close">
        <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
        <property name="url" value="jdbc:hsqldb:hsql://localhost:9001"/>
        <property name="username" value="sa"/>
        <property name="password" value=""/>
    </bean>

  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="mappingResources">
            <list>
                <value>se/jayway/gsdemo/common/Product.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</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="com.gigaspaces.datasource.hibernate.HibernateDataSource">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <os-core:space id="space" url="/./mirror-service?schema=mirror"
            external-data-source="hibernateDataSource" lookup-groups="gigaspaces-xap-6.5-m11" >
    </os-core:space>

</beans>

This is (part of) the console output from the GSC on deployment:

SEVERE [org.jini.rio.monitor]: Provisioning Error! org.jini.rio.core.JSBInstantiationException: org.jini.rio.core.JSBControlException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'space': 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: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/Session 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:217) 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:236) 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:597) 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:597) at com.j_spaces.obf.mz.a(SourceFile:332) at com.j_spaces.obf.hm.a(SourceFile:430) at com.j_spaces.obf.hm.a(SourceFile:518) at com.j_spaces.obf.oo.work(SourceFile:174) at com.j_spaces.obf.ny.a(SourceFile:211) at com.j_spaces.obf.ny.dispatch(SourceFile:201) at com.j_spaces.obf.db.run(SourceFile:62) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDataSource' defined in resource loaded from byte array: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/Session

What am I doing wrong?

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

asked 2008-05-29 03:55:05 -0600

niklasuhrberg gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

Hi Niklas,

We have a new template of the mirror as part of 6.5 rc1.
The template name is called (-Dtemplate=) basic-async-persistency. Simply run mvn os:create to list all available templates.

Cheers,
Guy

answered 2008-06-01 15:59:00 -0600

nirpaz gravatar image
edit flag offensive delete link more
0

OK, if I put the Hibernate jar file in the folder shared-lib instead of lib the error doesn't occur.

So, now the question becomes: How should I use Maven to get this correct automatically?

My PU layout as created by mvn os:deploy doesn't even contain a 'shared-lib' folder.

Edited by: Niklas Uhrberg on May 29, 2008 6:50 AM

answered 2008-05-29 04:27:30 -0600

niklasuhrberg gravatar image
edit flag offensive delete link more

Comments

Yes, I have used the template and indeed a 'shared-lib' folder gets created with e.g. 'mvn package'.

See /[/question/6252/maven-and-lookup-groups/]&tstart=0 for a related question and let's start a new thread on the subject of what dependencies get in 'lib' vs 'shared-libs' folder.

This thread is continued in /[/question/6239/os-maven-plugin-dependencies-and-lib-folders/]

Edited by: Niklas Uhrberg on Jun 2, 2008 8:47 AM

niklasuhrberg gravatar image niklasuhrberg  ( 2008-06-02 08:41:25 -0600 )edit
0

This thread is contimued in //question/6239/os-maven-plugin-dependencies-and-lib-folders/

(Not yet fully answered yet)

answered 2008-06-02 08:48:24 -0600

niklasuhrberg gravatar image
edit flag offensive delete link more

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-05-29 03:55:05 -0600

Seen: 127 times

Last updated: Jun 02 '08