调用response.getStatus()时出现NoSuchMethodError

2023-12-05

我想这是某种依赖性问题,所以这是我的树:

[INFO] Sikor:BrowserGame:war:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- org.springframework:spring-context:jar:4.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:4.1.1.RELEASE:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] |  \- org.springframework:spring-expression:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.5.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- org.springframework.security:spring-security-core:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.2.5.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-acl:jar:3.2.5.RELEASE:compile
[INFO] +- org.thymeleaf:thymeleaf-spring4:jar:2.1.3.RELEASE:compile
[INFO] |  \- org.thymeleaf:thymeleaf:jar:2.1.3.RELEASE:compile
[INFO] |     +- ognl:ognl:jar:3.0.6:compile
[INFO] |     \- org.unbescape:unbescape:jar:1.0:compile
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.1.RELEASE:compile
[INFO] +- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.2.7:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.5.FINAL:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:4.3.5.Final:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:compile
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] |  \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.3.2.Final:compile
[INFO] |  \- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.32:compile
[INFO] +- org.springframework:spring-orm:jar:4.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:4.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.6.4.RELEASE:compile
[INFO] |  +- org.springframework.data:spring-data-commons:jar:1.8.4.RELEASE:compile
[INFO] |  +- org.aspectj:aspectjrt:jar:1.8.1:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.7:runtime
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] |  \- log4j:log4j:jar:1.2.16:compile
[INFO] \- javax.mail:mail:jar:1.4:compile
[INFO]    \- javax.activation:activation:jar:1.1:compile

据我所知,spring 4.1.1 应该与 javax.servlet 3.1.0 一起使用,但我得到了java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I当在我的拦截器中调用response.getStatus()时。
如果有人能提供帮助,我会很高兴。提前致谢。

EDIT:添加了web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">

    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/config/mvc-dispatcher-servlet.xml</param-value>
        </init-param>
        <init-param>
            <param-name>throwExceptionIfNoHandlerFound</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/config/root-context.xml
        </param-value>
    </context-param>

</web-app>



EDIT2:更改了以下内容:

<web-app version="2.5" 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_2_5.xsd">

to:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

但在调用 response.getStatus(); 时我仍然收到错误


我在一个简单的 tomcat:run 上运行我的应用程序。将其部署到战争并确保我使用 Tomcat 7 后一切都很好。感谢所有评论员,你们为我指明了正确的方向。干杯。

EDIT :请记住,tomcat 7 不支持 servlet 3.1,因此您必须将 servlet 3.0 与 tomcat 7 一起使用,或者将 servlet 3.1 与 tomcat 8 一起使用。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

调用response.getStatus()时出现NoSuchMethodError 的相关文章

