Java Web编程入门--spring boot 项目构建

1、clean项目

2、Maven install

注:不要Maven clean

BUG:

1、参考博客

Tomcat启动时报错,Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext

错误日志:

22-Aug-2017 15:25:34.939 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.16
22-Aug-2017 15:25:34.945 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 21 2017 17:01:09 UTC
22-Aug-2017 15:25:34.948 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.16.0
22-Aug-2017 15:25:34.949 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 7
22-Aug-2017 15:25:34.951 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.1
22-Aug-2017 15:25:34.953 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
22-Aug-2017 15:25:34.955 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_101\jre
22-Aug-2017 15:25:34.957 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_101-b13
22-Aug-2017 15:25:34.959 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
22-Aug-2017 15:25:34.960 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         D:\apache-tomcat-8.5.16
22-Aug-2017 15:25:34.962 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         D:\apache-tomcat-8.5.16
22-Aug-2017 15:25:34.964 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:\apache-tomcat-8.5.16\conf\logging.properties
22-Aug-2017 15:25:34.968 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
22-Aug-2017 15:25:34.971 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
22-Aug-2017 15:25:34.973 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
22-Aug-2017 15:25:34.976 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:\apache-tomcat-8.5.16
22-Aug-2017 15:25:34.978 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\apache-tomcat-8.5.16
22-Aug-2017 15:25:34.980 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\apache-tomcat-8.5.16\temp
22-Aug-2017 15:25:34.983 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.12] using APR version [1.5.2].
22-Aug-2017 15:25:34.987 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
22-Aug-2017 15:25:34.990 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
22-Aug-2017 15:25:35.559 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2k  26 Jan 2017]
22-Aug-2017 15:25:35.663 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
22-Aug-2017 15:25:35.771 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Aug-2017 15:25:35.775 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
22-Aug-2017 15:25:35.779 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Aug-2017 15:25:35.781 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1106 ms
22-Aug-2017 15:25:35.805 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
22-Aug-2017 15:25:35.807 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.16
22-Aug-2017 15:25:35.815 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\apache-tomcat-8.5.16\webapps\docs]
22-Aug-2017 15:25:36.022 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.16\webapps\docs] has finished in [206] ms
22-Aug-2017 15:25:36.026 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\apache-tomcat-8.5.16\webapps\energyEconomizing]
22-Aug-2017 15:25:39.662 严重 [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/energyEconomizing]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1144)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1878)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/energyEconomizing] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1Boolean->org.bouncycastle.asn1.DERBoolean->org.bouncycastle.asn1.ASN1Boolean]
	at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2110)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2054)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2000)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1970)
	at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1923)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1163)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:775)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5105)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 10 more

22-Aug-2017 15:25:39.666 严重 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [D:\apache-tomcat-8.5.16\webapps\energyEconomizing]
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/energyEconomizing]]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1144)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1878)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

22-Aug-2017 15:25:39.677 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.16\webapps\energyEconomizing] has finished in [3,650] ms
22-Aug-2017 15:25:39.689 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\apache-tomcat-8.5.16\webapps\examples]
22-Aug-2017 15:25:39.863 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.16\webapps\examples] has finished in [174] ms
22-Aug-2017 15:25:39.867 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\apache-tomcat-8.5.16\webapps\host-manager]
22-Aug-2017 15:25:39.891 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.16\webapps\host-manager] has finished in [24] ms
22-Aug-2017 15:25:39.894 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\apache-tomcat-8.5.16\webapps\manager]
22-Aug-2017 15:25:39.913 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.16\webapps\manager] has finished in [19] ms
22-Aug-2017 15:25:39.917 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\apache-tomcat-8.5.16\webapps\ROOT]
22-Aug-2017 15:25:39.934 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.16\webapps\ROOT] has finished in [17] ms
22-Aug-2017 15:25:39.941 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
22-Aug-2017 15:25:39.951 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
22-Aug-2017 15:25:39.956 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 4167 ms
22-Aug-2017 15:31:01.249 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.16
22-Aug-2017 15:31:01.255 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 21 2017 17:01:09 UTC
22-Aug-2017 15:31:01.256 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.16.0
22-Aug-2017 15:31:01.258 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 7
22-Aug-2017 15:31:01.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.1
22-Aug-2017 15:31:01.261 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
22-Aug-2017 15:31:01.263 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_101\jre
22-Aug-2017 15:31:01.265 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_101-b13
22-Aug-2017 15:31:01.266 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
22-Aug-2017 15:31:01.268 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         D:\apache-tomcat-8.5.16
22-Aug-2017 15:31:01.270 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         D:\apache-tomcat-8.5.16
22-Aug-2017 15:31:01.272 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:\apache-tomcat-8.5.16\conf\logging.properties
22-Aug-2017 15:31:01.275 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
22-Aug-2017 15:31:01.277 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
22-Aug-2017 15:31:01.279 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
22-Aug-2017 15:31:01.283 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:\apache-tomcat-8.5.16
22-Aug-2017 15:31:01.286 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\apache-tomcat-8.5.16
22-Aug-2017 15:31:01.288 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\apache-tomcat-8.5.16\temp
22-Aug-2017 15:31:01.291 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.12] using APR version [1.5.2].
22-Aug-2017 15:31:01.294 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
22-Aug-2017 15:31:01.297 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
22-Aug-2017 15:31:01.869 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2k  26 Jan 2017]
22-Aug-2017 15:31:01.973 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
22-Aug-2017 15:31:02.076 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Aug-2017 15:31:02.080 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
22-Aug-2017 15:31:02.084 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Aug-2017 15:31:02.087 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1110 ms

