首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

SSH框架下项目发布时Tomacat就报错。百度好久不能解决。解决方法

2013-09-11 
SSH框架下项目发布时Tomacat就报错。百度好久不能解决。急。。。[color#FF0000]启动Tomcat的时候就报错。。。。。求

SSH框架下项目发布时Tomacat就报错。百度好久不能解决。急。。。
[color=#FF0000]启动Tomcat的时候就报错。。。。。求好心人帮忙。。。。急需! 提示如下:[/color]

Java code
。。。。。严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'costService' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [financesj.center.service.CostServiceImpl]: Is it an abstract class?; nested exception is java.lang.InstantiationException    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)    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:222)    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.preInstantiateSingletons(DefaultListableBeanFactory.java:429)    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)    at org.apache.catalina.core.StandardService.start(StandardService.java:516)    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)    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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [financesj.center.service.CostServiceImpl]: Is it an abstract class?; nested exception is java.lang.InstantiationException    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:103)    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)    ... 40 moreCaused by: java.lang.InstantiationException    at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)    ... 42 more2011-12-21 10:55:51 org.apache.catalina.core.StandardContext start严重: Error listenerStart2011-12-21 10:55:51 org.apache.catalina.core.StandardContext start严重: Context [/Financesj] startup failed due to previous errors2011-12-21 10:55:51 org.apache.catalina.core.ApplicationContext log信息: Closing Spring root WebApplicationContextlog4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).log4j:WARN Please initialize the log4j system properly.2011-12-21 10:55:52 org.apache.catalina.core.ApplicationContext log信息: Initializing Spring root WebApplicationContext2011-12-21 10:55:52 org.apache.catalina.loader.WebappClassLoader loadClass信息: Illegal access: this web application instance has been stopped already.  Could not load java.net.BindException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.java.lang.IllegalStateException    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)    at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:155)    at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2652)    at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:1345)    at com.mysql.jdbc.Connection.realClose(Connection.java:4784)    at com.mysql.jdbc.Connection.cleanup(Connection.java:2040)    at com.mysql.jdbc.Connection.finalize(Connection.java:3296)    at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)    at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)    at java.lang.ref.Finalizer.access$100(Finalizer.java:14)    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)2011-12-21 10:55:52 org.apache.catalina.loader.WebappClassLoader loadClass信息: Illegal access: this web application instance has been stopped already.  Could not load com.mysql.jdbc.Util.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.java.lang.IllegalStateException    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)    at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:180)    at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2652)    at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:1345)    at com.mysql.jdbc.Connection.realClose(Connection.java:4784)    at com.mysql.jdbc.Connection.cleanup(Connection.java:2040)    at com.mysql.jdbc.Connection.finalize(Connection.java:3296)    at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)    at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)    at java.lang.ref.Finalizer.access$100(Finalizer.java:14)    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)log4j:WARN No appenders could be found for logger (com.opensymphony.xwork2.config.providers.XmlConfigurationProvider).log4j:WARN Please initialize the log4j system properly.log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).log4j:WARN Please initialize the log4j system properly.2011-12-21 10:55:58 org.apache.catalina.core.ApplicationContext log信息: Initializing Spring root WebApplicationContext2011-12-21 10:56:02 org.apache.coyote.http11.Http11Protocol start信息: Starting Coyote HTTP/1.1 on http-80802011-12-21 10:56:02 org.apache.jk.common.ChannelSocket init信息: JK: ajp13 listening on /0.0.0.0:80092011-12-21 10:56:02 org.apache.jk.server.JkMain start信息: Jk running ID=0 time=0/16  config=null2011-12-21 10:56:02 org.apache.catalina.startup.Catalina start信息: Server startup in 22574 ms 





[解决办法]
<bean id="costService" class="financesj.center.service.CostServiceImpl">
financesj.center.service.CostServiceImpl
 首先确保路径正确
根据提示,
这个service 是抽象类
报了 nested exception is java.lang.InstantiationException
建议用接口 然后再注入,应该就没问题了

[解决办法]
顺序错了。应该先dao注入sessionfactory,随后service注入dao
XML code
<!-- Service层的Bean定义 --><bean id="costService" class="financesj.center.service.CostServiceImpl"><property name="costDAO"><ref bean="costDAO" /></property><property name="userDAO"><ref bean="userDAO" /></property></bean><!-- DAO层的Bean定义 --><bean id="costDAO" class="financesj.center.dao.CostDAOImpl"><property name="sessionFactory"><ref bean="sessionFactory" /></property></bean><bean id="userDAO" class="financesj.center.dao.UserDAOImpl"><property name="sessionFactory"><ref bean="sessionFactory" /></property></bean>
[解决办法]
自己把报错信息看清楚,
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'costService' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [financesj.center.service.CostServiceImpl]: Is it an abstract class?; nested exception is java.lang.InstantiationException

 Could not instantiate bean class [financesj.center.service.CostServiceImpl]: Is it an abstract class?; 
确认下这个类是不是抽象类,
[解决办法]
'costService' 有问题啊你看下你的Service啊 确认下这个类是不是抽象类, 

[解决办法]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'costService' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [financesj.center.service.CostServiceImpl]: Is it an abstract class?; nested exception is java.lang.InstantiationException


检查一下你的financesj.center.service.CostServiceImpl这个对象。看是否是抽象类。
[解决办法]
楼上正解

热点排行