You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nanu Khota <na...@rediffmail.com> on 2010/04/01 13:45:42 UTC

Error creating form bean struts 1.2 + weblogic 8.1 + myeclipse 5.5

Hi All,
I am a newbee to struts and trying some hands on it. I was just trying to develop a simple login form but getting following exception on initial run only.
---------------------------------------------------------------------------------------------
SEVERE: Error creating form bean of class com.abc.struts.form.LoginFormjava.lang.NullPointerExceptionat org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212)at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292)at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:191)at org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:477)at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457)at jsp_servlet.__login._jspService(__login.java:196)at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
---------------------------------------------------------------------------------------------
I tried searching thru all forums from last 2 days but could not found any solution to the issue. This seems to be a very common problem but I don't know why its not going away. I am really stuck up.
Below are the listing of files required to analyize the cause of error.
web.xml------------&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"&gt;&lt;web-app&gt;&nbsp; &lt;servlet&gt;&nbsp;&nbsp;&nbsp; &lt;servlet-name&gt;action&lt;/servlet-name&gt;&nbsp;&nbsp;&nbsp; &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt;&nbsp;&nbsp;&nbsp; &lt;init-param&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;config&lt;/param-name&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;&nbsp;&nbsp;&nbsp; &lt;init-param&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;debug&lt;/param-name&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;3&lt;/param-value&gt;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;&nbsp;&nbsp;&nbsp; &lt;init-param&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;detail&lt;/param-name&gt;&nbsp;&nbsp;&nbsp;&
 nbsp;&nbsp; &lt;param-value&gt;3&lt;/param-value&gt;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;&nbsp;&nbsp;&nbsp; &lt;load-on-startup&gt;0&lt;/load-on-startup&gt;&nbsp; &lt;/servlet&gt;&nbsp; &lt;servlet-mapping&gt;&nbsp;&nbsp;&nbsp; &lt;servlet-name&gt;action&lt;/servlet-name&gt;&nbsp;&nbsp;&nbsp; &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;&nbsp; &lt;/servlet-mapping&gt;&nbsp; &lt;welcome-file-list&gt;&nbsp;&nbsp;&nbsp; &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;&nbsp; &lt;/welcome-file-list&gt;&nbsp; &lt;taglib&gt;&nbsp; &nbsp;&lt;taglib-uri&gt;/WEB-INF/struts-html.tld&lt;/taglib-uri&gt;&nbsp; &nbsp;&lt;taglib-location&gt;/WEB-INF/struts-html.tld&lt;/taglib-location&gt;&nbsp; &lt;/taglib&gt;&lt;/web-app&gt;
index.jsp---------......&lt;body&gt;&nbsp;&nbsp;&nbsp; &lt;html:link page="/home.do"&gt;Login&lt;/html:link&gt;&nbsp; &lt;/body&gt;.....
struts-config.xml-----------------&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"&gt;
&lt;struts-config&gt;&nbsp; &lt;data-sources /&gt;&nbsp; &lt;form-beans &gt;&nbsp;&nbsp;&nbsp; &lt;form-bean name="loginForm" type="com.siemens.struts.form.LoginForm" /&gt;
&nbsp; &lt;/form-beans&gt;
&nbsp; &lt;global-exceptions /&gt;&nbsp; &lt;global-forwards /&gt;&nbsp; &lt;action-mappings &gt;&nbsp;&nbsp;&nbsp; &lt;action&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attribute="loginForm"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="loginForm"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path="/empLogin"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scope="request"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="com.siemens.struts.action.EmpLoginAction"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; validate="false" /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;action forward="/Login.jsp" path="/home" /&gt;
&nbsp; &lt;/action-mappings&gt;
&nbsp; &lt;message-resources parameter="com.siemens.struts.ApplicationResources" /&gt;&lt;/struts-config&gt;
Login.jsp---------
&lt;body&gt;&nbsp;&nbsp;&nbsp; &lt;html:form action="/empLogin" method="post" focus="login"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;table border="0"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;Login:&lt;/td&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;html:text property="login" /&gt;&lt;/td&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;Password:&lt;/td&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;html:password property="password" /&gt;&lt;/td&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td colspan="2" align="center"&gt;&lt;html:submit&gt;Login&lt;/html:submit&gt;&lt;/td&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
 p;&nbsp;&nbsp; &lt;/tr&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/table&gt;&nbsp;&nbsp;&nbsp; &lt;/html:form&gt;&nbsp; &lt;/body&gt;
