首页 新闻 搜索 专区 学院

关于Spring,Springmvc,mybatis配置c3p0连接池出现Tomcat启动失败的问题,请大佬们帮帮小弟,,小弟不胜感激

0
悬赏园豆:100 [已解决问题] 解决于 2018-12-05 11:59

主要是配置mybatis引起的问题。。下面我将把我的各个配置发送过来。

项目结构

web.xml配置信息:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- 加载spring容器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-config.xml</param-value>
</context-param>
<!-- 加载spring mvc -->
<servlet>
<servlet-name>BookShop</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/springmvc-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>BookShop</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

spring-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee" 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/mvc
http://www.springframework.org/schema/mvc/spring-mvc.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">
<!-- 配置数据源(spring接管了mybatis的配置) -->
<!-- c3p0连接池 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!-- jdbc:mysql://localhost:3306/testdb -->
<!-- 本地数据库可以省略localhost:3306 -->
<property name="jdbcUrl" value="jdbc:mysql:///testdb"></property>
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="user" value="root"></property>
<property name="password" value="dba"></property>
<!-- 当连接池中的连接耗尽的时候c3p0一次同时获取的连接数,Default: 3 -->
<property name="acquireIncrement" value="3"></property>
<!-- 初始化时获取连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
<property name="initialPoolSize" value="10"></property>
<property name="minPoolSize" value="2"></property>
<property name="maxPoolSize" value="10"></property>
</bean>
<!-- sqlSessionFactory配置 (回忆一下mybatis编程,现在由spring注入) -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 注入数据库连接池 -->
<property name="dataSource" ref="dataSource" />
<!-- 加载mybatis-config配置 -->
<property name="configLocation" value="classpath:mybatis/mybatis-config.xml"></property>
</bean>
<!-- 配置mybatis mapper批量扫描 -->
<!-- 从basePackage指定的mapper包中扫描mapper类,自动生成bean -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 注入sqlSessionFactory -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
<property name="basePackage" value="mapper" />
</bean>
<!-- 事务配置(spring接管mybatis事务操作,如事务的提交、回滚、关闭等) -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 使用annotation注解方式配置事务 -->
<tx:annotation-driven transaction-manager="transactionManager" />
<!-- 自动扫描配置 -->
<!-- 在base-package包中扫描@Service、@Component注解的类, 并把这些类自动注册为bean 备注:@Controller放到spring
mvc扫描 -->
<context:component-scan base-package="service" />
<context:component-scan base-package="entity" />
</beans>

springmvc-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- 启用注解映射+json转换器 -->
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter" />
<bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 自动扫描 -->
<!-- spring mvc自动扫描base-pack下或子包下的@Controller注解的类,自动注册为bean 注:@Service、@Component一般放到spring配置文件中去扫描 -->
<context:component-scan base-package="controller" />
<!-- 视图解析路径配置 依赖jstl包 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="contentType" value="text/html" />
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<!-- 配置静态资源(JS、CSS、图片等)的访问路径 -->
<!--对location文件夹下内容的访问将不再被DispatcherServlet拦截 -->
<mvc:resources mapping="/gif/" location="/gif/" />
<mvc:resources mapping="/jquery/
" location="/jquery/" />
</beans>

mybatis-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis3-config.dtd">
<configuration>
<!-- 原先的配置基本都被spring接管 AOP厉害呀 -->
<!-- 别名配置 把entity包中简单类起个别名(如User类的别名就是user) -->
<typeAliases>
<package name="entity" />
</typeAliases>
</configuration>

