qq_38711872
qq_38711872
2019-07-28 15:28
采纳率: 9.1%
浏览 693
已采纳

哪位大神帮我解决一下eclipse运行突然报404,好像是spring配置文件有问题

七月 28, 2019 2:17:54 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:xuexiao' did not find a matching property.
七月 28, 2019 2:17:54 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MyHRSht' did not find a matching property.
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/8.5.34
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Sep 4 2018 22:28:22 UTC
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 8.5.34.0
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 10
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 10.0
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\Program Files\Java\jre1.8.0_201
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_201-b09
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: E:\apache-tomcat-8.5.34-myeclipse
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=E:\apache-tomcat-8.5.34-myeclipse
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=E:\apache-tomcat-8.5.34-myeclipse\endorsed
七月 28, 2019 2:17:54 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=UTF-8
七月 28, 2019 2:17:54 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_201\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_201/bin/server;C:/Program Files/Java/jre1.8.0_201/bin;C:/Program Files/Java/jre1.8.0_201/lib/amd64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_201\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\申红涛\AppData\Local\Microsoft\WindowsApps;;E:\eclipse;;.]
七月 28, 2019 2:17:55 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-nio-8083"]
七月 28, 2019 2:17:56 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
七月 28, 2019 2:17:57 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-nio-8039"]
七月 28, 2019 2:17:57 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
七月 28, 2019 2:17:57 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2984 ms
七月 28, 2019 2:17:57 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service [Catalina]
七月 28, 2019 2:17:57 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.5.34
七月 28, 2019 2:18:15 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
七月 28, 2019 2:18:15 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
七月 28, 2019 2:18:15 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
七月 28, 2019 2:20:49 下午 org.apache.ibatis.mapping.VendorDatabaseIdProvider getDatabaseId
严重: Could not get a databaseId from dataSource
java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseProductName(VendorDatabaseIdProvider.java:76)
at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseName(VendorDatabaseIdProvider.java:61)
at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseId(VendorDatabaseIdProvider.java:49)
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:395)
at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:295)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
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:567)
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:4792)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1420)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
... 29 more

七月 28, 2019 2:20:50 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'springmvc'
七月 28, 2019 2:21:10 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
七月 28, 2019 2:21:10 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
七月 28, 2019 2:21:10 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2019-07-28 14:21:13 Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\xuexiao\WEB-INF\classes\springconfig\common.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [dao/*.xml]: ServletContext resource [/dao/] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
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:567)
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:4792)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1420)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [dao/*.xml]: ServletContext resource [/dao/] cannot be resolved to URL because it does not exist
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:490)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 20 more
Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [dao/*.xml]: ServletContext resource [/dao/] cannot be resolved to URL because it does not exist
at org.springframework.core.io.support.ResourceArrayPropertyEditor.setAsText(ResourceArrayPropertyEditor.java:135)
at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:434)
at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:406)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:163)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
... 26 more
七月 28, 2019 2:21:13 下午 org.apache.catalina.core.StandardContext listenerStart
严重: 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 'sqlSessionFactory' defined in file [E:\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\xuexiao\WEB-INF\classes\springconfig\common.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [dao/*.xml]: ServletContext resource [/dao/] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
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:567)
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:4792)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1420)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.core.io.Resource[]' for property 'mapperLocations'; nested exception is java.lang.IllegalArgumentException: Could not resolve resource location pattern [dao/*.xml]: ServletContext resource [/dao/] cannot be resolved to URL because it does not exist
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:490)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 20 more
Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [dao/*.xml]: ServletContext resource [/dao/] cannot be resolved to URL because it does not exist
at org.springframework.core.io.support.ResourceArrayPropertyEditor.setAsText(ResourceArrayPropertyEditor.java:135)
at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:434)
at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:406)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:163)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
... 26 more

七月 28, 2019 2:21:13 下午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
七月 28, 2019 2:21:13 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/xuexiao] startup failed due to previous errors
七月 28, 2019 2:21:13 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
七月 28, 2019 2:21:14 下午 org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
严重: The web application [xuexiao] created a ThreadLocal with key of type java.lang.ThreadLocal and a value of type java.lang.Class but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
七月 28, 2019 2:21:14 下午 org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
严重: The web application [xuexiao] created a ThreadLocal with key of type java.lang.ThreadLocal and a value of type java.lang.Class but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
七月 28, 2019 2:21:14 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-8083"]
七月 28, 2019 2:21:14 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-nio-8039"]
七月 28, 2019 2:21:14 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 197051 ms

web.xml

<?xml version="1.0" encoding="UTF-8"?>

SpringMybatisOa
<!-- dwr -->

dwr_invoker
org.directwebremoting.servlet.DwrServlet

crossDomainSessionSecurity
false


debug
true



dwr_invoker
/dwre/*


encodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8


forceEncoding
true



encodingFilter
.action


contextConfigLocation
classpath:springconfig/



org.springframework.web.context.ContextLoaderListener

<servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet> 
<servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.action</url-pattern> 
</servlet-mapping> 


index.html
index.htm
index.jsp
default.html
default.htm
default.jsp

spring.xml

<?xml version="1.0" encoding="UTF-8"?>
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">

<bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations" value="classpath:jdbc.properties"></property>


destroy-method="close">













<!-- 自动扫描mapping.xml文件 -->










springmvc.xml

<?xml version="1.0" encoding="UTF-8"?>
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">

mvc:annotation-driven/<!-- 启动注解方式的mvc -->
<!-- 扫描该包下所有类加载到容器 -->

class="org.springframework.web.servlet.view.UrlBasedViewResolver">




  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dabocaiqq
    dabocaiqq 2019-07-28 16:25
    已采纳

    1、eclipse中配置好tomcat服务器后,启动tomcat查看控制台信息显示启动成功,
    但访问tomcat首页报404异常

    2、而从tomcat/bin目录中启动后,就能够正常访问首页,由此分析应该是eclipse配置错误

    正确配置如下:
    双击Server中配置的Tomcat服务器

    在Server Locations配置中选择第二个选项,use tomcat installation ,保存,重新启动Tomcat服务,访问成功

    点赞 评论
  • hjs218
    Json-Huang 2019-07-28 15:57

    1、确认下是否有jdbc.properties这个文件?没有的话获取不到数据库连接的配置;
    2、spring.xml是不是只复制了一部分bean配置,里面还需要有类似如下的配置(只列举一部分):

    <bean id="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
          init-method="init" destroy-method="close">
        <!-- 数据库连接配置 -->
        <property name="url" value="${jdbc.url}" />
        <property name="driver" value="${jdbc.driver}" />
        <property name="usrname" value="${jdbc.usrname}" />
        <property name="pwd” value="${jdbc.pwd}" />
    </bean>
    
    点赞 评论
  • u013254183
    老铁咖啡 2019-07-28 16:06

    Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException:
    A ResourcePool could not acquire a resource from its primary factory or source.

    可能出错的地方
    1.驱动配置有误:driver=com.mysql.jdbc.Driver
    2.数据库连接地址有误:url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8
    3.密码或帐号有误:username=root password=root
    4.数据库未启动或无权访问
    5.项目未引入对应的数据库驱动
    6.mysql root没有远程访问的权限,需要增加权限

    点赞 评论

相关推荐