我有两个班级
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
package com.example;
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!";
}
}
我想创建一个使用maven和tomcat的springboot应用程序。我想在localhost页面看到输出。
我使用8282端口,当我点击运行时,它会打开该页面,但它是空的。
所以我创造了一个战争神器。网络应用程序爆炸但这次它说不能创建工件,它不会打开该网页。
为什么显示空白页面?我在集成tomcat之前看到了输出。
这是输出
/opt/tomcat/bin/catalina.sh run
05-Mar-2016 18:20:58.401 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.32
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 2 2016 19:34:53 UTC
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.32.0
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
05-Mar-2016 18:20:58.408 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.2.0-30-generic
05-Mar-2016 18:20:58.409 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-8-oracle/jre
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_74-b02
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/caneraydin/.IntelliJIdea16/system/tomcat/Unnamed_HelloW
05-Mar-2016 18:20:58.413 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/tomcat
05-Mar-2016 18:20:58.417 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/caneraydin/.IntelliJIdea16/system/tomcat/Unnamed_HelloW/conf/logging.properties
05-Mar-2016 18:20:58.417 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
05-Mar-2016 18:20:58.417 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
05-Mar-2016 18:20:58.437 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
05-Mar-2016 18:20:58.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
05-Mar-2016 18:20:58.438 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/opt/tomcat/endorsed
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/caneraydin/.IntelliJIdea16/system/tomcat/Unnamed_HelloW
05-Mar-2016 18:20:58.439 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
05-Mar-2016 18:20:58.440 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
05-Mar-2016 18:20:58.441 INFO [main] 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: /home/caneraydin/Downloads/idea-IU-144.4199.23/bin::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
05-Mar-2016 18:20:59.036 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8282"]
05-Mar-2016 18:20:59.084 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Mar-2016 18:20:59.099 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
05-Mar-2016 18:20:59.102 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Mar-2016 18:20:59.107 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1787 ms
05-Mar-2016 18:20:59.218 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
05-Mar-2016 18:20:59.221 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.32
05-Mar-2016 18:20:59.236 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8282"]
05-Mar-2016 18:20:59.336 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
05-Mar-2016 18:20:59.353 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 245 ms
Connected to server
05-Mar-2016 18:21:09.252 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/tomcat/webapps/manager
05-Mar-2016 18:21:09.732 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat/webapps/manager has finished in 479 ms
答案 0 :(得分:1)
警告没有配置工件 从左边选择Artifacts,选择Web Application:Exploded(JAR是默认的?),然后警告消失,仅供参考,