anupam.j2ee 0 Newbie Poster

Hello Everybody,

I am a beginner, I am got stuck with following error

at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) 

Actually I am working on Dyna Action Form in struts and need to insert data into database following is code which I have been using

ACTION CLASS

public class DynaAction extends Action {

    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response){


      DynaActionForm  obj=(DynaActionForm) form;
      System.out.println(obj.get("userName"));
      System.out.println(obj.get("passWord"));

      Connection con=null;
      try {
        Class.forName("com.mysql.jdbc.Driver");
        con=DriverManager.getConnection("jdbc:mysql://localhost:3306/struts","root","root");
        String vsql="Insert into login values(?,?)";
        PreparedStatement pstmt=con.prepareStatement(vsql); 
        pstmt.setString(1,(String)obj.get("userName"));
        pstmt.setString(1,(String)obj.get("passWord"));

        if(pstmt.executeUpdate()==1)
            return mapping.findForward("success");

      } catch (Exception e) {
          System.out.println("Some Exception has Occured");
        // TODO: handle exception
      }

        return mapping.findForward("fails");

    }

}

struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
    <data-sources />

    <form-beans>
        <form-bean name="DynaForm" type="org.apache.struts.action.DynaActionForm" >
        <form-property name="userName" type="java.lang.String"></form-property>
        <form-property name="passWord" type="java.lang.String"></form-property>       
        </form-bean>
    </form-beans>

    <global-exceptions />
  <global-forwards />

    <action-mappings>
        <action attribute="LoginForm" path="/LoginForm" type="org.dyna.action.DynaAction"
            name="DynaForm" validate="true" scope="request" input="/login.jsp">
            <forward name="success" path="/success.jsp"></forward>
            <forward name="fails" path="/fails.jsp"></forward>
        </action>

    </action-mappings>
    <message-resources parameter="org.test.ApplicationResources" />
</struts-config>

Any type of help greatly appreciated.
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.