无法访问localhost页面

时间:2016-03-06 12:43:52

标签: intellij-idea spring-boot

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {

        System.out.println("xxxx");
        SpringApplication.run(DemoApplication.class, args);


    }
}

其他课程

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SampleController {

    @RequestMapping("/")
    public String index() {
        return "Greetings from Spring Boot!";
    }

}

我让tomcat在端口8181上工作,因为当我使用8080并在intellj中运行时,它说8080已经在使用中并且无法启动它。

所以,我使用8181并在执行后打开localhost:8181页面,但它是一个白页,没有任何内容。

这些是输出日志

  

06-Mar-2016 14:38:16.383 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory部署Web应用程序目录/ opt / tomcat / webapps / manager       06-Mar-2016 14:38:16.977 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录/ opt / tomcat / webapps / manager的部署已在593 ms内完成

这些是卡塔琳娜日志

  

06-Mar-2016 14:38:05.878 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log服务器版本:Apache Tomcat / 8.0.32       06-Mar-2016 14:38:05.887 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log服务器内置:2016年2月2日19:34:53 UTC       06-Mar-2016 14:38:05.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log服务器编号:8.0.32.0       06-Mar-2016 14:38:05.888 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log操作系统名称:Linux       06-Mar-2016 14:38:05.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS版本:4.2.0-30-generic       06-Mar-2016 14:38:05.892 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log架构:amd64       06-Mar-2016 14:38:05.893 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java主页:/ usr / lib / jvm / java-8-oracle / jre       06-Mar-2016 14:38:05.893 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM版本:1.8.0_74-b02       06-Mar-2016 14:38:05.894 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM供应商:Oracle Corporation       06-Mar-2016 14:38:05.894 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:/home/caneraydin/.IntelliJIdea16/system/tomcat/Unnamed_Last5       06-Mar-2016 14:38:05.895 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:/ opt / tomcat       06-Mar-2016 14:38:05.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Djava.util.logging.config.file = / home / caneraydin / .IntelliJIdea16 / system /的Tomcat / Unnamed_Last5 / CONF / logging.properties       06-Mar-2016 14:38:05.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Djava.util.logging.manager = org.apache.juli.ClassLoaderLogManager       06-Mar-2016 14:38:05.898 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Dcom.sun.management.jmxremote =       06-Mar-2016 14:38:05.899 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Dcom.sun.management.jmxremote.port = 1099       06-Mar-2016 14:38:05.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Dcom.sun.management.jmxremote.ssl = false       06-Mar-2016 14:38:05.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Dcom.sun.management.jmxremote.authenticate = false       06-Mar-2016 14:38:05.901 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Djava.rmi.server.hostname = 127.0.0.1       06-Mar-2016 14:38:05.901 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Djava.endorsed.dirs = / opt / tomcat / endorsed       06-Mar-2016 14:38:05.902 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Dcatalina.base = / home / caneraydin / .IntelliJIdea16 / system / tomcat / Unnamed_Last5       06-Mar-2016 14:38:05.905 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Dcatalina.home = / opt / tomcat       06-Mar-2016 14:38:05.905 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log命令行参数:-Djava.io.tmpdir = / opt / tomcat / temp       06-Mar-2016 14:38:05.906 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent在java.library.path中找不到基于APR的Apache Tomcat Native库,它可以在生产环境中实现最佳性能: /home/caneraydin/Downloads/idea-IU-144.4199.23/bin::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib       06-Mar-2016 14:38:06.265 INFO [main] org.apache.coyote.AbstractProtocol.init初始化ProtocolHandler [" http-nio-8181"]       06-Mar-2016 14:38:06.296 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector使用共享选择器进行servlet写/读       06-Mar-2016 14:38:06.302 INFO [main] org.apache.coyote.AbstractProtocol.init初始化ProtocolHandler [" ajp-nio-34294"]       06-Mar-2016 14:38:06.304 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector使用共享选择器进行servlet写入/读取       06-Mar-2016 14:38:06.305 INFO [main] org.apache.catalina.startup.Catalina.load初始化在1704 ms处理       06-Mar-2016 14:38:06.353 INFO [main] org.apache.catalina.core.StandardService.startInternal开始服务Catalina       06-Mar-2016 14:38:06.353 INFO [main] org.apache.catalina.core.StandardEngine.startInternal启动Servlet引擎:Apache Tomcat / 8.0.32       06-Mar-2016 14:38:06.370 INFO [main] org.apache.coyote.AbstractProtocol.start启动ProtocolHandler [" http-nio-8181"]       06-Mar-2016 14:38:06.433 INFO [main] org.apache.coyote.AbstractProtocol.start启动ProtocolHandler [" ajp-nio-34294"]       06-Mar-2016 14:38:06.448 INFO [main] org.apache.catalina.startup.Catalina.start服务器启动时间为142毫秒       06-Mar-2016 14:38:16.383 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory部署Web应用程序目录/ opt / tomcat / webapps / manager       06-Mar-2016 14:38:16.977 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录/ opt / tomcat / webapps / manager的部署已在593 ms内完成

我做错了什么?

1 个答案:

答案 0 :(得分:0)

将application.properties文件中的端口更改为8181,默认为8080 问候, 尼丁