解决方法:修改tomcat配置文件catalina.properties ,在tomcat.util.scan.StandardJarScanFilter.jarsToSkip后添加“,*

如下:

# - Test JARs (JUnit, Cobertura and dependencies)
tomcat.util.scan.StandardJarScanFilter.jarsToSkip=bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,jaspic-api.jar,catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-storeconfig.jar,catalina-tribes.jar,jasper.jar,jasper-el.jar,ecj-*.jar,tomcat-api.jar,tomcat-util.jar,tomcat-util-scan.jar,tomcat-coyote.jar,tomcat-dbcp.jar,tomcat-jni.jar,tomcat-websocket.jar,tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,tomcat-jdbc.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl.jar,taglibs-standard-spec-*.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,junit.jar,junit-*.jar,hamcrest-*.jar,easymock-*.jar,cglib-*.jar,objenesis-*.jar,ant-launcher.jar,cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,xom-*.jar,*
时间: 2024-10-14 01:46:37

Java Web编程入门--spring boot 项目构建的相关文章

Java Web系列:Spring Boot 基础 (转)

Spring Boot 项目(参考1) 提供了一个类似ASP.NET MVC的默认模板一样的标准样板,直接集成了一系列的组件并使用了默认的配置.使用Spring Boot 不会降低学习成本,甚至增加了学习成本,但显著降低了使用成本并提高了开发效率.如果没有Spring基础不建议直接上手. 1.基础项目 这里只关注基于Maven的项目构建,使用Spring Boot CLI命令行工具和Gradle构建方式请参考官网. (1)创建项目: 创建类型为quickstart的Maven项目,删除默认生成的

Java Web系列:Spring Boot 基础

Spring Boot 项目(参考1) 提供了一个类似ASP.NET MVC的默认模板一样的标准样板,直接集成了一系列的组件并使用了默认的配置.使用Spring Boot 不会降低学习成本,甚至增加了学习成本,但显著降低了使用成本并提高了开发效率.如果没有Spring基础不建议直接上手. 1.基础项目 这里只关注基于Maven的项目构建,使用Spring Boot CLI命令行工具和Gradle构建方式请参考官网. (1)创建项目: 创建类型为quickstart的Maven项目,删除默认生成的

笔记:Spring Boot 项目构建与解析

构建 Maven 项目 通过官方的 Spring Initializr 工具来产生基础项目,访问 http://start.spring.io/ ,如下图所示,该页面提供了以Maven构建Spring Boot 项目的功能. 选择构建工具 Maven Project,Spring Boot 版本选择 1.5.4,填写 Group 和 Artifact 信息,在Search for dependencies 中可以搜索需要的其他依赖包,这里我们需要实现 RESTful API,所以可以添加 Web

Spring Boot 项目构建 之 使用 Spring Boot 构建应用(Building an Application with Spring Boot)

Table of contents What you'll build What you'll need How to complete this guide Build with Gradle Build with Maven Build with Spring Tool Suite Learn what you can do with Spring Boot Create a simple web application Create an Application class Run the

Spring Boot 项目构建 之 使用 Gradle 构建 Java 项目(Building Java Projects with Gradle)

Table of contents What you'll build What you'll need How to complete this guide Set up the project Install Gradle Find out what Gradle can do Build Java code Declare dependencies Build your project with Gradle Wrapper Summary Tags gradle Concepts and

Maven快速使用教程(二) spring boot 项目构建

1.Spring boot介绍:

Spring Boot 项目构建 之 安装 Gradle(Chapter 4. Installing Gradle)

白话解析如下: =========== Mac 系统下载到 Gradle 压缩包后,解压到某一目录下,然后设置环境变量,命令如下: vi ~/.profile 按 i 进行编辑模式,用方向键向下移动光标到末尾,并添加如下内容: export GRADLE_HOME=/xxx/yyy/.../gradle-2.5 export PATH=$GRADLE_HOME/bin:$PATH 按 ESC 键退出编辑模式,输入 w 回车保存,再输入 q 回车退出 vi 编辑器. 接下来测试 gradle 是否

使用docker构建第一个spring boot项目

在看了一些简单的docker命令之后 打算自己尝试整合一下docker+spring boot项目本文是自己使用docker+spring boot 发布一个项目1.docker介绍 docke是提供简单易用的容器接口Docker 将应用程序与该程序的依赖,打包在一个文件里面.运行这个文件,就会生成一个虚拟容器.程序在这个虚拟容器里运行,就好像在真实的物理机上运行一样.有了 Docker,就不用担心环境问题. 总体来说,Docker 的接口相当简单,用户可以方便地创建和使用容器,把自己的应用放入

构建一个简单的Spring Boot项目

11 构建一个简单的Spring Boot项目 这个章节描述如何通过Spring Boot构建一个"Hello Word"web应用,侧重介绍Spring Boot的一些重要功能.因为大多数的开发工具都支持Maven,所以我们使用它来构建这个应用. 网站 spring.io 包含了许多如何开始使用Spring Boot的指南.如果您需要解决具体的问题,可以先去这里看看.你可以跳过以下的步骤,通过 start.spring.io 网站来构建项目.这样做的话,你就可以直接编写代码啦.如果需