I have to finish my homework this week to build a web site based on the SSH framework(my version:struts2 spring3.1.1 hibernate4.1.4). So I used the MyEclipse (2015 CI) to rewrite the struts2 project I've finished before, for the use of the site, everything is going well, until I imported the framework of spring (using MyProject->MyEclipse->Project Facets->Install Spring Facet to import). Now when I open ANY JSP pages in MyEclipse, console will display context:
Exception to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name'transactionManager'defined in class path resource [applicationContext.xml] of init method: Invocation failed; nested exception is org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]. MyEclipse Web Browser shows that this page cannot be found.
Later, I tried to write a Hello-world project that would work properly, so it shouldn't be a server problem (I'm using MyEclipseTomcat 7.0). My whole project code is here. And the complete information in Console is as follows:
June 23, 2017 11:56:20 afternoon org.apache.catalina.core.AprLifecycleListener init Information: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\Program Files\myeclipse\binary\com.sun.java.jdk7.win32.x86_64_1.7.0.u45\bin;C:\WINDOWS\Sun\Java\bin;C:\Program Files (x86)\Java\jdk1.8.0_91\bin;.
June 23, 2017 11:56:20 afternoon org.apache.tomcat.util.digester.SetPropertiesRule begin Warning: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:TestSystem_2143521' did not find a matching property.
June 23, 2017 11:56:20 afternoon org.apache.tomcat.util.digester.SetPropertiesRule begin Warning: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FileUploadAndDownLoad' did not find a matching property.
June 23, 2017 11:56:21 afternoon org.apache.coyote.AbstractProtocol init Information: Initializing ProtocolHandler ["http-bio-8880"]
June 23, 2017 11:56:21 afternoon org.apache.coyote.AbstractProtocol init Information: Initializing ProtocolHandler ["ajp-bio-8009"]
June 23, 2017 11:56:21 afternoon org.apache.catalina.startup.Catalina load Information: Initialization processed in 957 ms
June 23, 2017 11:56:21 afternoon org.apache.catalina.core.StandardService startInternal Information: Starting service Catalina
June 23, 2017 11:56:21 afternoon org.apache.catalina.core.StandardEngine startInternal Information: Starting Servlet Engine: Apache Tomcat/7.0.30
June 23, 2017 11:56:24 afternoon org.apache.catalina.startup.TaglibUriRule body Information: TLD skipped. URIhttp://www.springframework.org/tags/form is already defined
June 23, 2017 11:56:24 afternoon org.apache.catalina.startup.TaglibUriRule body Information: TLD skipped. URIhttp://www.springframework.org/tags is already defined
June 23, 2017 11:56:24 afternoon org.apache.catalina.core.ApplicationContext log Information: No Spring WebApplicationInitializer types detected on classpath
June 23, 2017 11:56:24 afternoon org.apache.catalina.core.ApplicationContext log Information: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN Seehttp://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
June 23, 2017 11:56:26 afternoon org.apache.catalina.core.StandardContext listenerStart
Severe: 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 'transactionManager' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
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.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.unwrap(DriverManagerConnectionProviderImpl.java:91)
at org.springframework.orm.hibernate4.SessionFactoryUtils.getDataSource(SessionFactoryUtils.java:101)
at org.springframework.orm.hibernate4.HibernateTransactionManager.afterPropertiesSet(HibernateTransactionManager.java:264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 21 more
June 23, 2017 11:56:26 afternoon org.apache.catalina.core.StandardContext startInternal
Severe: Error listenerStart
June 23, 2017 11:56:26 afternoon org.apache.catalina.core.StandardContext startInternal
Severe: Context [/TestSystem] startup failed due to previous errors June 23, 2017 11:56:26 afternoon org.apache.catalina.core.ApplicationContext log Information: Closing Spring root WebApplicationContext
June 23, 2017 11:56:26 afternoon org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
Severe: The web application [/TestSystem] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
June 23, 2017 11:56:26 afternoon org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/TestSystem] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
June 23, 2017 11:56:27 afternoon org.apache.coyote.AbstractProtocol start Information: Starting ProtocolHandler ["http-bio-8880"]
June 23, 2017 11:56:27 afternoon org.apache.coyote.AbstractProtocol start Information: Starting ProtocolHandler ["ajp-bio-8009"]
June 23, 2017 11:56:27 afternoon org.apache.catalina.startup.Catalina start
Information: Server startup in 6302 ms