启动日志:
. ____ _ __ _
/\ / _' __ _ ()_ __ __ _
( ( )___ | '_ | '| | ' / ` |
\/ _)| |)| | | | | || (| | ) ) ) )
' |_| .|| ||| |_, | / / / /
=========||==============|__/=////
:: Spring Boot :: (v2.1.1.RELEASE)
2019-06-29 16:17:55.898 INFO 10772 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on LAPTOP-BST1FU34 with PID 10772 (E:\Users\celing\workspace\demo\target\classes started by admin in E:\Users\celing\workspace\demo)
2019-06-29 16:17:55.903 INFO 10772 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
2019-06-29 16:17:57.369 INFO 10772 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-06-29 16:17:57.407 INFO 10772 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-06-29 16:17:57.407 INFO 10772 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.13
2019-06-29 16:17:57.422 INFO 10772 --- [ main] o.a.catalina.core.AprLifecycleListener : 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_211\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_211/bin/server;C:/Program Files/Java/jre1.8.0_211/bin;C:/Program Files/Java/jre1.8.0_211/lib/amd64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;".;C:\Program Files\Java\jdk1.8.0_131\bin;E:\apache-tomcat-7.0.92-windows-x64\apache-tomcat-7.0.92\bin";E:\apache-maven-3.6.1\bin;E:\apache-maven-3.6.1\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;E:\bin;E:\VisualSVN Server\bin;;E:\eclipse;;.]
2019-06-29 16:17:57.616 INFO 10772 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-06-29 16:17:57.616 INFO 10772 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1653 ms
2019-06-29 16:17:58.033 INFO 10772 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-06-29 16:17:58.762 INFO 10772 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-06-29 16:17:58.767 INFO 10772 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 3.298 seconds (JVM running for 4.441)
pom文件:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我的启动页面
这是正常启动了,404的原因是你的启动类怎么在demo 文件夹里面,正常不是在外面吗?他没扫描到controller包
一语中的,我就觉着我的controll没扫到,没想是启动类的问题
@菜鸟大神2017:Spring boot 的主application要放在最外层,否则会因controller扫描不到而报404
Started DemoApplication in 3.298 seconds (JVM running for 4.441)
你这个不是启动了吗?
有其他的状况吗?
建一个 index.html 文件
你访问127.0.0.1:8080/index.html 试试
tomcat好像是没起来,启动日志有这一行: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path
但是我没找到解决办法
@菜鸟大神2017: 我还是感觉问题不是出自你描述的哪儿,你直接访问,报的几百错误404?500?或是 无法访问此网站d的提示?
@菜鸟大神2017: 如果真是那个问题,你可以试试这个: https://www.cnblogs.com/albert1017/archive/2012/08/14/2638226.html
@渡河人: 404,但是我刚才又搜了一下别人的启动日志,您说的是对的,那个地方不影响,
@渡河人: 您发的这个方法我之前试过,里面的下载网址都打不开404
@渡河人: 我问题补充了一下两个日志截图
@菜鸟大神2017: 404就是启动了,但地址有问题,可以让我看看你的请求路径吗?
@渡河人: 我这就是个hell world,
这是我的Controller代码
百度关键字:No active profile set, falling back to default profiles: default
或许有你要的答案
这个好像正常启动也有,我觉得问题在于2019-06-29 16:17:57.422 INFO 10772 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program
这一句