pom.xml配置:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>yangxin</groupId>
<artifactId>BookShop</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>BookShop Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

    <!-- spring依赖 -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>5.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>5.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <version>5.0.2.RELEASE</version>
    </dependency>

    <!-- spring数据库事务处理 tomcat8.5居然不支持5.0.2.RELEASE事务 -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>4.3.9.RELEASE</version>
    </dependency>
    <!-- Spring对JDBC数据访问 同样tomcat8.5居然不支持5.0.2.RELEASE -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.3.9.RELEASE</version>
    </dependency>

    <!-- springmvc依赖 -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>5.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <!-- json依赖 -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.9.3</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.3</version>
    </dependency>
    <!-- mybatis依赖 -->
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>3.4.5</version>
    </dependency>
    <!-- mybatis-spring依赖 -->
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis-spring</artifactId>
        <version>1.3.1</version>
    </dependency>
    <!-- mysql驱动依赖 -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.45</version>
    </dependency>
    <!-- JDBC连接池依赖 -->
    <dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.5.2</version>
    </dependency>
</dependencies>
<build>
    <finalName>BookShop</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

</project>

下面是控制台报的错误

七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["http-nio-8080"]
七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["ajp-nio-8009"]
七月 10, 2018 10:37:41 上午 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service [Catalina]
七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["http-nio-8080"]
七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["ajp-nio-8009"]

但是本身不是这个问题,因为没有发现这个被占用的端口问题,在下实在找不出原因了,请大佬前辈们指点指点

轻抚丶两袖风尘的主页 轻抚丶两袖风尘 | 初学一级 | 园豆:59
提问于:2018-07-10 10:50
< >
分享
最佳答案
0

先去看看tomcat的日志

收获园豆:100
让我发会呆 | 老鸟四级 |园豆:2636 | 2018-07-10 11:08

七月 10, 2018 10:37:41 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:BookShop' did not find a matching property.
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/8.5.24
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Nov 27 2017 13:05:30 UTC
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 8.5.24.0
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 10
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 10.0
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\Program Files\Java\jdk1.8.0_161\jre
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_161-b12
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: H:\ApplicationPath\TomCat\apache-tomcat-8.5.24
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: H:\ApplicationPath\TomCat\apache-tomcat-8.5.24
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=H:\ApplicationPath\TomCat\apache-tomcat-8.5.24
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=H:\ApplicationPath\TomCat\apache-tomcat-8.5.24
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=H:\ApplicationPath\TomCat\apache-tomcat-8.5.24\webapps
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=H:\ApplicationPath\TomCat\apache-tomcat-8.5.24\endorsed
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
七月 10, 2018 10:37:41 上午 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\jdk1.8.0_161\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_161/bin/server;C:/Program Files/Java/jre1.8.0_161/bin;C:/Program Files/Java/jre1.8.0_161/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Microsoft MPI\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Java\jdk1.8.0_161\bin;C:\Program Files\Java\jdk1.8.0_161\jre\bin;H:\ApplicationPath\Java_Maven\apache-maven-3.5.2\bin;H:\ApplicationPath\Python;H:\ApplicationPath\Python\Scripts;H:\ApplicationPath\Python\Lib\site-packages\Django-2.0.1-py3.6.egg;C:\Program Files\MySQL\MySQL Utilities 1.6;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\GtkSharp\2.12\bin;H:\ApplicationPath\Github\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;H:\ApplicationPath\Unity3D_AR_Suppost\QTSystem;C:\Users\MACHENIKE\AppData\Local\Microsoft\WindowsApps;;H:\ApplicationPath\JavaEE_Eclipse\eclipse;;.]
七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-nio-8080"]
七月 10, 2018 10:37:41 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-nio-8009"]
七月 10, 2018 10:37:41 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 622 ms
七月 10, 2018 10:37:41 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service [Catalina]
七月 10, 2018 10:37:41 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.5.24
七月 10, 2018 10:37:41 上午 org.apache.catalina.core.ContainerBase startInternal
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/BookShop]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/BookShop]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@71dc36a7]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4860)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4995)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@50fb665f]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:142)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
... 12 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:734)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:434)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at sun.misc.IOUtils.readFully(IOUtils.java:65)
at java.util.jar.JarFile.getBytes(JarFile.java:425)
at java.util.jar.JarFile.getManifestFromReference(JarFile.java:193)
at java.util.jar.JarFile.getManifest(JarFile.java:180)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:140)
... 13 more

