File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes bean binding error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "bean binding error" Watch "bean binding error" New topic
Author

bean binding error

saravana kumar
Ranch Hand

Joined: Jun 25, 2002
Posts: 72
Hi All ,

i am getting the following error when binding a bean with another one.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXXDAO' defined in class path resource [com/xxxxxxxxxxx/xxxx/dataaccess/yyyyyyy/yyyyHibernateAppContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/hibernate/SessionFactory
java.lang.NoClassDefFoundError: net/sf/hibernate/SessionFactory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1784)
at java.lang.Class.getDeclaredMethods(Class.java:1244)
at java.beans.Introspector$1.run(Introspector.java:1144)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java:287)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1142)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1007)
at java.beans.Introspector.getBeanInfo(Introspector.java:388)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at java.beans.Introspector.getBeanInfo(Introspector.java:220)
at java.beans.Introspector.<init>(Introspector.java:369)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:150)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:87)
at org.springframework.beans.BeanWrapperImpl.setIntrospectionClass(BeanWrapperImpl.java:237)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:195)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:179)
at org.springframework.beans.BeanWrapperImpl.<init>(BeanWrapperImpl.java:132)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:362)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
at org.springframework.test.AbstractSpringContextTests.loadContextLocations(AbstractSpringContextTests.java:135)
at org.springframework.test.AbstractDependencyInjectionSpringContextTests.loadContextLocations(AbstractDependencyInjectionSpringContextTests.java:224)
at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:115)
at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:192)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


here is the declaration
<bean id="xxxxxxDAO" class="com.xxxxxxxx.xxxx.dataaccess.yyyyyyy.XXXXXDAO">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>


please guide me how to solve this issue. source and class file are in the same project.
Stu Thompson
Hooplehead
Ranch Hand

Joined: Jun 14, 2006
Posts: 136
You'll need to show us your sessionFactory bean definition too.


"This is not to say that design is unnecessary. But after a certain point, design is just speculation." --Philip Chu
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Without having all the information, here are a couple of guesses... Check that the hibernate jar is in the classpath or possibly you are using one of the newer versions of hibernate and should be referencing org.hibernate.SessionFactory as opposed to net.sf.hibernate.SessionFactory
 
 
subject: bean binding error