gpt4 book ai didi

java - DWR 3.0.2 Spring 5.1.7 升级 'You must include DWR engine before including this file'

转载 作者:行者123 更新时间:2023-12-02 04:13:32 24 4
gpt4 key购买 nike

环境

Websphere 8.5.5.11
JDK 1.8
DWR
SpringMVC
Oracle DBMS

我们最近升级了我们的项目,并进行了更新

spring.jar,
spring-web.jar,
spring-webmvc.jar
dwr.jar

升级为

spring version 5.1.7
dwr version 3.0.2

我们开始面临多个问题

1. DWR servlet didn't get initialized properly; and complains about Duplicate name found while loading the context, and another problem
our web.xml trying to inialize both servlets i.e. DispacterServlet and DwrSpringServlet
2. After removing spring, spring-web and spring-webmvc and upgrading to latest versions;
web project during compilation and loading complains about missing classes;
spcially one of the .forName methods called during DWR inialization i.e.

java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.forName(Ljava.......

3. engine.js not found where it supposed to be i.e. this error being thrown
'You must include DWR engine before including this file'.

您可以在答案部分找到上述问题的答案。

最佳答案

环境

Websphere 8.5.5.11
JDK 1.8
DWR
SpringMVC
Oracle DBMS
  1. 您需要严格遵守这些http://www.butterdev.com/category/dwr/在 web.xml 和 spring-servlet.xml 中配置 DWR 和 Spring(MVC 或非 MVC)的示例 并且您必须仅加载/配置一个 servlet。
    由于 spring-servlet.xml 被加载两次,发生了重复名称未找到问题; 这篇文章https://www.conqtech.com/blog/?p=85帮助解决问题。
  2. 您必须包含以下所有 jar。

    spring-beans-5.1.7.RELEASE.jar
    spring-context-5.1.7.RELEASE.jar
    spring-context-support-5.1.7.RELEASE.jar
    spring-core-5.1.7.RELEASE.jar
    spring-dao-2.0.8.jar
    spring-expression-5.1.7.RELEASE.jar
    spring-jdbc-5.1.7.RELEASE.jar
    spring-tx-5.1.7.RELEASE.jar
    spring-web-5.1.7.RELEASE.jar
    spring-webmvc-5.1.7.RELEASE.jar
    dwr-3.0.2.jar
    spring-aop-5.1.7.RELEASE.jar
  3. 他们(DWR)团队;进行了更改,以便在 jsp/html 页面中的远程引用 .js 文件之前声明/导入 engine.js 文件。 这篇文章有助于解决问题; https://readthefuckingmanual.net/error/4678/Error-You-must-include-DWR-engine-before-including-this-file .

除了上面的所有编码技巧之外;即使您已经定义了 SimpleUrlHandlerMapping,您也必须按如下方式定义 SimpleUrlHandlerMapping。

<bean 
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property value="true" name="alwaysUseFullPath"></property>
<property name="mappings">
<props>
<prop key="/dwr/**/*">dwrController</prop>
<prop key="/interface/**">dwrController</prop>
</props>
</property>
</bean>

我们按照下面的示例来解决上述问题;

http://www.butterdev.com/category/dwr/

我们确实遇到了一些其他编译问题;但它们很容易理解和解决。

祝你编码愉快!

关于java - DWR 3.0.2 Spring 5.1.7 升级 'You must include DWR engine before including this file',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56675041/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com