七月 10, 2018 10:37:41 上午 org.apache.catalina.core.ContainerBase startInternal
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:670)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more

七月 10, 2018 10:37:41 上午 org.apache.catalina.startup.Catalina start
严重: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.startup.Catalina.start(Catalina.java:670)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more

七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["http-nio-8080"]
七月 10, 2018 10:37:41 上午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["ajp-nio-8009"]
七月 10, 2018 10:37:41 上午 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service [Catalina]

轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 11:10

是这个吗

轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 11:10

@告辞丶菜鸡狗: 是的,然后根据里面的错误信息,可以自己尝试去网上找找有没有什么解决办法。

让我发会呆 | 园豆:2636 (老鸟四级) | 2018-07-10 11:14

@让我发会呆: 如果能找到解决,,我就不会这样问了。老铁。我是找了几天才无奈的寻求大家帮助的。

轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 11:44

@告辞丶菜鸡狗: 

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>
<charset>UTF-8</charset>
<server>tomcat7</server>
</configuration>
</plugin>

这个插件需要配置吧?
这种问题只能自己去尝试,因为可能和环境有很大关系:参考下吧https://www.cnblogs.com/EasonJim/p/6917587.html

让我发会呆 | 园豆:2636 (老鸟四级) | 2018-07-10 12:01
其他回答(2)
0

https://www.cnblogs.com/lujun1949/p/7044234.html 你看一下

番茄先生 | 园豆:911 (小虾三级) | 2018-07-10 11:17

谢谢,,感觉没有用

支持(0) 反对(0) 轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 11:44

@告辞丶菜鸡狗: 网上是将tomcat目录下webapps下的项目都删掉,重新部署,不知道你有没有试过

支持(0) 反对(0) 番茄先生 | 园豆:911 (小虾三级) | 2018-07-10 13:16

@番茄vs西红柿: 现在我发现是 <!-- mysql驱动依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>
这个依赖的问题。。,把他删除就能解决了
我现在也不知道是怎么回事了

支持(0) 反对(0) 轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 16:32

@告辞丶菜鸡狗: 你把版本改成5.4.41,可能是版本不兼容

支持(0) 反对(0) 番茄先生 | 园豆:911 (小虾三级) | 2018-07-10 16:42

@番茄vs西红柿: 还是不行,

支持(0) 反对(0) 轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 16:44

@告辞丶菜鸡狗: 那你看看你们服务器(你电脑本地)mysql的版本,然后对照设置一下,

支持(0) 反对(0) 番茄先生 | 园豆:911 (小虾三级) | 2018-07-10 16:47

@告辞丶菜鸡狗: https://my.oschina.net/vbird/blog/190588  你看一下能否解决你的问题

支持(0) 反对(0) 番茄先生 | 园豆:911 (小虾三级) | 2018-07-10 16:52
0

感觉像是jar包的原因

哎哟,不错哦 | 园豆:184 (初学一级) | 2018-07-10 14:00

<!-- mysql驱动依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>

这是我其中的一个包,删除就能解决问题,,但是我不想删啊

支持(0) 反对(0) 轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 16:33

@告辞丶菜鸡狗: 既然删掉能解决问题;问什么 不删?有其他影响?

支持(0) 反对(0) 哎哟,不错哦 | 园豆:184 (初学一级) | 2018-07-10 16:34

@哎哟,不错哦: 额,,我把mysql 的驱动依赖删除了,,那么我怎么使用数据库,,所以我想找删除之外的方法

支持(0) 反对(0) 轻抚丶两袖风尘 | 园豆:59 (初学一级) | 2018-07-10 16:41

@告辞丶菜鸡狗: 你把它删掉重新下载一遍看看 maven经常会出现jar包下载不完整的情况

支持(0) 反对(0) 哎哟,不错哦 | 园豆:184 (初学一级) | 2018-07-10 16:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册