File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Issue with Struts 1.2 and Java 1.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Issue with Struts 1.2 and Java 1.5" Watch "Issue with Struts 1.2 and Java 1.5" New topic
Author

Issue with Struts 1.2 and Java 1.5

murali kankanala
Ranch Hand

Joined: Nov 15, 2004
Posts: 110
Hi Folks,

I am trying to access my Struts web application then i am getting the following Exception.


Error 500--Internal Server Error
javax.servlet.jsp.JspException: Exception creating bean of class test.NameForm: {1}
at org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:487)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457)
at jsp_servlet.__index._jsp__tag0(__index.java:118)
at jsp_servlet.__index._jspService(__index.java:90)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

Is this because of the Struts 1.2 and Java 1.5 compatability problem.

Please help me to resolve this issue.

----------------------------------------------------
Code
----------------------------------------------------
<%@ page language="java" %>
<%@ 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>
<title>Sample Struts Application</title>
</head>
<body>

<html:form action="/Name">
Name: <html:text property="name" />
<html:submit />


</html:form>
</body>
</html>

---------------------------------------------------

package test;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class NameForm extends ActionForm {
private String name = null;
public String getName() {
return (name);
}
public void setName(String name) {
this.name = name;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.name = null;
}
}

---------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="nameForm" type="test.NameForm"/>
</form-beans>

<global-exceptions>
<exception type="java.lang.Exception"
path="/errorpage.jsp"
scope="request"
key="error.system"/>
</global-exceptions>
<action-mappings>
<action path="/Name" type="test.NameAction" name="nameForm" >
<forward name="success" path="/displayname.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>
</action-mappings>

</struts-config>

----------------------------------------------
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>

---------------------------------------------
---------------------------------------------

thanks
Murali
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

murali kankanala wrote:
Is this because of the Struts 1.2 and Java 1.5 compatability problem.


Not at all . the problem due to some other reason . i go through your code , it looks fine for me. just verify your NameForm location
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with Struts 1.2 and Java 1.5