请求的资源不可用Tomcat 7 Eclipse Kepler

时间:2014-01-30 10:54:05

标签: java eclipse maven tomcat

我安装了Maven并想从这个页面检查项目: http://www.javacodegeeks.com/2013/02/spring-data-mongodb-and-jsf-integration-tutorial.html

我确实做了以下步骤:

  1. 我从Github
  2. 加载了src和pom.xml文件
  3. 我复制了文件     eclipse中的工作区更改了项目名称,没有     空格。
  4. 我使用了eclipse中的m2eclipse wtp插件     Import > Maven > Existing Maven Project
  5. 我制作Run As > Maven install
  6. 我收到了build success消息
  7. 安装完项目后,我看Project > Properties < Project Facets。动态Web模块没有被点击。所以我点了点头。 在此之后,我点击了webapp文件夹构建路径,并将文件夹添加到构建路径以获得src / main webapp。

    我认为这些步骤是正确的。 但后来我想启动项目作为动态Web项目,我得到错误 HTTP Status 404 - The request resource is not available

    控制台消息:

    Jan 30, 2014 11:28:14 AM org.apache.catalina.core.AprLifecycleListener ini Information:
    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\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_45;C:\Program Files\apache-maven-3.1.1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_45;C:\elipse_jee\eclipse;;.
    Jan 30, 2014 11:28:14 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    Warnung: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:springDataMongodbExample' did not find a matching property.
    Jan 30, 2014 11:28:14 AM org.apache.coyote.AbstractProtocol init
    Information: Initializing ProtocolHandler ["http-bio-8080"]
    Jan 30, 2014 11:28:15 AM org.apache.coyote.AbstractProtocol init
    Information: Initializing ProtocolHandler ["ajp-bio-8009"]
    Jan 30, 2014 11:28:15 AM org.apache.catalina.startup.Catalina load
    Information: Initialization processed in 1456 ms
    Jan 30, 2014 11:28:15 AM org.apache.catalina.core.StandardService startInternal
    Information: Starting service Catalina
    Jan 30, 2014 11:28:15 AM org.apache.catalina.core.StandardEngine startInternal
    Information: Starting Servlet Engine: Apache Tomcat/7.0.42
    Jan 30, 2014 11:28:16 AM com.sun.faces.config.ConfigureListener contextInitialized
    Information: Mojarra 2.2.0 ( ) für Kontext '' wird initialisiert.
    Jan 30, 2014 11:28:16 AM com.sun.faces.spi.InjectionProviderFactory createInstance
    Information: JSF1048: PostConstruct/PreDestroy-Annotationen vorhanden.  Verwaltete Bean-Methoden, die mit diesen Annotationen markiert sind, lassen die entsprechenden Annotationen verarbeiten.
    Jan 30, 2014 11:28:17 AM com.sun.faces.config.ConfigureListener contextInitialized
    Information: Mojarra 2.2.0 ( ) für Kontext '/springDataMongodbExample' wird initialisiert.
    Jan 30, 2014 11:28:17 AM com.sun.faces.spi.InjectionProviderFactory createInstance
    Information: JSF1048: PostConstruct/PreDestroy-Annotationen vorhanden.  Verwaltete Bean-Methoden, die mit diesen Annotationen markiert sind, lassen die entsprechenden Annotationen verarbeiten.
    Jan 30, 2014 11:28:18 AM org.apache.coyote.AbstractProtocol start
    Information: Starting ProtocolHandler ["http-bio-8080"]
    Jan 30, 2014 11:28:18 AM org.apache.coyote.AbstractProtocol start
    Information: Starting ProtocolHandler ["ajp-bio-8009"]
    Jan 30, 2014 11:28:18 AM org.apache.catalina.startup.Catalina start
    Information: Server startup in 3100 ms
    

    这是web.xml文件:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0"
     xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    
     <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>WEB-INF/spring-application-context.xml </param-value>
     </context-param>
     <context-param>
      <param-name>errorPageUrl</param-name>
      <param-value>/pages/systemError.do</param-value>
     </context-param>
     <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>false</param-value>
     </context-param>
     <context-param>
      <param-name>facelets.REFRESH_PERIOD</param-name>
      <param-value>2</param-value>
     </context-param>
     <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
     </context-param>
     <context-param>
      <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
      <param-value>resources.application</param-value>
     </context-param>
     <context-param>
      <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
      <param-value>true</param-value>
     </context-param>
     <context-param>
      <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
      <param-value>false</param-value>
     </context-param>
     <context-param>
      <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
      <param-value>false</param-value>
     </context-param>
     <context-param>
      <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
      <param-value>false</param-value>
     </context-param>
     <context-param>
      <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
      <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
     </context-param>
     <context-param>
      <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
      <param-value>false</param-value>
     </context-param>
    
     <context-param>
      <param-name>primefaces.THEME</param-name>
      <param-value>glass-x</param-value>
     </context-param>
    
     <servlet>
      <servlet-name>FacesServlet</servlet-name>
      <servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
     </servlet>
     <servlet-mapping>
      <servlet-name>FacesServlet</servlet-name>
      <url-pattern>*.xhtml</url-pattern>
     </servlet-mapping>
     <welcome-file-list>
            <welcome-file>search.xhtml</welcome-file>
     </welcome-file-list>
     <listener>
      <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
     </listener>
     <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>
    </web-app>
    

    这是示例中的相同文件。我唯一改变的是:

    <servlet-mapping>
          <servlet-name>FacesServlet</servlet-name>
          <url-pattern>*.xhtml</url-pattern>
         </servlet-mapping>
         <welcome-file-list>
                <welcome-file>search.xhtml</welcome-file>
         </welcome-file-list>
    

    我从*.jsf to *.xhtml改变了。我还更改了以template > common.xhtml

    结尾的文件
    <p:menuitem value="Search" url="/search.xhtml" icon="ui-icon-search" /> 
    <p:menuitem value="New Product" url="/detail.xhtml" icon="ui-icon-document" />
    

    *.xhtml。我希望这些改变可以解决我的问题。但那不是答案。

    有没有人有想法?我从有类似问题的人那里读了一些帖子,但我没有解决问题。

    我没有10个声誉,所以我无法发布项目结构的图像。这是图片的链接。 Path of the project structure

0 个答案:

没有答案