随机推荐

  • 是否可以使用密码保护 SQL Server 数据库,甚至免受服务器管理员的攻击?

    我想在某个小公司的本地网络中安装一个应用程序 ASP Net SQL Server 2005 Express 来演示一段时间 但我也不想有人甚至系统管理员对此数据库没有权限 并且任何授予权限都需要我拥有的安全通行证 我只是希望隐藏我的表结构
  • 如何在热图右侧添加自定义刻度

    给定以下示例数据 data q1 6 4 4 4 6 6 6 4 6 6 6 6 q2 3 3 3 4 3 3 4 3 4 3 4 1 q3 6 3 4 4 4 4 6 6 6 6 4 1 q4 3 6 6 6 6 6 4 4 6 4 6
  • PHP cURL HTTP PUT

    我正在尝试使用 cURL 创建 HTTP PUT 请求 但无法使其工作 我读过很多教程 但没有一个真正起作用 这是我当前的代码 filedata array metadata gt rdfxml ch curl init url heade
  • 在 printStackTrace() 上打印完整的调用堆栈?

    我需要编写一个小型日志分析器应用程序来处理我的项目中使用的第三方闭源库 内部有自定义记录器 生成的一些日志文件 如果日志中出现异常条目 我需要收集有关从堆栈跟踪顶部到异常实际位置所涉及方法的聚合信息 不幸的是 默认情况下 Java prin
  • 带有特殊字符的 Firestore 查询属性

    我有一个联系人集合 其结构如下 name XPTO emails email protected Susan email protected Fred 但查询不会返回结果 db firestore collection contacts w
  • TFS 构建工作流程将文件夹/文件属性从只读更改为读/写?

    在我们的一个 Web 应用程序中 要求某些 HTML 页面可以在我们为用户创建的 GUI 界面中进行编辑 不幸的是 该接口直接从服务器上的页面 也在 wwwroot 中 读取 写入 服务器上的另一个页面从中读取并显示它 我现在所做的是改变了
  • 报表生成器导出为带有列标题空格的 CSV

    这是一个奇怪的请求 因为我们都知道数据库标头不应包含空格 然而 我正在使用的系统需要在其标题中包含空格才能导入 我创建了一个报告生成器报告 它将数据构建到一个表中 并在运行时工作 01 08 2015 Active date 31 07 2
  • 单击另一个程序中的按钮 - FindWindow、C#

    我正在尝试创建一个能够控制另一个程序 在 Windows 中 的程序 我找到了这段代码 Get a handle to an application window DllImport USER32 DLL CharSet CharSet U
  • PHP 在文档根目录之外写入

    我正在尝试在 Web 服务器文档根目录之外的目录中创建一个文件 该文件夹的权限为 777 但 php 表示权限被拒绝 警告 fopen home site2 public html images x jpg function fopen 无
  • Java ReplaceAll:无法用反斜杠替换字符串

    在我的 Java 程序中 我试图替换字符串中包含反斜杠的子字符串 paloalto to sanjose 但是 即使我使用双反斜杠来减轻反斜杠作为转义字符的影响 我仍然收到以下错误 Exception in thread main java
  • JPA Criteria API - 如何添加 JOIN 子句(尽可能通用的句子)

    我正在尝试动态构建查询 我的下一个目标是添加 JOIN 子句 我不知道如何使用 API 例如 到目前为止 这段代码对我有用 Class baseClass CriteriaBuilder cb JpaHandle get getCriter
  • 使用 PEAR 安装 phpDocumentor

    在主页上http www phpdoc org on http manual phpdoc org HTMLSmartyConverter HandS phpDocumentor tutorial phpDocumentor quickst
  • 当单元格更改文本时更改行颜色的脚本

    我有一个 Google 电子表格 其中保存了错误列表 每当我修复错误时 我都会将状态从 未开始 更改为 完成 我想为 Google Docs 电子表格编写一个脚本 这样每当我将状态更改为 完成 时 整行就会以某种颜色突出显示 我已经知道 G
  • 将字符串拆分为行的最佳方法

    如何将多行字符串分割成行 我知道这样 var result input Split n r ToCharArray StringSplitOptions RemoveEmptyEntries 看起来有点难看并且丢失了空行 有更好的解决方案吗
  • JavaScript 与 Delphi 程序

    如何将 googiespell 脚本与 Delphi 程序和 WebBrowser 一起使用 脚本用于拼写检查器 我的代码是在 Webbrowser 中使用 java 脚本 这是执行脚本的代码 uses MSHTML TLB SHDocVw
  • 将制表符分隔的文件行读入数组

    我想将文件逐行读入脚本 文件中的每一行都是由制表符分隔的多个值 我想将每一行读入一个数组 典型的bash 按行读取文件 示例 while read line do echo line done lt myfile 但对我来说 myfile
  • 如何将图像添加到 Chart.js 工具提示中?

    我正在使用 Chart js 根据设计师的特定指示构建折线图 并且我希望我的工具提示包含一个小图标 是否可以 您可以覆盖 customTooltips 函数 var myLineChart new Chart ctx Line data c
  • 用于选择具有空值属性的元素的 jQuery 选择器?

    我使用下面的选择器来获取所有预先填充值的表单输入 input value 这效果很好 所以我想我可以使用以下选择器将相同的逻辑应用于我的选择元素 尽管它似乎选择了 Chrome 中的所有选择元素 select value 下面是表单上两种类
  • 在 Shiny R Studio 中重置动画

    我正在使用 R Studio 的 Shiny 构建一个动画图形项目 目前 走吧 按钮启动动画 我想让 重置 按钮重新初始化变量并重新运行动画 但由于 Shiny 不允许在代码内更改 input button 值 所以我陷入了如何执行此操作的
  • 调用response.getStatus()时出现NoSuchMethodError

    我想这是某种依赖性问题 所以这是我的树 INFO Sikor BrowserGame war 1 0 SNAPSHOT INFO junit junit jar 3 8 1 test INFO org springframework spr