Java Web编程入门--spring boot 项目构建
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java Web编程入门--spring boot 项目构建相关的知识,希望对你有一定的参考价值。
1、clean项目
2、Maven install
注:不要Maven clean
BUG:
1、参考博客
错误日志:
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,*
以上是关于Java Web编程入门--spring boot 项目构建的主要内容,如果未能解决你的问题,请参考以下文章