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

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

 
gastonw

Posts: 1
Registered: 1/3/04
Using the Eclipse plugin for Cactus
Posted: Jan 4, 2004 1:25 PM
  Click to reply to this thread Reply

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

vmassol

Posts: 51
Registered: 12/7/03
Re: Using the Eclipse plugin for Cactus
Posted: Jan 8, 2004 5:09 AM   in response to: gastonw in response to: gastonw
  Click to reply to this thread Reply

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

vmassol

Posts: 51
Registered: 12/7/03
Re: Using the Eclipse plugin for Cactus
Posted: Jan 11, 2004 7:33 AM   in response to: gastonw in response to: gastonw
  Click to reply to this thread Reply

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值