I can also provide the form bean and action class if required but I believe it won't add to solving the problem as the exception occurs when I click on the link on index.jsp and then it tries to render the Login.jsp.
Please help.
Nanu
&nbsp;

RE: Error creating form bean struts 1.2 + weblogic 8.1 + myeclipse 5.5

Posted by adam pinder <ap...@hotmail.co.uk>.
 
seems like form definition isn't in struts config file or properly defined....

----------------------------------------
> Date: Thu, 1 Apr 2010 11:45:42 +0000
> To: user@struts.apache.org
> Subject: Error creating form bean struts 1.2 + weblogic 8.1 + myeclipse 5.5
> From: nanukhota@rediffmail.com
>
> Hi All,
> I am a newbee to struts and trying some hands on it. I was just trying to develop a simple login form but getting following exception on initial run only.
> ---------------------------------------------------------------------------------------------
> SEVERE: Error creating form bean of class com.abc.struts.form.LoginFormjava.lang.NullPointerExceptionat org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212)at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292)at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:191)at org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:477)at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457)at jsp_servlet.__login._jspService(__login.java:196)at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
> ---------------------------------------------------------------------------------------------
> I tried searching thru all forums from last 2 days but could not found any solution to the issue. This seems to be a very common problem but I don't know why its not going away. I am really stuck up.
> Below are the listing of files required to analyize the cause of error.
> web.xml------------<?xml version="1.0" encoding="UTF-8"?><!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>    <init-param>      <param-name>debug</param-name>      <param-value>3</param-value>    </init-param>    <init-param>      <param-name>detail</param-name>   &
> nbsp;  <param-value>3</param-value>    </init-param>    <load-on-startup>0</load-on-startup>  </servlet>  <servlet-mapping>    <servlet-name>action</servlet-name>    <url-pattern>*.do</url-pattern>  </servlet-mapping>  <welcome-file-list>    <welcome-file>index.jsp</welcome-file>  </welcome-file-list>  <taglib>   <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>   <taglib-location>/WEB-INF/struts-html.tld</taglib-location>  </taglib></web-app>
> index.jsp---------......<body>    <html:link page="/home.do">Login</html:link>  </body>.....
> struts-config.xml-----------------<?xml version="1.0" encoding="UTF-8"?><!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>  <data-sources />  <form-beans>    <form-bean name="loginForm" type="com.siemens.struts.form.LoginForm" />
>   </form-beans>
>   <global-exceptions />  <global-forwards />  <action-mappings>    <action      attribute="loginForm"      name="loginForm"      path="/empLogin"      scope="request"      type="com.siemens.struts.action.EmpLoginAction"      validate="false" />          <action forward="/Login.jsp" path="/home" />
>   </action-mappings>
>   <message-resources parameter="com.siemens.struts.ApplicationResources" /></struts-config>
> Login.jsp---------
> <body>    <html:form action="/empLogin" method="post" focus="login">      <table border="0">        <tr>          <td>Login:</td>          <td><html:text property="login" /></td>        </tr>        <tr>          <td>Password:</td>          <td><html:password property="password" /></td>        </tr>        <tr>          <td colspan="2" align="center"><html:submit>Login</html:submit></td>    &nbs
> p;   </tr>      </table>    </html:form>  </body>
> I can also provide the form bean and action class if required but I believe it won't add to solving the problem as the exception occurs when I click on the link on index.jsp and then it tries to render the Login.jsp.
> Please help.
> Nanu
>   		 	   		  
_________________________________________________________________
Send us your Hotmail stories and be featured in our newsletter
http://clk.atdmt.com/UKM/go/195013117/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org