struts problem

Discussions

Web tier: servlets, JSP, Web frameworks: struts problem

  1. struts problem (10 messages)

    hi,
     i m testing a simple struts application. i have two jsp. lookup.jsp and quote.jsp. when i enter some value and press submit button in lookup.jsp, it should display the value in the quote.jsp. I configured the struts-config.xml and web.xml. compilation was fine. But when i press submit with the values entered, i m getting a blank page with no values. I don't know what is the error.

    Also is there a way to log or debug the action servlet. I had written system.out.println(""). but nothing came to my console. Do i need to configure anything.

    i m using tomcat3.2, struts1.0

    Regards
    sundar

    Threaded Messages (10)

  2. Re: struts problem[ Go to top ]

    If you have System.out.println, the printout should goto the console. If you don't see anything on your console, plus the fact that you get a blank page, telling me that very likely you configured your xml files incorrectly. Would you please post them here so that I can take a look?
  3. Re: struts problem[ Go to top ]

    If you have System.out.println, the printout should goto the console. If you don't see anything on your console, plus the fact that you get a blank page, telling me that very likely you configured your xml files incorrectly. Would you please post them here so that I can take a look?



    hi all,
     I m getting the following error

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Servlet.init() for servlet action threw exception
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:963)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:479)


    root cause

    java.lang.NullPointerException
    at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1003)
    at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:935)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:479)



    Also i m enclosing the struts-config.xml file
    <struts-config>


    <!-- ======================================== Form Bean Definitions -->


      <form-beans>

        <!-- Logon form bean -->
     <form-bean name="TestFormBean"
                        type="testapp.TestFormBean"/>
    <form-bean name="LookupForm"
                        type="Lookup.LookupForm"/>
                         
      </form-beans>

    <!-- =================================== Action Mapping Definitions -->
    <action-mappings>

     <action path="/TestAction"
                   type="testapp.TestAction"
                   name="TestFormBean"
                   scope="request"
                   validate="false">
          <forward name="success" path="/TestResult.jsp" />
          <forward name="failure" path="/sample.jsp" />
        </action>
    <action path="/Lookup"
                   type="Lookup.LookupAction"
                   name="LookupForm"
                   scope="request"
                   validate="false">
          <forward name="success" path="/Quote.jsp" />
          <forward name="failure" path="/Lookup.jsp" />
        </action>
        
      </action-mappings>

    </struts-config>


    regards
    sundar
  4. Are you catching any exceptions[ Go to top ]

    In your action class are you catching any exceptions.
    Print out these exception. (printStackTrace)

    Also check you mappings.


    In your struts application , logging is also good idea. It is recommended that you use thread safe loggers example, commonslogging and log4j.
  5. problem solved[ Go to top ]

    hi,
     i have solved the problem. Seems there are some problem with struts-config.xml file.

    Thanx for ur help

    regards
    sundar
  6. What was the solution?[ Go to top ]

    Maybe you could post your solution so those of us with the same problem might find a fix...

    MK
  7. I'm having the same problem as well... can you please post the solution so there can be a record of the fix? Thanks.
  8. It was one of those silly things for me. When creating my WAR file, my ant build script wasn't copying over struts-config.xml or any of the other xml files (like validator.xml, etc.). If you're having the same problem, I hope this easy fix does the trick. I've been banging my head against the wall for countless hours over this stupid problem.
  9. How to fix the problem[ Go to top ]

    Hi guys. I just had the same problem. I found that the easiest answer as how to fix this problem is to have a look at your web.xml and determine which xml config files it tries to load, then go and make sure all those xml config files in the web.xml actually exist.
  10. struts problem[ Go to top ]

    if your just starting to use struts then maybe you should move to struts 1.1 and tomcat 4.1.x
  11. struts problem[ Go to top ]

    I'm getting same exception any suggestions?