struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin.Bed...@sunlife.com
Subject RE: Error while initializing ActionServlet
Date Mon, 21 Oct 2002 23:26:25 GMT





This is a lttle bit funky.

Assuming you are using 1.1beta2, it turns out that the particular ServletException is thrown
in the ActionServlet in only 1 place - which is in this
method:


    protected ApplicationConfig initApplicationConfig
        (String prefix, String path) throws ServletException {

        if (log.isDebugEnabled()) {
            log.debug("Initializing application path '" + prefix +
                "' configuration from '" + path + "'");
        }

        // Parse the application configuration for this module
        ApplicationConfig config = null;
        InputStream input = null;
        String mapping = null;
        try {
            config = new ApplicationConfig(prefix);

            // Support for module-wide ActionMapping type override
            mapping = getServletConfig().getInitParameter("mapping");
            if (mapping != null) {
                config.setActionMappingClass(mapping);
            }

            Digester digester = initConfigDigester();
            digester.push(config);
            URL url = getServletContext().getResource(path);
            InputSource is = new InputSource(url.toExternalForm());
            input = getServletContext().getResourceAsStream(path);
            is.setByteStream(input);
            digester.parse(is);
            input.close();
            getServletContext().setAttribute
                (Action.APPLICATION_KEY + prefix, config);
        } catch (Throwable t) {
            log.error(internal.getMessage("configParse", path), t);
            throw new UnavailableException
**-->                (internal.getMessage("configParse", path));
        } finally {
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {
                    ;
                }
            }
        }

I've noted where it is thrown with the **--> above.

Not that I'm an expert, but it looks as if:

 - Your log should show a couple messages - the two generated by the
'log.error()' method calls here. Looking for these entries in your log
(assuming you have debug turned on) would be useful.

 -  The path /WEB-INF/struts-config.xml is likely correct, so that
eliminates the path-oriented problems.



You indicated that you're getting these issues only when running the Cactus
tests. Are you getting this problem if you actually run the struts app? If
this occurred whenever you tried to initialize the Struts ActionServlet in
your struts app, you literally wouldn't be able to do anyhting. The Struts
ActionServlet wouldn't load.

So if you can run Struts at all - without running the cactus tests - then
the issue is specifically cactus related - not related nec. to your
struts-config.xml file.

Given all this, I'd bet that you've got a classpath issue related to
Cactus. Either you've got multiple versions of the digester.jar file or
literally a XML parser conflict.



I'd go over my cactus classpath. Remember, the Cactus classpath is in the
Tomcat web application that is running the cactus code, not the classpath
in your Ant script. Your Ant script classpath has nothing to do with this.

Look in all the places you're cactus webapp classpath is constructed from
in Tomcat - in your web-inf/lib, TOMCAT_HOME/lib, TOMCAT_HOME/common/lib,.
etc.

Best of luck -
Kevin






"James Mitchell" <jmitchtx@telocity.com> on 10/21/2002 06:22:13 PM

Please respond to "Struts Users Mailing List"
       <struts-user@jakarta.apache.org>

