您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

原始服务器找不到目标资源的当前表示,或者不愿意透露该资源的存在。在部署到tomcat

原始服务器找不到目标资源的当前表示,或者不愿意透露该资源的存在。在部署到tomcat

如果你正在开发Spring Boot应用程序,请在主文件添加“ SpringBootServletInitializer”,如以下代码所示。因为如果没有SpringBootServletInitializer,Tomcat会将其视为普通应用程序,则不会将其视为Spring引导应用程序。

@SpringBootApplication
public class DemoApplication extends *SpringBootServletInitializer*{

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
         return application.sources(DemoApplication .class);
    }

    public static void main(String[] args) {
         SpringApplication.run(DemoApplication .class, args);
    }
}

我为此问题挣扎过很多次。

我当前使用的解决方案是在webapp(或保存了jsp之类的视图的文件夹)处于部署程序集下。

这样做Right click on the project > Build Path > Configure Build path > Deployment Assembly > Add(right hand side) > Folder > (add your jsp文件夹。在认情况下为src/main/webapp)

在你做完所有正确的事情之后,你也可能会收到此错误,但是在JSP上,你将锚标记放置为旧的样式(如果有其他问题,我会添加标签以防其他人)。

我在jsp上具有以下语法。<a href="/mappedpath">TakeMeToTheController</a>而且我一直看到问题中提到的错误。但是,将标签更改为如下所示的标签可以解决此问题。

<a href=" <spring:url value="/mappedpath" /> ">TakeMeToTheController</a>
其他 2022/1/1 18:53:01 有466人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