Spring 与hibernate整合过程中出现的一些问题
2016-06-27 19:41
525 查看
第一个问题缺少jar包 org.springframework.orm-3.0.2.RELEASE.jar 出现如下错误:
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MySql': Cannot create inner bean '(inner bean)#2c8ae0e3' of type [org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl] while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2c8ae0e3': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean
class [org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:632)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1114)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1017)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1813)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2c8ae0e3': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class
[org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276)
... 30 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069)
... 34 more
Caused by: java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.oliot.epcis.serde.mysql.dao.actualdao.InfoDaoImpl.<init>(InfoDaoImpl.java:7)
at org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl.<init>(BaseServiceImpl.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
... 36 more
第二个问题:<aop:pointcut id="serviceOperation" expression="execution(*org.oliot.epcis.service.mysqlservice.BaseService.*(..))"/> 由于xecution(*org.oliot.epcis.service.mysqlservice.BaseService.*(..)) * 和org之间没有空格出现了
教训:对于以后的整合开发过程中,当发现基本的xml配置没有问题的时候,如果tomcat启动项目的时候仍然报错的时候,赶紧想想自己是不是缺少相应的jar包(百度找下各个jar包的作用)
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MySql': Cannot create inner bean '(inner bean)#2c8ae0e3' of type [org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl] while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2c8ae0e3': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean
class [org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:632)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1114)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1017)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1813)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#2c8ae0e3': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class
[org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276)
... 30 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069)
... 34 more
Caused by: java.lang.Error: Unresolved compilation problem:
The hierarchy of the type InfoDaoImpl is inconsistent
at org.oliot.epcis.serde.mysql.dao.actualdao.InfoDaoImpl.<init>(InfoDaoImpl.java:7)
at org.oliot.epcis.service.mysqlservice.impl.BaseServiceImpl.<init>(BaseServiceImpl.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
... 36 more
第二个问题:<aop:pointcut id="serviceOperation" expression="execution(*org.oliot.epcis.service.mysqlservice.BaseService.*(..))"/> 由于xecution(*org.oliot.epcis.service.mysqlservice.BaseService.*(..)) * 和org之间没有空格出现了
Pointcut is not well-formed: expecting 'name pattern' at character position 提示
教训:对于以后的整合开发过程中,当发现基本的xml配置没有问题的时候,如果tomcat启动项目的时候仍然报错的时候,赶紧想想自己是不是缺少相应的jar包(百度找下各个jar包的作用)
相关文章推荐
- JAVA虚拟机(JVM)和垃圾收集机制是什么
- java.net.BindException: 无法指定被请求的地址: Service 'sparkDriver' failed after 16 retries!
- 尚学堂所有Java视频下载
- 类文件及类加载机制
- 【Spring应用级学习】从Ioc开始
- Java_类文件及加载机制
- java函数回调
- Java获取当前时间的年月日方法
- Spring WebSocket初探2 (Spring WebSocket入门教程)<转>
- Spring WebSocket初探1 (Spring WebSocket入门教程)<转>
- JAVA位移运算符了解`<< >> >>>`
- 在Eclipse上搭建SSH框架(Struts 2.5.1 + Spring 4.3.0 + Hibernate 4.3.11)
- 文章标题
- [改善Java代码]不要在构造函数中抛出异常
- Java简单的泛型类和接口
- Java SE基础知识点总结(一)
- <context:component-scan/> <mvc:annotation-driven />
- 简单的邮件开发2--Java
- RXJava——线程控制 —— Scheduler (一)
- java运算符