To:    "Struts Users Mailing List" <struts-user@jakarta.apache.org>
cc:     (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:    RE: Error while initializing ActionServlet


I just ran the test suite for 3.2, 4.0 and 4.1 and only experienced failure
for 3.2.  (but then my 4.0 was 4.0.6)

Can you retry your test with ant's -debug switch?  May are may not provide
further detail.



James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org




> -----Original Message-----
> From: Vikas Malla [mailto:malla6um@yahoo.co.in]
> Sent: Monday, October 21, 2002 6:18 PM
> To: Struts Users Mailing List
> Subject: RE: Error while initializing ActionServlet
>
>
>
> I am using tomcat 4.0.3 and ant 1.5 with struts 1.1b2. What
> should be the right combination? Any ideas?
>
> Thanks.
>
>  Kevin.Bedell@sunlife.com wrote:
>
>
> http://strutstestcase.sourceforge.net/faq.htm
>
> You know, it's possible I spoke too soon.
>
> The error I was thinking of was the first on in the faq (
> http://strutstestcase.sourceforge.net/faq.htm ) which is actually:
>
> "Missing configuration resource for path /WEB-INF/struts-config.xml"?
>
> Oops...
>
> Anyway, looking at the source code for StrutsTestCase:
>
> public ActionServlet getActionServlet() {
> init();
> try {
> if (!actionServletIsInitialized) {
> // the RequestProcessor holds on to the ServletContext, so
> // we need to ensure that it is replaced for each test.
> ServletContext context = config.getServletContext();
> String name = "org.apache.struts.action.REQUEST_PROCESSOR";
>
> Object obj = context.getAttribute(name);
> if (obj != null) {
> config.getServletContext().setAttribute(name, null);
> }
> this.actionServlet.init(config);
> actionServletIsInitialized = true;
> }
> return this.actionServlet;
> } catch (ServletException e) {
> **--> throw new AssertionFailedError(
> "Error while initializing ActionServlet: " + e.getMessage());
> }
> }
>
>
> Here's the particular exception that was thrown flagged with the "**-->".
>
> It looks as if it throws ServletException when initializing the
> ActionServlet at: this.actionServlet.init(config) - in other words, when
> it actually runs the ActionServlet init() method.
>
>
>
> Are you using the correct version of strutstestcase for your servlet
> container and struts version?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Kevin.Bedell@sunlife.com on 10/21/2002 05:51:40 PM
>
> Please respond to "Struts Users Mailing List"
>
>
> To: "Struts Users Mailing List"
> cc: (bcc: Kevin Bedell/Systems/USHO/SunLife)
> Subject: RE: Error while initializing ActionServlet
>
>
>
>
>
> This is a common error.
>
> When using StrutsTestCase you need to have the path: '
> /WEB-INF/struts-config.xml' on your class path. That is, it looks
> literally
> for the directory /WEB-INF on the classpath.
>
> Modify your class path to add the directory directly above 'WEB-INF' to
> your classpath and it should work.
>
> Kevin
>
>
>
>
>
>
>
>
>
>
> Vikas Malla on 10/21/2002 05:46:33 PM
>
> Please respond to "Struts Users Mailing List"
>
>
> To: Struts Users Mailing List
> cc: (bcc: Kevin Bedell/Systems/USHO/SunLife)
> Subject: RE: Error while initializing ActionServlet
>
>
> ant-1.5.
> James Mitchell wrote:What version of Ant are you
> using?
>
>
>
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org
>
>
>
>
> > -----Original Message-----
> > From: Vikas Malla [mailto:malla6um@yahoo.co.in]
> > Sent: Monday, October 21, 2002 5:11 PM
> > To: Struts Users Mailing List; me@howardmiller.co.uk
> > Subject: Re: Error while initializing ActionServlet
> >
> >
> >
> > It gives me no errors.
> > The console validates my xml without any problems.
> > What else can be the reason?
> > Howard Miller wrote:Errr....
> >
> > it means what is says... there is an error in your struts-config.xml
> file.
> >
> > The best advice I can give is to get hold of Struts Console at...
> >
> > http://www.jamesholmes.com/struts/console/
> >
> > This should sort you out!
> >
> > Howard Miller
> >
> > On 21 Oct 2002 at 20:51, Vikas Malla wrote:
> >
> > >
> > > I was able to run the MockStrutTestCase example.
> > >
> > > I was trying to run my application using CactusStrutTestCase
> > but this is the error I am getting:
> > >
> > > [junit] Testcase: testSuccessfulLogin took 0.611 sec
> > > [junit] FAILED
> > > [junit] Error while initializing ActionServlet: Parsing error
> > processing res
> > > ource path /WEB-INF/struts-config.xml
> > > [junit] junit.framework.AssertionFailedError: Error while
> > initializing Actio
> > > nServlet: Parsing error processing resource path
> > /WEB-INF/struts-config.xml
> > > [junit] at
> servletunit.struts.CactusStrutsTestCase.getActionServlet(Cact
> > > usStrutsTestCase.java:332)
> > > [junit] at
> servletunit.struts.CactusStrutsTestCase.actionPerform(CactusS
> > > trutsTestCase.java:383)
> > > [junit] at MyTest.testSuccessfulLogin(Unkno
> > > wn Source)
> > > [junit] at
> org.apache.cactus.AbstractTestCase.runServerTest(AbstractTest
> > > Case.java:332)
> > > [junit] at
> org.apache.cactus.AbstractTestCase.runBareServerTest(Abstract
> > > TestCase.java:235)
> > > [junit] at
> org.apache.cactus.server.AbstractWebTestCaller.doTest(Abstrac
> > > tWebTestCaller.java:149)
> > > [junit] at
> org.apache.cactus.server.AbstractWebTestController.dispatch87
> > >
> > _handleRequest(AbstractWebTestController.java;org/apache/cactus/ut
> > il/log/LogAspe
> > > ct.aj(1k):125)
> > > [junit] at
> org.apache.cactus.server.AbstractWebTestController.around87_h
> > >
> > andleRequest(AbstractWebTestController.java;org/apache/cactus/util
> > /log/LogAspect
> > > .aj(1k):1149)
> > > [junit] at
> org.apache.cactus.server.AbstractWebTestController.handleRequ
> > >
> > est(AbstractWebTestController.java;org/apache/cactus/util/log/LogA
> > spect.aj(1k):1
> > > 01)
> > > [junit] at
> org.apache.cactus.server.ServletTestRedirector.dispatch113_do
> > >
> > Post(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspe
> > ct.aj(1k):123)
> > >
> > > [junit] at
> org.apache.cactus.server.ServletTestRedirector.around113_doPo
> > >
> > st(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect
> > .aj(1k):1149)
> > > [junit] at
> org.apache.cactus.server.ServletTestRedirector.doPost(Servlet
> > > TestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):109)
> > > [junit] at
> org.apache.cactus.server.ServletTestRedirector.dispatch112_do
> > >
> > Get(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspec
> > t.aj(1k):96)
> > > [junit] at
> org.apache.cactus.server.ServletTestRedirector.around112_doGe
> > >
> > t(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.
> > aj(1k):1149)
> > > [junit] at
> org.apache.cactus.server.ServletTestRedirector.doGet(ServletT
> > > estRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):92)
> > > [junit] at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > > [junit] at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > > [junit] at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFil
> > > ter(ApplicationFilterChain.java:247)
> > > [junit] at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(Appl
> > > icationFilterChain.java:193)
> > > [junit] at
> org.apache.catalina.core.StandardWrapperValve.invoke(Standard
> > > WrapperValve.java:243)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invokeNext(Standard
> > > Pipeline.java:566)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> > > line.java:472)
> > > [junit] at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
> > > ava:943)
> > > [junit] at
> org.apache.catalina.core.StandardContextValve.invoke(Standard
> > > ContextValve.java:190)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invokeNext(Standard
> > > Pipeline.java:566)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> > > line.java:472)
> > > [junit] at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
> > > ava:943)
> > > [junit] at
> org.apache.catalina.core.StandardContext.invoke(StandardConte
> > > xt.java:2343)
> > > [junit] at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHos
> > > tValve.java:180)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invokeNext(Standard
> > > Pipeline.java:566)
> > > [junit] at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorD
> > > ispatcherValve.java:170)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invokeNext(Standard
> > > Pipeline.java:564)
> > > [junit] at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepor
> > > tValve.java:170)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invokeNext(Standard
> > > Pipeline.java:564)
> > > [junit] at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogVal
> > > ve.java:468)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invokeNext(Standard
> > > Pipeline.java:564)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> > > line.java:472)
> > > [junit] at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
> > > ava:943)
> > > [junit] at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardE
> > > ngineValve.java:174)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invokeNext(Standard
> > > Pipeline.java:566)
> > > [junit] at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
> > > line.java:472)
> > > [junit] at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
> > > ava:943)
> > > [junit] at
> org.apache.catalina.connector.http.HttpProcessor.process(Http
> > > Processor.java:1012)
> > > [junit] at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProc
> > > essor.java:1107)
> > > [junit] at java.lang.Thread.run(Thread.java:484)
> > >
> > >
> > > [junit] TEST appian.awf.qa.TestCactusLogonAction FAILED
> > >
> > > stop.tomcat:
> > > [java] Stopping service Tomcat-Standalone
> > > [runservertests] Server stopped !
> > >
> > > I am running struts 1.1b2. Why is my test failing? I have
> > struts-config.xml in the classpath of my test in ant:
> > >
> > >
> > >
> > > > fork="true">
> > >
> > >
> > >
> > >
> >
> > >
> >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Please let me know.
> > >
> > > Thanks.
> > >
> > > Yahoo! Properties Special Buy, sell, rent...your flat, or even
> > post an ad
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
> > Yahoo! Properties Special Buy, sell, rent...your flat, or even
> > post an ad
>
>
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:
>
> Yahoo! Properties Special Buy, sell, rent...your flat, or even post an ad
>
>
>
>
>
>
> ------------------------------------------------------------------
> ---------
> This e-mail message (including attachments, if any) is intended
> for the use
> of the individual or entity to which it is addressed and may contain
> information that is privileged, proprietary , confidential and exempt
from
> disclosure. If you are not the intended recipient, you are notified that
> any dissemination, distribution or copying of this communication is
> strictly prohibited. If you have received this communication in error,
> please notify the sender and erase this e-mail message immediately.
> ------------------------------------------------------------------
> ---------
>
>
>
> --
> To unsubscribe, e-mail: <
> mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <
> mailto:struts-user-help@jakarta.apache.org>
>
>
>
>
>
>
>
> ------------------------------------------------------------------
> ---------
> This e-mail message (including attachments, if any) is intended
> for the use
> of the individual or entity to which it is addressed and may contain
> information that is privileged, proprietary , confidential and exempt
from
> disclosure. If you are not the intended recipient, you are notified that
> any dissemination, distribution or copying of this communication is
> strictly prohibited. If you have received this communication in error,
> please notify the sender and erase this e-mail message immediately.
> ------------------------------------------------------------------
> ---------
>
>
>
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:
>
>  Yahoo! Properties Special  Buy, sell, rent...your flat, or even
> post an ad


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>







---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message