原始服务器没有找到目标资源的当前表示,或者不愿意透露存在该目标资源。在部署到tomcat [英] The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

查看:21239
本文介绍了原始服务器没有找到目标资源的当前表示,或者不愿意透露存在该目标资源。在部署到tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Spring和Eclipse IDE构建了一个应用程序。当我从Eclipse IDE启动项目时,一切都很好但是当我将maven项目打包为war文件并部署到单独的tomcat时我有这个问题

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

这是我的xml文件中的配置片段

 <! - 查看解析器 - > 
< beans:bean
class =org.springframework.web.servlet.view.InternalResourceViewResolver>
< beans:property name =prefixvalue =/ WEB-INF / pages //>
< beans:property name =suffixvalue =。jsp/>
< / beans:bean>

我正在尝试访问此控制器

  @RequestMapping(value = {/ welcome,/})
public String defaultPage(){
returnWeb服务数据已成功使用;


}

任何人都知道为什么会失败部署到tomcat?

解决方案

我多次遇到这个问题。



我目前使用的解决方案是使用webapp(或保存jsp等视图的文件夹)处于部署程序集的状态。



这样做右键单击项目>构建路径>配置构建路径>部署组装>添加(右侧)>文件夹> (添加你的jsp 文件夹。在默认情况下,它是 src / main / webapp



<你可以在你做了一切正确的事情后得到这个错误,但在JSP上你把锚标记旧方式(如果它帮助其他人有同样的问题,我会添加这个错误)。



我在jsp上有以下语法。 < a href =/ mappedpath> TakeMeToTheController< / a> 我一直看到问题中提到的错误。但是,将标记更改为下面显示的标记可以解决问题。

 < a href =< spring:url value = / mappedpath/>> TakeMeToTheController< / a> 


I have built an application using Spring with Eclipse IDE. When I launch the project from Eclipse IDE everything is fine but when I package the maven project as a war file and deployed to separate tomcat I have this issue

The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

This is a configuration snippet from my xml file

<!-- View Resolver -->
    <beans:bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/pages/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>

I am trying to access this controller

@RequestMapping(value = {"/welcome", "/"})
    public String defaultPage() {
            return "Web Service data successfuly consumed";


    }

anyone with an idea why this is failing on deployed to tomcat?

解决方案

I struggled with this problem many times.

The solution I am currently using is weather the webapp(or the folder where you kept the views like jsp) is under deployment assembly.

To do so Right click on the project > Build Path > Configure Build path > Deployment Assembly > Add(right hand side) > Folder > (add your jsp folder. In default case it is src/main/webapp)

You could also get this error after you did everything correct but on the JSP you put the anchor tag the old fashion(I am adding this incase if it help anybody else with the same issue).

I had the following syntax on the jsp. <a href="/mappedpath">TakeMeToTheController</a> and I kept seeing the error mentioned in the question. However changing the tag into the one shown below solved the issue.

<a href=" <spring:url value="/mappedpath" /> ">TakeMeToTheController</a>

这篇关于原始服务器没有找到目标资源的当前表示,或者不愿意透露存在该目标资源。在部署到tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