Intellij IDEA 14 and Tomcat 8.0



我是Java web开发的新手,尝试在Intellij 14+Tomcat 8.0上运行我的第一个"Hello World"应用程序。每次我得到错误"404"。

没有Intellij的Tomcat可以完美工作http://localhost:8080/作为Windows 7服务。

我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
</web-app>

我的index.xhtml文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
   <f:view>
      <h:outputLabel value="Hello, world"/>
   </f:view>
</html>

Tomcat 8:的配置

调试配置

Catalina.log:

09-Nov-2015 08:11:12.741 WARNING [main] org.apache.catalina.core.StandardServer.await StandardServer.await: Invalid command '' received
09-Nov-2015 08:11:15.890 WARNING [main] org.apache.catalina.core.StandardServer.await StandardServer.await: Invalid command '' received
09-Nov-2015 08:11:24.473 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
09-Nov-2015 08:11:24.674 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 08:11:24.725 INFO [Thread-6] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
09-Nov-2015 08:11:24.959 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
09-Nov-2015 08:11:25.012 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 09:12:48.990 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.28
09-Nov-2015 09:12:48.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Oct 7 2015 18:25:21 UTC
09-Nov-2015 09:12:48.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.28.0
09-Nov-2015 09:12:48.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 7
09-Nov-2015 09:12:48.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.1
09-Nov-2015 09:12:48.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
09-Nov-2015 09:12:48.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:Program FilesJavajre1.8.0_65
09-Nov-2015 09:12:48.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_65-b17
09-Nov-2015 09:12:48.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
09-Nov-2015 09:12:48.999 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 09:12:48.999 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 09:12:48.999 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 09:12:48.999 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 09:12:49.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:Program FilesApache Software FoundationTomcat 8.0endorsed
09-Nov-2015 09:12:49.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:Program FilesApache Software FoundationTomcat 8.0temp
09-Nov-2015 09:12:49.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
09-Nov-2015 09:12:49.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:Program FilesApache Software FoundationTomcat 8.0conflogging.properties
09-Nov-2015 09:12:49.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
09-Nov-2015 09:12:49.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
09-Nov-2015 09:12:49.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
09-Nov-2015 09:12:49.001 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: C:Program FilesApache Software FoundationTomcat 8.0bin;C:WindowsSunJavabin;C:Windowssystem32;C:Windows;C:Program FilesCommon FilesMicrosoft SharedWindows Live;C:Program Files (x86)Common FilesMicrosoft SharedWindows Live;C:ProgramDataOracleJavajavapath;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)Windows LiveShared;C:Program Files (x86)SkypePhone;C:Program FilesJavajre1.8.0_60bin;C:Program Files (x86)MySQLMySQL Fabric 1.5 & MySQL Utilities 1.5;C:Program Files (x86)MySQLMySQL Fabric 1.5 & MySQL Utilities 1.5Doctrine extensions for PHP;;.
09-Nov-2015 09:12:50.595 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
09-Nov-2015 09:12:51.071 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Nov-2015 09:12:51.073 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 09:12:51.076 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Nov-2015 09:12:51.076 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 4183 ms
09-Nov-2015 09:12:51.156 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
09-Nov-2015 09:12:51.156 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.28
09-Nov-2015 09:12:51.190 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsdocs
09-Nov-2015 09:12:52.137 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [251] milliseconds.
09-Nov-2015 09:12:52.163 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsdocs has finished in 973 ms
09-Nov-2015 09:12:52.163 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsmanager
09-Nov-2015 09:12:52.217 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsmanager has finished in 54 ms
09-Nov-2015 09:12:52.217 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsROOT
09-Nov-2015 09:12:52.265 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsROOT has finished in 48 ms
09-Nov-2015 09:12:52.272 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
09-Nov-2015 09:12:52.282 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 09:12:52.285 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1209 ms
09-Nov-2015 09:15:07.235 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
09-Nov-2015 09:15:07.247 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 09:15:07.298 INFO [Thread-6] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
09-Nov-2015 09:15:07.355 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
09-Nov-2015 09:15:07.358 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 10:08:14.705 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.28
09-Nov-2015 10:08:14.707 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Oct 7 2015 18:25:21 UTC
09-Nov-2015 10:08:14.707 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.28.0
09-Nov-2015 10:08:14.708 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 7
09-Nov-2015 10:08:14.708 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.1
09-Nov-2015 10:08:14.708 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
09-Nov-2015 10:08:14.708 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:Program FilesJavajre1.8.0_65
09-Nov-2015 10:08:14.708 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_65-b17
09-Nov-2015 10:08:14.708 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
09-Nov-2015 10:08:14.709 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 10:08:14.709 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 10:08:14.709 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 10:08:14.709 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:Program FilesApache Software FoundationTomcat 8.0
09-Nov-2015 10:08:14.709 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:Program FilesApache Software FoundationTomcat 8.0endorsed
09-Nov-2015 10:08:14.710 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:Program FilesApache Software FoundationTomcat 8.0temp
09-Nov-2015 10:08:14.710 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
09-Nov-2015 10:08:14.710 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:Program FilesApache Software FoundationTomcat 8.0conflogging.properties
09-Nov-2015 10:08:14.710 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
09-Nov-2015 10:08:14.710 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
09-Nov-2015 10:08:14.711 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
09-Nov-2015 10:08:14.711 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: C:Program FilesApache Software FoundationTomcat 8.0bin;C:WindowsSunJavabin;C:Windowssystem32;C:Windows;C:Program FilesCommon FilesMicrosoft SharedWindows Live;C:Program Files (x86)Common FilesMicrosoft SharedWindows Live;C:ProgramDataOracleJavajavapath;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)Windows LiveShared;C:Program Files (x86)SkypePhone;C:Program FilesJavajre1.8.0_60bin;C:Program Files (x86)MySQLMySQL Fabric 1.5 & MySQL Utilities 1.5;C:Program Files (x86)MySQLMySQL Fabric 1.5 & MySQL Utilities 1.5Doctrine extensions for PHP;;.
09-Nov-2015 10:08:14.884 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
09-Nov-2015 10:08:14.972 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Nov-2015 10:08:14.974 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 10:08:14.977 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Nov-2015 10:08:14.977 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 725 ms
09-Nov-2015 10:08:15.002 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
09-Nov-2015 10:08:15.002 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.28
09-Nov-2015 10:08:15.011 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsdocs
09-Nov-2015 10:08:15.482 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [130] milliseconds.
09-Nov-2015 10:08:15.500 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsdocs has finished in 489 ms
09-Nov-2015 10:08:15.500 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsmanager
09-Nov-2015 10:08:15.579 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsmanager has finished in 79 ms
09-Nov-2015 10:08:15.579 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsROOT
09-Nov-2015 10:08:15.609 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:Program FilesApache Software FoundationTomcat 8.0webappsROOT has finished in 30 ms
09-Nov-2015 10:08:15.621 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
09-Nov-2015 10:08:15.632 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 10:08:15.634 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 656 ms
09-Nov-2015 10:08:33.224 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
09-Nov-2015 10:08:33.227 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
09-Nov-2015 10:08:33.278 INFO [Thread-6] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
09-Nov-2015 10:08:33.313 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
09-Nov-2015 10:08:33.317 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]

根据您的Deployment屏幕截图选项卡,您必须将选项卡Server上字段Open browser的值固定为值http://localhost:8080/JSFDemo,并使用此路径使用从IDEA运行的web应用程序。

相关内容

  • 没有找到相关文章

最新更新