You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Phlip <ph...@gmail.com> on 2005/09/14 23:24:12 UTC

ChainedRuntimeException: Failed to get the test results at http:...//ServletRedirector

Cactusizers:

I'm trying to get the StrutsTest sample from
http://strutstestcase.sourceforge.net/ working, in NetBeans, with the
CactusStrutsTestCase. After upgrading the project to use that jar,
filling in a bunch of other jars, and tweaking cactus.properties, I
get this familiar error message:

testSuccessfulLogin(TestLoginAction)org.apache.cactus.util.ChainedRuntimeException:
Failed to get the test results at
[http://localhost:8084/StrutsTest//ServletRedirector]

So Google soon leads me to its FAQ:

http://jakarta.apache.org/cactus/faq.html#faq_failed_to_get_test_results

Which tells me to turn on logging using this simple technique:

http://jakarta.apache.org/cactus/integration/manual/howto_config.html#logging

That seems to be saying to write log4j.properties files, with all that
stuff in them.

Then it doesn't say where to put the files. I use the Tomcat bundled
with NetBeans, and there is another Tomcat available.

Please don't just say "on the class path". Where do those files go? or
is there a /reliable/ way to turn logging on from inside the test
case?

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!

Re: ChainedRuntimeException: Failed to get the test results at http:...//ServletRedirector

Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi Phlip,

In article <86...@mail.gmail.com>,
Wed, 14 Sep 2005 14:24:12 -0700,
Phlip <ph...@gmail.com> wrote: 
phlip2005> testSuccessfulLogin(TestLoginAction)org.apache.cactus.util.ChainedRuntimeException:
phlip2005> Failed to get the test results at
phlip2005> [http://localhost:8084/StrutsTest//ServletRedirector]

'//' in the URL may be the cause.
Could you verify that your contextURL is not ends with '/'?


phlip2005> Then it doesn't say where to put the files. I use the Tomcat bundled
phlip2005> with NetBeans, and there is another Tomcat available.
phlip2005> 
phlip2005> Please don't just say "on the class path". Where do those files go?

How about WEB-INF/classes?

Hope this helps,
----
Kazuhito SUGURI

Re: How to turn on logging?

Posted by Phlip <ph...@gmail.com>.
>I don't think it has anything to do with jour Netbeans configuration.

NetBeans has an internal Tomcat.

However, I thought that Cactus tests mocked the server and client, so the 
only configurations they should need are the Test Libraries folder stuff.

> In case it can be useful:
> - check you have a commons-logging.properties file in your src/ (and in 
> your
> futher dist/your_app/WEB-INF/classes) with something like:
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger.
> - check the consistency of the references in your log4j.xml: 
> appender/name,
> logger/appender-ref.

I just added "commons-logging.properties", and the error message did not 
change.

Why doesn't the log4j.xml file say "Log4JLogger" anywhere. That would seem 
to be where they match.

What's the chain of events at startup time? What reads what configuration, 
and what does it do with each line?

> - cactus has a client side and a server side. Check your client and server
> classpaths, if you use logging in both of the sides, are properly
> configured. You need configuration files for both of them.

Is there a downloadable example of the entire system, up and running, with a 
Cactus test and with logging turned on? (Googling for that returns too many 
false hits...)

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!


RE: How to turn on logging?

Posted by Vincent Massol <vm...@pivolis.com>.
> -----Original Message-----
> From: Phlip [mailto:phlip2005@gmail.com]
> Sent: lundi 19 septembre 2005 18:13
> To: Cactus Users List
> Subject: Re: How to turn on logging?
> 
> Vincent Massol wrote:
> 
> > No, this list has nothing to do with StrutsTestCase. For StrutsTestCase
> see,
> > http://strutstestcase.sourceforge.net/. There's a link to their mailing
> > list/forums.
> 
> S'okay. They have no mailing list there, so far as I can tell. The
> closest hit in Yahoo Groups was (cough) this one.

You should really spend more time reading documentation. I have pointed you
to http://strutstestcase.sf.net and you seem not to have read that page. It
clearly and visibly points you to their forum. To make it easy for you, here
it is:

http://sourceforge.net/forum/forum.php?forum_id=121751

 
> > A long time back I had proposed to the strutstestcase project to merge
> with
> > the Cactus project but they didn't want to. That's their right and I
> > understand that. But you need to understand that they are separate
> projects.
> 
> I will have another bash at using raw Cactus without the struts
> testers, but I predict the same vicious cycle of error messages.

Nobody forces you to use Cactus at all...

-Vincent


Re: How to turn on logging?

Posted by Phlip <ph...@gmail.com>.
Vincent Massol wrote:

> No, this list has nothing to do with StrutsTestCase. For StrutsTestCase see,
> http://strutstestcase.sourceforge.net/. There's a link to their mailing
> list/forums.

S'okay. They have no mailing list there, so far as I can tell. The
closest hit in Yahoo Groups was (cough) this one.

> A long time back I had proposed to the strutstestcase project to merge with
> the Cactus project but they didn't want to. That's their right and I
> understand that. But you need to understand that they are separate projects.

I will have another bash at using raw Cactus without the struts
testers, but I predict the same vicious cycle of error messages.

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!

RE: How to turn on logging?

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Phlip,

> -----Original Message-----
> From: Phlip [mailto:phlip2005@gmail.com]
> Sent: lundi 19 septembre 2005 16:07
> To: Cactus Users List
> Subject: Re: How to turn on logging?
> 
> Pedro Nevado wrote:
> 
> > I do not use StrutsTestCase, so I cannot help you in that respect.
> 
> Then why are you on the Cactus mailing list? Isn't that what it's for?

No, this list has nothing to do with StrutsTestCase. For StrutsTestCase see,
http://strutstestcase.sourceforge.net/. There's a link to their mailing
list/forums.

A long time back I had proposed to the strutstestcase project to merge with
the Cactus project but they didn't want to. That's their right and I
understand that. But you need to understand that they are separate projects.

Thanks
-Vincent


	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
T�l�chargez cette version sur http://fr.messenger.yahoo.com

RE: How to turn on logging?

Posted by Pedro Nevado <pn...@javato.com>.
This is not a list for users of StrutsTestCase, specifically; this is why I
am in the Cactus mailing list.
Regards,
Pedro Nevado

-----Mensaje original-----
De: Phlip [mailto:phlip2005@gmail.com]
Enviado el: lunes, 19 de septiembre de 2005 16:07
Para: Cactus Users List
Asunto: Re: How to turn on logging?


Pedro Nevado wrote:

> I do not use StrutsTestCase, so I cannot help you in that respect.

Then why are you on the Cactus mailing list? Isn't that what it's for?

> The code I sent you is for a log4j.xml file, not for log4j.properties
> file.
> The format of the entries are different.

I turned on logging like this:

    Logger aLogger = Logger.getRootLogger();

    PatternLayout layout = new PatternLayout("%d{ABSOLUTE} [%t] %-5p
%-30.30c{2} %x - %m %n");//"%d %x %t %p %l %throwable: %m%n");
        File cactusFile = new File("c:/cactus.log");
        if (cactusFile.isFile())
            cactusFile.delete();

        FileAppender aFileAppender = new FileAppender();
        aFileAppender.setName("cactus_log");
        aFileAppender.setFile("C:/cactus.log");

         aFileAppender.setAppend(true);
         aFileAppender.setImmediateFlush(true);
         aFileAppender.setLayout(layout);
         aFileAppender.activateOptions();
        aLogger.addAppender(aFileAppender);
        aLogger.setLevel(Level.DEBUG);

> I recommend you to run one very simple test, without logging to start
> with,
> and once you have everything right, add logging.

I turned it on due to this error message:

ChainedRuntimeException: Failed to get the test results at
[http://localhost:8084/Foo/ServletRedirector]

The FAQ for that error message says to turn on logging.

Now I have a big log, and I am unaware what to read in it to diagnose the
error!

--
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org




Re: How to turn on logging?

Posted by Phlip <ph...@gmail.com>.
Pedro Nevado wrote:

> I do not use StrutsTestCase, so I cannot help you in that respect.

Then why are you on the Cactus mailing list? Isn't that what it's for?

> The code I sent you is for a log4j.xml file, not for log4j.properties 
> file.
> The format of the entries are different.

I turned on logging like this:

    Logger aLogger = Logger.getRootLogger();

    PatternLayout layout = new PatternLayout("%d{ABSOLUTE} [%t] %-5p 
%-30.30c{2} %x - %m %n");//"%d %x %t %p %l %throwable: %m%n");
        File cactusFile = new File("c:/cactus.log");
        if (cactusFile.isFile())
            cactusFile.delete();

        FileAppender aFileAppender = new FileAppender();
        aFileAppender.setName("cactus_log");
        aFileAppender.setFile("C:/cactus.log");

         aFileAppender.setAppend(true);
         aFileAppender.setImmediateFlush(true);
         aFileAppender.setLayout(layout);
         aFileAppender.activateOptions();
        aLogger.addAppender(aFileAppender);
        aLogger.setLevel(Level.DEBUG);

> I recommend you to run one very simple test, without logging to start 
> with,
> and once you have everything right, add logging.

I turned it on due to this error message:

ChainedRuntimeException: Failed to get the test results at 
[http://localhost:8084/Foo/ServletRedirector]

The FAQ for that error message says to turn on logging.

Now I have a big log, and I am unaware what to read in it to diagnose the 
error!

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!


RE: How to turn on logging?

Posted by Pedro Nevado <pn...@javato.com>.
Phlip,

I do not use StrutsTestCase, so I cannot help you in that respect.
The code I sent you is for a log4j.xml file, not for log4j.properties file.
The format of the entries are different.
Cactus does not mock an application server; in fact, it needs an application
(web) server started and running (you can do that with your ant build.xml
file or starting the server integrated in your IDE).
I recommend you to run one very simple test, without logging to start with,
and once you have everything right, add logging.
Regards,
Pedro Nevado

-----Mensaje original-----
De: Phlip [mailto:phlip2005@gmail.com]
Enviado el: sábado, 17 de septiembre de 2005 21:38
Para: Cactus Users List
Asunto: Re: How to turn on logging?


> - check you have a commons-logging.properties file in your src/ (and in
> your
> futher dist/your_app/WEB-INF/classes) with something like:
>
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger.

Per my other mail, that didn't work. Here's what did.

Download the source to the book /Apache Tomcat Bible/.

Open chapter 17\hello-log4j

Change the "log4j.appender.A1.File" line to "c:/cactus_log4j.txt"

Copy the file log4j.properties to build/test/classes

Copy the file log4j.properties to build/web/WEB-INF/classes

(Note I don't care which one did it...)

Now when I run, the file "c:/cactus_log4j.txt" appears and contains nothing,
and the console logger reveals this:

testExecute(enforcer.actions.LoginActionTest)java.net.ConnectException:
Connection refused: connect

So, now I just need to check my program can run its Login.do action, and
stuff, to see why it was unconnectable.

I thought this Cactus stuff ran client-side, and mocked the servlet stuff.
Should I switch back to MockStrutsTestCase?

> --
>  Phlip
>  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org




Re: How to turn on logging?

Posted by Phlip <ph...@gmail.com>.
> - check you have a commons-logging.properties file in your src/ (and in 
> your
> futher dist/your_app/WEB-INF/classes) with something like:
> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger.

Per my other mail, that didn't work. Here's what did.

Download the source to the book /Apache Tomcat Bible/.

Open chapter 17\hello-log4j

Change the "log4j.appender.A1.File" line to "c:/cactus_log4j.txt"

Copy the file log4j.properties to build/test/classes

Copy the file log4j.properties to build/web/WEB-INF/classes

(Note I don't care which one did it...)

Now when I run, the file "c:/cactus_log4j.txt" appears and contains nothing, 
and the console logger reveals this:

testExecute(enforcer.actions.LoginActionTest)java.net.ConnectException: 
Connection refused: connect

So, now I just need to check my program can run its Login.do action, and 
stuff, to see why it was unconnectable.

I thought this Cactus stuff ran client-side, and mocked the servlet stuff. 
Should I switch back to MockStrutsTestCase?

> --
>  Phlip
>  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!


RE: How to turn on logging?

Posted by Pedro Nevado <pn...@javato.com>.
I don't think it has anything to do with jour Netbeans configuration.
In case it can be useful:
- check you have a commons-logging.properties file in your src/ (and in your
futher dist/your_app/WEB-INF/classes) with something like:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger.
- check the consistency of the references in your log4j.xml: appender/name,
logger/appender-ref.
- cactus has a client side and a server side. Check your client and server
classpaths, if you use logging in both of the sides, are properly
configured. You need configuration files for both of them.

Regards,
Pedro Nevado



-----Mensaje original-----
De: Phlip [mailto:phlip2005@gmail.com]
Enviado el: sábado, 17 de septiembre de 2005 13:11
Para: Cactus Users List
Asunto: Re: How to turn on logging?


Pedro Nevado wrote:


> I think the problem is that you have not an appender-ref entry in your
> configuration. See below.

> <!--Logger for Cactus.-->
> <logger name="org.apache.cactus">
>        <level value="debug"/>
>        <appender-ref ref="FILE_LOG"/>
> </logger>

Agh, this project is frying my brain. Of course I have that line; I wasn't
capable of copying the one line into this friggin' post.

So, _with_ the line, how do you get that error message. Understand I'm
stupid enough to have done _anything_ wrong, including configure NetBeans
wrong, or use its bundled Tomcat, or leave out some silly Jar file...

--
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org




Re: How to turn on logging?

Posted by Phlip <ph...@gmail.com>.
Pedro Nevado wrote:


> I think the problem is that you have not an appender-ref entry in your
> configuration. See below.

> <!--Logger for Cactus.-->
> <logger name="org.apache.cactus">
>        <level value="debug"/>
>        <appender-ref ref="FILE_LOG"/>
> </logger>

Agh, this project is frying my brain. Of course I have that line; I wasn't 
capable of copying the one line into this friggin' post.

So, _with_ the line, how do you get that error message. Understand I'm 
stupid enough to have done _anything_ wrong, including configure NetBeans 
wrong, or use its bundled Tomcat, or leave out some silly Jar file...

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!!


RE: How to turn on logging?

Posted by Pedro Nevado <pn...@javato.com>.
I think the problem is that you have not an appender-ref entry in your
configuration. See below.
Regards,
Pedro Nevado

<!-- File appender -->
    <appender name="FILE_LOG" class="org.apache.log4j.FileAppender">
        <param name="File"
            value="C:/my_logs_dir/log4j_cactus.txt"/>
        <param name="Append" value="false"/>
        <param name="Threshold" value="DEBUG"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="my_pattern"/>
        </layout>
    </appender>
<!--Logger for Cactus.-->
<logger name="org.apache.cactus">
        <level value="debug"/>
        <appender-ref ref="FILE_LOG"/>
</logger>

-----Mensaje original-----
De: Phlip [mailto:phlip2005@gmail.com]
Enviado el: sábado, 17 de septiembre de 2005 8:29
Para: Cactus Users List
Asunto: Re: How to turn on logging?


Pedro Nevado wrote:

> In my development environment, in src/ I have a log4j.xml file with the
> entry
>
> <logger name="org.apache.cactus">
>        <level value="debug"/>
>        <appender-ref ref="FILE_LOG"/>
> </logger>

Muchismas gracias! Now...

log4j:WARN No appenders could be found for logger
(org.apache.cactus.internal.configuration.ConfigurationInitializer).

My entire, dirt-simple log4j.xml file is this:

<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE log4j:configuration SYSTEM "file:./log4j.dtd">

<log4j:configuration>
  <appender name="FILE_LOG" class="org.apache.log4j.RollingFileAppender">
    <param name="MaxFileSize" value="1Mb"/>
    <param name="MaxBackupIndex" value="3"/>
    <param name="file" value="cactus.log"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d [%7r] %6p - %30.30c - %m
\n\r\n\r"/>
    </layout>
  </appender>

<logger name="org.apache.cactus">
        <level value="debug"/>
 </logger>

  <root>
    <priority value="INFO"/>
  </root>
</log4j:configuration>

What's wrong with it? (And was there a real reason the error message
couldn't be more specific??)

--
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org




Re: How to turn on logging?

Posted by Phlip <ph...@gmail.com>.
Pedro Nevado wrote:

> In my development environment, in src/ I have a log4j.xml file with the
> entry
>
> <logger name="org.apache.cactus">
>        <level value="debug"/>
>        <appender-ref ref="FILE_LOG"/>
> </logger>

Muchismas gracias! Now...

log4j:WARN No appenders could be found for logger 
(org.apache.cactus.internal.configuration.ConfigurationInitializer).

My entire, dirt-simple log4j.xml file is this:

<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE log4j:configuration SYSTEM "file:./log4j.dtd">

<log4j:configuration>
  <appender name="FILE_LOG" class="org.apache.log4j.RollingFileAppender">
    <param name="MaxFileSize" value="1Mb"/>
    <param name="MaxBackupIndex" value="3"/>
    <param name="file" value="cactus.log"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d [%7r] %6p - %30.30c - %m 
\n\r\n\r"/>
    </layout>
  </appender>

<logger name="org.apache.cactus">
        <level value="debug"/>
 </logger>

  <root>
    <priority value="INFO"/>
  </root>
</log4j:configuration>

What's wrong with it? (And was there a real reason the error message 
couldn't be more specific??)

-- 
  Phlip
  http://www.greencheese.org/ZeekLand  <-- NOT a blog!!