简体   繁体   English

为什么这个Spring应用程序不起作用?

[英]Why does this Spring application not work?

I have this project . 我有这个项目 Then I do the following steps: 然后,我执行以下步骤:

  1. cd spring-boot-aws-spike
  2. mvn clean compile install spring-boot:repackage
  3. cd target
  4. java -jar spring-boot-sample-0.0.1-SNAPSHOT.war
  5. Go to http://localhost:8080/ 转到http://localhost:8080/
  6. Expected result: Error message (rendered in browser) 预期结果:错误消息(在浏览器中呈现)

Whitelabel Error Page 白标错误页面

This application has no explicit mapping for /error, so you are seeing this as a fallback. 此应用程序没有针对/ error的显式映射,因此您将其视为后备。 Tue Aug 27 16:59:23 CEST 2019 There was an unexpected error (type=Not Found, status=404). TEST Aug 27 16:59:23 CEST 2019有一个意外错误(type = Not Found,status = 404)。 No message available 无讯息

How can I change the attached code so that instead of this error, the file index.xhtml is rendered? 如何更改附加的代码,以便呈现此文件index.xhtml而不是此错误?

Update 1: If I go to http://localhost:8080/index.html , I get this error: 更新1:如果我转到http://localhost:8080/index.htmlhttp://localhost:8080/index.html收到此错误:

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Whitelabel Error Page此应用程序没有针对/ error的显式映射,因此您将其视为后备。

Tue Aug 27 17:07:53 CEST 2019 There was an unexpected error (type=Not Found, status=404). TEST Aug 27 17:07:53 CEST 2019发生意外错误(type = Not Found,status = 404)。 No message available 无讯息

Looks the same as before. 看起来和以前一样。

This example seems to be incomplete (some code is missing). 该示例似乎不完整(缺少一些代码)。 I got this in logs after running it: 运行它后,我在日志中得到了它:

2019-08-27 17:19:42.119 ERROR 12588 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[facesServlet]         : Servlet.service() for servlet [facesServlet] in context with path [] threw exception [/file:/D:/workspace/spring-boot-sample-master/target/spring-boot-sample-0.0.1-SNAPSHOT.war*/index.xhtml @7,8 <p:> Tag Library supports namespace: http://xmlns.jcp.org/jsf/passthrough, but no tag was defined for name: ] with root cause

javax.faces.view.facelets.TagException: /file:/D:/workspace/spring-boot-sample-master/target/spring-boot-sample-0.0.1-SNAPSHOT.war*/index.xhtml @7,8 <p:> Tag Library supports namespace: http://xmlns.jcp.org/jsf/passthrough, but no tag was defined for name:

It works when You remove missing tag declaration from index.xhtml (still have to point directly to index -> http://localhost:8080/index.xhtml ): 当您从index.xhtml中删除丢失的标记声明时(仍然必须直接指向index-> http:// localhost:8080 / index.xhtml ),它可以工作:

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">

    <div class="row">
        Heyo!
    </div>
</ui:composition>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM