cactus+jetty+eclipse测试时的Connection refused问题

http://www.manning-sandbox.com/thread.jspa?messageID=483

<nobr><a href="http://www.manning-sandbox.com/profile.jspa?userID=155" title="gastonw">gastonw</a> </nobr>

Posts: 1
Registered: 1/3/04
Using the Eclipse plugin for Cactus
Posted: Jan 4, 2004 1:25 PM

Hi,

First let me say I am really enjoying JUnit in Action. It's been a great help to me in learning about JUnit and Cactus. I bought JUnit in Action mainly to learn about Cactus, and I've currently read the book, downloaded the source and done all the examples up to Chapter 9. So far so good.

Since I do most of my development and unit testing in Eclipse, I wanted to try running the examples from Chapter 9, using the Eclipse plugin, instead of Maven. Here are the steps I did:

1) From a clean workspace, imported the junitbook-servlets, junitbook-container (as a reference) and junitbook-repository projects from the JUnit in Action source into Eclipse.

2) Downloaded and installed the last nightly builds for the two Eclipse plug-ins, jakarta-cactus-eclipse-webapp-20030909.zip and jakarta-cactus-eclipse-runner-13-1.6dev-20030907.zip. These were the latest builds I could find.

3) I added all the jars to the junitbook-servlets project as described in the Cactus Eclipse Plugin configuration at http://jakarta.apache.org/cactus/integration/eclipse/index.html using the versions of the jars from the junitbook-repository project imported from the JUnit in Action source files.

Now for my question. What is the next step to run the Cactus Unit tests in Eclipse with Jetty?

I tried running the TestAdminServlet.java unit test by selecting it and selecting Run ->Run As ->Cactus Test from the menu, I get the following error: java.net.ConnectException: Connection refused: connect.

My guess is that this is because Jetty did not start before the Cactus unit test ran.

Do I need to configure the Cactus plugin somehow to tell it to automatically start Jetty for me before running the Cactus tests? Do I need to set up something in Cactus Preferences or in a cactus properties file? I went to the Prefences for Cactus and the checkbox for Jetty is checked.

(I was able to create a TestAllWithJetty.java class and run the Cactus tests for Chapter 9 that way, but I'd like to learn how to use the Eclipse plugin. I've also searched through the book and the index, and although the plugin is mentioned several places, I haven't found a example on how to use it.)

I think I'm overlooking something simple, and I hope all I need is a push in the right direction.

Thanks much,
Gaston

<nobr><a href="http://www.manning-sandbox.com/profile.jspa?userID=17" title="vmassol">vmassol</a> </nobr>

Posts: 51
Registered: 12/7/03
Re: Using the Eclipse plugin for Cactus
Posted: Jan 8, 2004 5:09 AM <nobr><a href="http://www.manning-sandbox.com/message.jspa?messageID=381#381" title="Go to message"><img width="10" height="10" border="0" src="http://www.manning-sandbox.com/images/up-10x10.gif" alt="in response to: gastonw"></a> in response to: <a href="http://www.manning-sandbox.com/message.jspa?messageID=381#381" title="Go to message">gastonw</a> </nobr><nobr></nobr>

Hi Gaston,

I'm really glad you like the book!

WRT the Eclipse plugin for Cactus, you have to know that it is very experimental (it's one of the reason I didn't expand on it in the book). However I do believe it's working at least with Jetty. Let me try it and come back to you (i'll need a few days - say 3-4 days).

I'd also suggest we continue this discussion on the Cactus mailing list as it may be useful to others and they may also provide feedback about their own experience about using the Eclipse plugin.

Thanks
-Vincent

<nobr><a href="http://www.manning-sandbox.com/profile.jspa?userID=17" title="vmassol">vmassol</a> </nobr>

Posts: 51
Registered: 12/7/03
Re: Using the Eclipse plugin for Cactus
Posted: Jan 11, 2004 7:33 AM <nobr><a href="http://www.manning-sandbox.com/message.jspa?messageID=381#381" title="Go to message"><img width="10" height="10" border="0" src="http://www.manning-sandbox.com/images/up-10x10.gif" alt="in response to: gastonw"></a> in response to: <a href="http://www.manning-sandbox.com/message.jspa?messageID=381#381" title="Go to message">gastonw</a> </nobr><nobr></nobr>

Hi Gaston,

You appear to be doing everything right except one little item.

I believe the reason for the "java.net.ConnectException: Connection refused: connect" error is because you haven't provided a web.xml containing the Cactus redirectors. You need to right click on your project and then select "properties". Then go to the "Web applications" entry and set the path to your web.xml file (see http://jakarta.apache.org/cactus/integration/eclipse/webapp_plugin.html).

Unfortunately, the Eclipse plugin currently does not automatically add the Cactus redirector so you'll need to add them manually in this file, as explained on http://jakarta.apache.org/cactus/integration/howto_config.html#serverside

Thanks
-Vincent

你可能感兴趣的:(Connection)