Getting null pointer exception

Discussion in 'Java' started by shanthikpk@gmail.com, Apr 7, 2006.

  1. Guest

    After migrating from strut 1.0 to Struts 1.1.

    In Struts 1.0 processPopulate method is in ActionServlet there we can
    set all the ActionForm instance. i.e setmethods can be used in
    processpopulate method. But from 1.1 processPopulate method is having
    in RequestProcess. if the same code is keeping in processPopulate
    method formInstance creating but mapping.getPath is comming null value.

    Code:

    ourFormInstance.setRequestCode(mapping.getPath()); //Geting null

    // String remoteAddr = request.getRemoteAddr();


    String publicRemoteIp=request.getParameter("myLocalIp");
    //getting null


    System.out.println("Local Network Ip
    =================================>>>>>>>>>>>>>>>>>>> " +
    publicRemoteIp);

    if(publicRemoteIp!=null)
    {
    System.out.println("Local network IP
    =================================>>>>>>>>>>>>>>>>>>> " +
    publicRemoteIp);
    ourFormInstance.setPublicIpRemateAddr(publicRemoteIp);
    }


    /*String localAddr = request.getLocalAddr();*/
    /*System.out.println("Ramote IP = " + remoteAddr + " Local IP="
    + localAddr);*/

    if (ourSession == null) {
    try {
    InetAddress address =
    InetAddress.getByName(publicRemoteIp);
    System.out.println("now v r in our session value after
    address");

    /* if(publicRemoteIp!=null &&
    publicRemoteIp.equals("127.0.0.1"))
    {
    ourFormInstance.setRemoteAddr(publicRemoteIp);
    }
    else
    {*/
    //ourFormInstance.setRemoteAddr(remoteAddr);
    // ourFormInstance.setRemoteAddr(publicRemoteIp);
    System.out.println("after the setremoteAddress");
    /* }*/
    //ourFormInstance.setRemoteAddr(remoteAddr);
    } catch (UnknownHostException ue) {
    LogTracer.writeDebugLog(className, methodName, ue);
    }

    }

    if (ourSession != null) {
    ourFormInstance.setLoginType(ourSession.getLoginType());
    ourFormInstance.setLoginUser(ourSession.getLoginUser());
    ourFormInstance.setLocNbr(ourSession.getLocNbr());
    ourFormInstance.setRemoteAddr(ourSession.getRemoteAddr());

    System.out.println("ourSession.getRemoteAddr() = local
    network IP" + ourSession.getRemoteAddr());

    //ourFormInstance.setPublicIpRemateAddr(ourSession.getRemoteAddr());
    // START CSO 3.9 06-18-2005 rbl
    // auto populate process date onto form & request bean

    ourFormInstance.setProcessDate(ourSession.getProcessDate());

    ourFormInstance.setLocStateCode(ourSession.getLocStateCd());
    // END CSO 3.9 06-18-2005 rbl
    ourSession.addAction(mapping.getPath());
    }

    Similarly all the set methods in RequestProcessor is comming null
    values. After Executing the loginAction.


    Cheers

    Shanta
    , Apr 7, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    26,614
    Mike Schilling
    Mar 29, 2006
  2. Ken
    Replies:
    69
    Views:
    12,516
    Michael D. Borghardt
    Jul 31, 2004
  3. Ken
    Replies:
    5
    Views:
    2,528
    Victor Bazarov
    Jul 24, 2004
  4. aneuryzma
    Replies:
    3
    Views:
    707
    Jim Langston
    Jun 16, 2008
  5. Christopher
    Replies:
    4
    Views:
    440
    Ruben Safir
    Jul 9, 2011
Loading...

Share This Page