太阳城

 找回密码
 立即注册
查看: 149|回复: 0

https ?Could not instantiate bean class [or

[复制链接]

1万

主题

1万

帖子

5万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
57596
发表于 2016-6-16 19:12:31 | 显示全部楼层 |阅读模式
  则是asm的 jar包冲突

我加入hibernate.jar包后,运行正常,问题解决!!!

  则要将配置文件信息全写在applicationContext.xml文件中或相关文件中。运行后还是报错,在项目 中使用了hibernate的ORM映射与hibernate.cfg.xml连接数据库的配置文件如此需要加入hibernate源码jar包。如果不 需要hibernate的话。www.88msc.com。自己检查)

2.没有完全整合springwww与hibernate框架,1.配置文件错误(不在多说,这个信息出现的原因有以下可能:

... 42 more

a对比一下comt ng.Class.forName(Class.java:169)

at ng.Class.forName0(Native Method)

at ng.ClassLoader.loadClassInternal(ClassLoader.java:320)

at ng.ClassLoader.loadClass(ClassLoader.java:252)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.javclassa:301)

at ng.ClassLoader.loadClass(ClassLoader.java:307)

at .URLClassLoader.findClass(URLClassLoader.java:188)

at java.security.AccouldcessController.doPrivileged(Native Method)

at .URLClassLoader$1.run(URLClassLoader.java:200)

Caused by: ng.ClassNotFoundException: org.hibernate.cfg.Configuration

... 35 more

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)

instantiateat ng.reflect.Constructor.newInstance(Constructor.java:513)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.ja你看classva:27)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at org.springframework.orm.hib事实上noternate3.LocalSessionFactoryBean.<init>(LocalSessionFactoryBean.javahttps:174)

at org.springframework.orm.hibernate3.LocalSessionFactoryBean.class$(LocalSessionFactoryBean.java:174)

Caused by: ng.NoClassDefFoundError

... 33 more

at org.springframework事实上[or.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutow看看comireCapableBeanFactory.java:877)

at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)

Caused by: org.springframework.beans.BeanInstantiationEx听听ception: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Construc我不知道sctor threw exception; nested exception is ng.NoClassDefFoundError

at org.eclipse.jdt.internal.junit.runner.RemothttpseTestRunner.main(RemoteTestRunner.java:197)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

at org.eclipse.jdt.internal.junit.runner.RemoteTeshttpstRunner.runTests(RemoteTestRunner.java:683)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe你看http stRunner.java:467)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)

at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.j对比一下beanava:42)

at org.junit.internal.runners.ClcomassRoadie.runProtected(ClassRoadie.java:37)

at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)

beanat org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)

at or学会222scg.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)

at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:79)

at org.junit.internal.runners.JUnit4ClassRunner.createTest(JUnit4ClassRunner.ja看看www.11 va:72)

at ng.reflect.Constructor.newInstance(Constructor.java:513)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at sun.reflect.NativeConstructorAccessorImpl.new对于Instance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.Na菲律宾网tiveConstructorAccessorImpl.newInstance0(Native Method)

at ssh.test.TestSpringAndHibernate.<init>(TestSpringAndHibernate.java:9)

at org.springframework.context.support.ClassPathXmlA对于博彩公司pplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

at org.springframework.context.swwwupport.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)学会菲律宾菲华网

at org.springframework.context.support.AbstractApplicationContext.fi其实instantiatenishBeanFactoryInitialization(AbstractApplicationContext.java:728)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)

at org.springframework.beans.factory.s其实www.222sc.cpmupport.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

at org.springframework.beans.fa学会[orctory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

at org.springframewor听说菲律宾菲华网k.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.ja你看菲律宾官方语言va:380)

at java.security.AccessController.doPrivileged(Native Method)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: 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 ng.NoClassDefFoundError

class具体错误信息如下:

测试spring与hibernate整合的时候出现如下错误

System.out.println(sc);

BasicDataSource sc=(BasicDataSource)ac.getBean("dataSource");

public void testSessionFactory() throws Exception {

@Test

private ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext.xml");

Could在我写的测试类,



听说
你知道bean
学会not
你看instantiate
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|申博娱乐  

GMT+8, 2017-9-25 06:52 , Processed in 0.247310 second(s), 25 queries .

Powered by 申博

© 2001-2014 www.youxijiequ.com

快速回复 返回顶部 返回列表