将在 weblogic 8.1 上运行的 Struts 应用程序部署到 weblogic 11g 时出现问题
如果我在本地 weblogic 8.1 服务器上部署一个ear文件,它工作得很好。但是当我将其部署到Weblogic 11g上时,它给出了错误。
以下是场景 -
应用程序的第一页要求您选择用户。选择用户后,它将执行 RolesAction 并将您带到角色页面,其中与用户关联的角色将以下拉列表形式出现。
一旦我部署 Argus 应用程序并在测试登录页面上选择用户,整个 RolesAction 类就会被执行,但我没有在下拉列表中获取包含与该用户关联的角色的页面,而是在日志文件中收到“错误 404 - 未找到”错误页面出现下面提到的错误。
<Mar 20, 2011 8:20:42 PM GMT> <Error> <HTTP> <BEA-101017> <[ServletContext@406125315[app:ArgusDEV module:ArgusWeb path:/ArgusWeb spec-version:null]] Root cause of ServletException.
java.lang.NoSuchMethodError: org/apache/struts/config/ForwardConfig.getContextRelative()Z
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:298)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
有什么输入吗??
我的 Roles.jsp 的 tld 声明如下:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
您发现 tld 声明有任何问题吗?
想法?
谢谢!
编辑:
应用程序中出现的第一个页面(您在其中选择用户)是 Login.jsp。在此 jsp 中,tld 声明如下: 显示此页面。然而,roles.jsp 页面是给出错误的页面。
Login.jsp tld 声明:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
两个jsp 都具有相同的tld 声明,并且1 显示,而另一个给出错误。
有想法吗?
编辑:
Roles.jsp
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="css/arg.css" />
</head>
<form name="rolesForm" method="post">
<logic:present name="VIEW_BEAN" scope="request">
<logic:notEmpty name="VIEW_BEAN" property="userId" scope="request">
<input type="hidden" name="Id" value="<bean:write name="VIEW_BEAN" property="userId"/>">
</logic:notEmpty>
</logic:present>
<table border="0" cellpadding="1" cellspacing="0" width="95%" bgcolor="#FFFFFF">
<tr>
<td height="19"> </td>
</tr>
<tr>
<td width="100%" align="center" class="epi-dataTableLiteNew">
<font size="2"><b>Select a Role:</b> </font>
<select size="1" name="roleType" class="textbox" ">
<option value="">Select ---</option>
<logic:notEmpty name="VIEW_BEAN" property="roleList" scope="request">
<logic:iterate id="record" name="VIEW_BEAN" property="roleList" scope="request">
<option value="<bean:write name="record" property="roleID"/>"><bean:write name="record" property="roleName"/></b></option>
</logic:iterate>
</logic:notEmpty>
</select>
<input type="submit" value="Submit" onClick="return selectRole()" style="border:1px ridge #000000; height:22px; font-weight:bold cellpadding="0" cellspacing="0" 100%>
<p> </p>
<p> </p>
<p> </p>
</td>
</tr>
</table>
</form>
</body>
</html>
Login.jsp
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
</head>
<%@ page
language="java"
%>
<meta http-equiv="Content-Type" content="text/html" />
<link rel="stylesheet" type="text/css" href="css/arg.css" />
<title>Home</title>
<%
String userid=request.getHeader("user");
String isLoginPage=request.getParameter("isUser");
%>
<!-- Please select the user from the list and press continue: -->
<form name="homePageForm" action="RolesAction.do" method="post">
</form>
</body>
</html>
编辑:
struts-config.xml
<action
path="/roles"
name="HomePageForm"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="request">
<forward name="success" path=".rolespage"/>
</action>
为 url 模式调用的操作位于 spring.xml 文件中。
If I deploy an ear file on my local weblogic 8.1 server, it is working perfectly fine. But when I deploy it on Weblogic 11g, it gives an error.
Here is the scenario –
The first page of the application asks you to select the user. On user selection it will execute the RolesAction and take you to the roles page wherein the roles that are assiociated with the user will come as a drop down.
Once I deploy Argus application and select user on test login page, entire RolesAction class is getting executed but instead of getting page with roles associated to that user in the dropdown, I am getting “Error 404—Not Found” error page and in log file getting below mentioned error.
<Mar 20, 2011 8:20:42 PM GMT> <Error> <HTTP> <BEA-101017> <[ServletContext@406125315[app:ArgusDEV module:ArgusWeb path:/ArgusWeb spec-version:null]] Root cause of ServletException.
java.lang.NoSuchMethodError: org/apache/struts/config/ForwardConfig.getContextRelative()Z
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:298)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:232)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
Any inputs??
My Roles.jsp has the tld declaration as below:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
Do you see any issue wrt the tld declaration?
Thoughts?
Thanks!
EDIT:
The first page that comes up in the application wherein you select the user is the Login.jsp. In this jsp, the tlds are declared as below:
This page is displyed. However, the roles.jsp page is the one that gives the error.
Login.jsp tld declaration:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
Both the jsp's have the same tld declaration, and 1 gets displayed whereas the other one gives an error.
Ideas?
EDIT:
Roles.jsp
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="css/arg.css" />
</head>
<form name="rolesForm" method="post">
<logic:present name="VIEW_BEAN" scope="request">
<logic:notEmpty name="VIEW_BEAN" property="userId" scope="request">
<input type="hidden" name="Id" value="<bean:write name="VIEW_BEAN" property="userId"/>">
</logic:notEmpty>
</logic:present>
<table border="0" cellpadding="1" cellspacing="0" width="95%" bgcolor="#FFFFFF">
<tr>
<td height="19"> </td>
</tr>
<tr>
<td width="100%" align="center" class="epi-dataTableLiteNew">
<font size="2"><b>Select a Role:</b> </font>
<select size="1" name="roleType" class="textbox" ">
<option value="">Select ---</option>
<logic:notEmpty name="VIEW_BEAN" property="roleList" scope="request">
<logic:iterate id="record" name="VIEW_BEAN" property="roleList" scope="request">
<option value="<bean:write name="record" property="roleID"/>"><bean:write name="record" property="roleName"/></b></option>
</logic:iterate>
</logic:notEmpty>
</select>
<input type="submit" value="Submit" onClick="return selectRole()" style="border:1px ridge #000000; height:22px; font-weight:bold cellpadding="0" cellspacing="0" 100%>
<p> </p>
<p> </p>
<p> </p>
</td>
</tr>
</table>
</form>
</body>
</html>
Login.jsp
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
</head>
<%@ page
language="java"
%>
<meta http-equiv="Content-Type" content="text/html" />
<link rel="stylesheet" type="text/css" href="css/arg.css" />
<title>Home</title>
<%
String userid=request.getHeader("user");
String isLoginPage=request.getParameter("isUser");
%>
<!-- Please select the user from the list and press continue: -->
<form name="homePageForm" action="RolesAction.do" method="post">
</form>
</body>
</html>
EDIT:
struts-config.xml
<action
path="/roles"
name="HomePageForm"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="request">
<forward name="success" path=".rolespage"/>
</action>
The action to be called for the url pattern is in the spring.xml file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查应用程序 lib 文件夹以找到 struts-core-1.3.8.jar 以及 struts.jar。正是因为如此,才引发了异常。
struts.jar有forwardConfig类和getContextRelative()方法。
struts-core-1.3.8.jar具有forwardConfig类,但没有getContextRelative()方法。
这是导致问题的原因。
因此删除struts.jar以便使用1.3.8版本。
-- 另外将 struts-extras-1.3.8.jar 添加到应用程序库
-- 在 jsp 中,将标记库 uri 更正为:
这解决了问题
Checked the application lib folder to find struts-core-1.3.8.jar as well as struts.jar. It is because of this that the exception was thrown.
struts.jar has the forwardConfig class and getContextRelative() method.
struts-core-1.3.8.jar has the forwardConfig class , but not the getContextRelative() method.
This was causing the issue.
Therefore remove struts.jar so that 1.3.8 version is used.
-- Additionally add struts-extras-1.3.8.jar to the application lib
-- In the jsp, correct the tag lib uri to:
This solves the problem
请使用上面的标签 lib uri 。希望能解决您的问题。
Please use above tag lib uri . Hope will solve your issue.