Struts project with DynaValidatorForm gives HTTP status 500 error - "Resources cannot be null"
<p>I'm learning Struts and I've created a project with maven + hibernate + Struts.. When I run the project the JSP loads but when I submit the data, it gives me the following error -</p>

<blockquote>
  <p>HTTP Status 500 - java.lang.IllegalArgumentException: Resources cannot be null.</p>
</blockquote>

<p>I tried my best but I cannot find what's wrong with it. Below are my source codes.</p>

<p>Web.xml :-</p>

<pre><code>&lt;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"&gt;

&lt;welcome-file-list&gt;
    &lt;welcome-file&gt;Customer.jsp&lt;/welcome-file&gt;
&lt;/welcome-file-list&gt;

&lt;servlet&gt;
    &lt;servlet-name&gt;action&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt;

    &lt;init-param&gt;
        &lt;param-name&gt;config&lt;/param-name&gt;
        &lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt;
    &lt;/init-param&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
&lt;/servlet&gt;

&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;action&lt;/servlet-name&gt;
    &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
</code></pre>

<p></p>

<p>Struts-config.xml :-</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE struts-config PUBLIC       "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"        "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd"&gt;

&lt;struts-config&gt;
    &lt;form-beans&gt;
        &lt;form-bean name="customerActionForm" type="org.apache.struts.validator.DynaValidatorForm"&gt;
            &lt;form-property name="name" type="java.lang.String"&gt;&lt;/form-property&gt;
            &lt;form-property name="age" type="java.lang.String"&gt;&lt;/form-property&gt;
            &lt;form-property name="contactNo" type="java.lang.String"&gt;&lt;/form-property&gt;
            &lt;form-property name="email" type="java.lang.String"&gt;&lt;/form-property&gt;
        &lt;/form-bean&gt;
&lt;/form-beans&gt;

&lt;action-mappings&gt;
    &lt;action path="/register" name="customerActionForm" parameter="parameter" type="com.openarc.struts.action.CustomerAction" input="Customer.jsp"&gt;
        &lt;forward name="success" path="index.jsp"&gt;&lt;/forward&gt;
    &lt;/action&gt;
&lt;/action-mappings&gt;

&lt;message-resources parameter="errors"/&gt;
</code></pre>

<p></p>

<p>errors.properties (used before for validator framework)</p>

<pre><code>label.name = Name
label.age = Age
label.contactNo = Contact Number
label.email = Email
</code></pre>

<p>Customer.jsp :-</p>

<pre><code>&lt;body&gt;
    &lt;html:form action="register"&gt;
        &lt;table&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;bean:message key="label.name"/&gt; &lt;/td&gt;
                &lt;td&gt;&lt;html:text property="name"&gt;&lt;/html:text&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;bean:message key="label.age"/&gt; &lt;/td&gt;
                &lt;td&gt;&lt;html:text property="age"&gt;&lt;/html:text&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;bean:message key="label.contactNo"/&gt; &lt;/td&gt;
                &lt;td&gt;&lt;html:text property="contactNo"&gt;&lt;/html:text&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;bean:message key="label.email"/&gt; &lt;/td&gt;
                &lt;td&gt;&lt;html:text property="email"&gt;&lt;/html:text&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;/td&gt;
                &lt;td&gt;&lt;html:submit property="parameter" value="Create Customer"&gt;&lt;/html:submit&gt; &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/html:form&gt;
&lt;/body&gt;
</code></pre>

<p>CustomerAction.java :-</p>

<pre><code>public class CustomerAction extends DispatchAction{

    public ActionForward createCustomer(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        DynaActionForm dynaForm = (DynaActionForm)form;

        Customer customer = new Customer();
        customer.setCustomerId(1);
        customer.setName(dynaForm.getString("name"));
        customer.setAge(Short.parseShort(dynaForm.getString("age")));
        customer.setContactNo(dynaForm.getString("contactNo"));
        customer.setEmail(dynaForm.getString("email"));

        CustomerDAO customerDAO = new CustomerDAO();
        customerDAO.createCustomer(customer);

        return mapping.findForward("success");
    }
}
</code></pre>

<p>CustomerDAO.java :-</p>

<pre><code>public class CustomerDAO {

    public Customer createCustomer(Customer customer){
        Transaction transaction = null;
        try{
            Session session = HibernateUtil.openSession();
            transaction = session.beginTransaction();
            session.save(customer);
            session.flush();
            transaction.commit();
            session.close();
        }catch(Exception e){
            transaction.rollback();
            e.printStackTrace();
        }finally{
            HibernateUtil.closeSession();
        }
        return customer;
    }
}
</code></pre>

<p>HibernateUtil.java :-</p>

<pre><code>public class HibernateUtil {
    private static final SessionFactory SESSIONFACTORY = createSessionFactory();
    private static final ThreadLocal&lt;Session&gt; THREADLOCAL = new ThreadLocal&lt;Session&gt;();

    private static SessionFactory createSessionFactory() {
        try{
            return new Configuration().configure().buildSessionFactory();
        }catch(HibernateException e){
             System.err.println("Initial SessionFactory creation failed." + e);
             throw new ExceptionInInitializerError(e);
        }
    }

    public static Session openSession(){
        Session session = THREADLOCAL.get();
        if(session == null){
            session = SESSIONFACTORY.openSession();
            THREADLOCAL.set(session);
        }
        return session;
    }

    public static void closeSession(){
        Session session = THREADLOCAL.get();
        if(session.isOpen()){
            session.close();
            THREADLOCAL.remove();
        }
    }
}
</code></pre>

<p>It seems a famous error when I search the internet, but I cannot find what exactly is wrong with my code. Any help will be appreciated. </p>