[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 598
  • Last Modified:

Struts - replacing ActionServlet

Has anyone managed to replace ActionServlet successfully? I've tried to do this by editing web.xml:

    <!--<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>-->
    <servlet-class>ActionsServlet</servlet-class>

and then putting the subclass ActionsServlet into WEB-INF/classes. No go - different error messages depending on the application. Any ideas?
0
CEHJ
Asked:
CEHJ
  • 4
  • 3
2 Solutions
 
jimmackCommented:
If you're using Tomcat, I think there is an issue with servlets that are not in packages.
0
 
CEHJAuthor Commented:
OK - i'll give it a try
0
 
CEHJAuthor Commented:
I think you may be right, although the main problem was that the class was not marked pu blic (Doh - i used a 'class wizard').

A sub-question, so i can give you the points: where *does* this output go:

>>log.debug("Calling init() in custom ActionServlet...");

This appears in web.xml:

    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jimmackCommented:
Err. I'm not certain.

A normal line like

   log("This is a log message")

Is written to the logger that you set up in the server.xml file inside the <Context> for your webapp, eg:

        <Context path="test" docBase="test" debug="0" reloadable="true">
          <Logger className="org.apache.catalina.logger.FileLogger"
                  directory="webapps/test" prefix="testlog." suffix=".txt"
                  timestamp="true"/>

In this case, it would be written to the file webapps/test/testlog_2003_09_11.txt

I'm hesitating here because I haven't used log.debug().

If you don't set up the log file, then I'm not exactly sure where it goes :-(  System.out.printlns go to catalina.out in the /logs directory.

Does this help?
0
 
CEHJAuthor Commented:
Not really - well, a bit. I'm going to have to find out how all these logging apis cooperate (or don't). What an utter pain for something that's meant to help *maintain* code!

Don't take this the wrong way Jim, but i don't think you've *quite* earned your points yet ;-)Maybe i'll keep this one open for a short while - there's bound to be a Struts newb question that I'll have to ask that'll be the clincher for you - OK?
0
 
jimmackCommented:
OK
;-)
0
 
kennethxuCommented:
struts use jakarta common logs. it can be configured to use log4j or j2sdk1.4 log.
http://jakarta.apache.org/commons/logging.html
0
 
CEHJAuthor Commented:
Yes - thanks for that kenneth - i'm getting under the covers with that now anyway, but... a few points for your confirmation ;-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now