设为首页 收藏本站
查看: 666|回复: 0

[经验分享] cactus+jetty+eclipse测试时的Connection refused问题

[复制链接]

尚未签到

发表于 2017-2-27 09:54:44 | 显示全部楼层 |阅读模式
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                                                            
                                                                                               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                     

                                     <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>                 
                                                                                               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                     




                                     <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>                 
                                                                                               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                     

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-347771-1-1.html 上篇帖子: Pure JS (1): 在 jetty 上运行 JavaScript 下篇帖子: 如何在Jetty使用Comet模式提高伸缩性
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表