【问题标题】:Spring-Boot with JSP project not able to run with jar or war file带有 JSP 项目的 Spring-Boot 无法使用 jar 或 war 文件运行
【发布时间】:2019-06-12 19:44:47
【问题描述】:

我有 jsp 项目的 spring boot,可以使用主应用程序文件运行,但是当我使用 jar 或 war 将它部署到生产环境时,它给了我错误:

没有可用的映射。

我在调试模式下看到我的代码成功读取请求但无法重定向我的索引 jsp。

application.properties

   spring.profiles.active=dev
   spring.application.name=Profiles
   server.servlet.context-path=/tagfact
   spring.mvc.view.prefix: /view/
   spring.mvc.view.suffix: .jsp

【问题讨论】:

  • 你是怎么包装的?
  • 这可以帮助你.. structuring_code
  • 您能否展示一些代码以及您的目录结构是什么样的
  • 尝试只使用前缀和后缀。如需更多评论,您可以添加您的 pom.xml 文件和配置文件(如果已经有)。

标签: java spring-boot jsp jar


【解决方案1】:

按照下面的配置,创建结构和包为.war文件并部署到tomcat。

application.properties

server.contextPath=/demo-user
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-15
    • 2020-02-04
    • 1970-01-01
    • 2019-02-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多