Unable to run junit tests in Eclipse - windows

I and my colleagues have an intermittent problem running junit tests or tomcat from within Eclipse.
Sometimes the tests will run.
Sometimes they will not.
There appears to be no pattern and we are not in sync. IE mine might run and others will fail.
Stopping/starting Eclipse can resolve the issue (sometimes).
Pulling out the network cable ALWAYS resolves the problem (while it is out).
When it fails the following happens.
On trying to run the class the Console screen appears with the red box.
The console screen stays blank for about 30 seconds and then the following appears:
Could not connect to: : 2083
java.net.ConnectException: Connection
refused: connect at
java.net.PlainSocketImpl.socketConnect(Native
Method) at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at
java.net.Socket.connect(Socket.java:520)
at
java.net.Socket.connect(Socket.java:470)
at
java.net.Socket.(Socket.java:367)
at
java.net.Socket.(Socket.java:180)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:560)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:377)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
The port number varies.
I found a forum post that told me follow this http://support.microsoft.com/kb/135982
But this did not work.
We are all on Microsoft XP based machines connecting to the internet via an
ISA server/proxy.
I am running Eclipse 3.3.3 and MyEclipse 6.0.1
Any ideas please ?

I have concentrated on junit instead of tomcat as it is much quicker & easier to reproduce.
Yep I had seen the McQueeney link with no luck.
We have done some more digging and interestingly when you run junit from Eclipse, Eclipse decides to go & check for updates, Yes that's right - everytime you run a junit (& I guess tomcat and others).
We removed a colleague's access restrictions to the WWW through the ISA server and low & behold the problem disappeared.
We are still monitoring this to see if it is the solution.
Watch this space.
I have tried looking through the Eclipse set up to see if I can stop it trundling off everytime to the WWW but have not seen a suitable option yet.

Some suggestions...:
Did you look at tomcat logs ?
Do you see in them some ClientAbortException: java.net.SocketException: Broken pipe. ?
It looks like the server thinks the client is closing the connection at times.
And like the client is getting the connection reset by the server (connection reset), and the server is not listening sometimes (connection refused).
If you are testing from behind a firewall/proxy server, you may need to provide TomCat with the firewall/proxy server hostname and port number.
Restarting eclipse should be enough:
Apparently the JUnit runner thread in Eclipse attaches to an Eclipse server thread to run the tests. It would seem the client thread was trying to connect to the wrong port (3393) or that the server thread that had been listening on port 3393 for runtime requests failed.
The solution McQueeney found is here (thank you Archive.org!)
One suggestion I find interesting is:
I had to change the jre that my Eclipse project uses to make sure that JUnit and my project were using the same jre. After a restart of Eclipse the error was gone.
I hope you will find a definitive cause for this.

I had the same problem, when my network driver was broken.
JUnit und Eclipse communicate via ICP (InterProcess Communication), better said: via TCP.
To run it successfully, you have repair your network drivers.
Try to reinstall TCP/IP protocols or turn it back to a system restore point.
Good luck!

So your JUnit only works, if there's a connection to the internet?
Or was it a one time action and now, it works without an internet connection?
Strange world... Are there any hints in a log file?

Related

eclipse is waiting forever to start liberty server

I'm using windows 7, eclipse neon.3, liberty server 17.0.0.1, WebSphere® Application Server Liberty Tools 2016.0.0.v20170505_1729
I have a probem when starting the liberty server from eclipse. The server is actually starting fine, but eclipse is just showing the 'Starting'- status and never get confirmation that the server is actually started. After the predefined timeout, eclipse is giving up and stops the server.
If I start the server from command line, everythings works fine and eclipse confirmed that the server is running. Have tried both ibm sdk 8 and oracle.
What is actually the WDT (or eclipse) using for determing the server is started or not ?
WDT is looking for this message from the server: CWWKF0011I: The server is ready to run a smarter planet.
Please check the following link to make sure you have not changed something in the server configuration that is causing the tools to miss the message:
https://www.ibm.com/support/knowledgecenter/en/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/r_limitations.html

ColdFusion Builder 3 debugging

I really like the new ColdFusion Builder, but am running into trouble configuring debugging. I've gone through the tutorials on setting up a project and a ColdFusion Server. Everything seems fairly straightforward. I have a standard CF 10 install running on IIS.
Here are my CF Server settings:
Application Server: defaulted to CF+Tomcat Bundle; not sure how to tell if it should be something different
Server home: C:\ColdFusionBuilder3\ColdFusion\cfusion
Document root: C:\inetpub\wwwroot
RDS is enabled, and I am able to start the CF server; however, if I run the project I get a blank page, and I see the error below in the Console. Not sure how to fix it, though. Any help would be greatly appreciated!
[defaultLocal]:Listening for transport dt_socket at address: 6006
[defaultLocal]:(06/10 at 08:53:26) Server is available. Getting server settings.
[defaultLocal]:FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
[defaultLocal]:ERROR: transport error 202: bind failed: Address already in use
[defaultLocal]:ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
[defaultLocal]:JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
I could only get this working by setting it up as a remote server when using IIS since I have coldfusion running as a windows service. I use port 80.
Also, note that CFBuilder 3, which is extremely buggy, forgets your remote server every time you shut down Eclipse. They are supposed to be patching this. I am very disappointed that we spent any money on this garbage software. Unfortunately, there aren't any IDEs that understand ColdFusion 10+ other than text editors such as Sublime.

nginx php-fpm xdebug netbeans can start only one debug session

In the past, I've used apache+mod_php+xdebug+netbeans for development my website (server is my local machine, running Debian Squeeze), with pleasure - xdebug worked just as expected, debug sessions could be started and stopped any time, when I need it. But, when I moved to nginx+php_fpm+xdebug+netbeans I've experienced some problems with debugging.
My debug session could be very long (much more than 30 seconds) and it seems, that nginx couldn't wait so long, it shows "504 Gateway timeout error". I've tried lots of recommendations for solve this, but no luck. Though, it is not a very important for me, because of debugging session itself continues to run, and it's just a little uncomfortable thing.
My debug session could be run only once, so, if I stop it, and try to launch debugging again, netbeans couldn't accept connection from xdebug (it writes "Waiting for xdebug connection" and it is forever). After restart of netbeans the debug session could be started again normally.
In come cases, that I couldn't understand, the debugging is "turning on for all php scripts" and prevent's any other scripts to run. For example, I start debug session on my website's http://mysite.local/index.php and working with it. After some time, I noticed, that my adminer (placed on intranet.local/adminer.php) doesnt run, the browser tries to load page for some time, and than shows "504 Gateway timeout error". If I see this behavior, I could just stop xdebug debug session in netbeans, and all other scripts starting to operate normally.
Now, when I writing this question, I made some investigations, and found, that, if I start debug session for some seconds, after that stop it, and start again - it starts normally. It seems like the problem appears after some time of active debugging.
My system and apps:
Debian squeeze:2.6.32-5-686
Nginx: 1.4.1 (from dotdeb repository)
php5-fpm: 5.3.26-1~d (from dotdeb repository)
php5-xdebug: 5.3.26-1~d (from dotdeb repository)
netbeans: 7.3
My config:
nginx base config: https://gist.github.com/MihanEntalpo/6229801
nginx website config file: https://gist.github.com/MihanEntalpo/6229781
fastcgi_params file: https://gist.github.com/MihanEntalpo/d93fd4105573e1eda56f
php-fpm pool config file: https://gist.github.com/MihanEntalpo/6229820
php-fpm xdebug config file: https://gist.github.com/MihanEntalpo/6229836
netbeans: options, that was just the same with apache server:
Break on first line = OFF
Evalution in popup window = ON
Show requesting URL's = ON
Port = 9000
Record in nginx's error log file, when it cannot wait for script being debugged, or other script, locked by the problem #3, mentioned early:
2013/08/14 14:40:16 [error] 4822#0: *111 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.100.1, server: intranet.local, request: "GET /adminer.php?username=root&db=devel&table=user HTTP/1.1", upstream: "fastcgi://127.0.0.1:9999", host: "intranet.local", referrer: "https://intranet.local/adminer.php?username=root&db=devel"
php-fpm's logs doesn't contains ANY error messages...
I don't like to disturb anyone with my problems, and always trying to solve it by myself. But in this case, I'm fighting with this ones for some MONTHS without luck...
If anyone faced this problems, or have working config for using with nginx+php-fpm+xdebug+netbeans - please help me :)
Thank you, everyone who tried to think in the direction of my problem.
I've solve it successfully.
First problem (with 504 error) could be solved by nginx option fastcgi_read_timeout, for example, it could be fastcgi_read_timeout 600; for tell nginx that it should wait for 600 seconds. It should be placed to host's config file, or to /etc/nginx/fastcgi_params (in Debian)
Second problem was caused by option in my xdebug.conf: xdebug.remote_autostart=1;, it should be xdebug.remote_autostart=0;. I doesn't understand the real meaning of this option, but it does following: Any php script automatically trying to connect to debugger (netbeans in my case). So, in some case, netbeans loses a connection, and when I press "Start debugging", it doesn't know, that new connection should be opened, and waiting for xdebug client forever. Now, with the mentioned option, I can start and stop debugging any time when I need it.
Third problem had the same source, as the second one. All others scripts, running on my server have tried to connect to netbeans, but with lost connection it was senseless.
Anyway, I hope this would help someone, who want to solve similar problems. StackOverflow helped me by forcing me to definitely describe my problem, and in this process I've gained new ideas on what to try.
When updating fastcgi_read_timeout you can increase the time limit for all sites on the server (vagrant homestead VM in my case) you can do the following once you've SSH'd into your VM:
sudo pico /etc/nginx/nginx.conf
and add
fastcgi_read_timeout 300;
to the http section.
For everyone having the same problem where the accepted answer did not work, in my case, it was a recently installed application that was blocking xdebug.
My company has remote access to install security software on my laptop so they installed ESET Endpoint Security.app and ESET Remote Administrator Agent.app which apparently also filters localhost connections. It took me two days until I finally noticed that there was an ESET daemon running and blocking connections on 127.0.0.1:9000.
The solution was to move to trash both applications since I don't have the necessary admin privileges to disable filtering in the application settings.

Does Knopflerfish OSGi desktop require a connection to www.knopflerfish.org?

I'm trying a tutorial for OSGi that uses the knopflerfish desktop. Today, it hangs when I try to open a local .jar file to install it as a new bundle. It spits out a message on the console
[stderr] Error when connecting to 'http://www.knopflerfish.org/releases/3.1.0/repository.xml': java.net.ConnectException: Connection timed out: connect
and indeed, www.knopflerfish.org seems to be down today. It there no way to use this tool without a connection to the mothership?
You can still use the Knopflerfish Desktop. The missing connection should not keep you from using the desktop since you can also use it when you are working offline.
The Knopflerfish web site is/was down as mentioned in a blog post by Christer Larsson (see http://knopflerfish.blogspot.com/2011/03/knopflerfish-web-site-temporarily-down.html )

Postgres ODBC: connection "actively refused"

I'm using SSH tunneling to connect from a Windows 7 machine to a remote Postgres database.
The tunnel works fine when I use pgAdmin to connect to the remote database. However, I haven't managed to set up an ODBC DSN to connect to the remote database.
I'm creating a System DSN with the same server address/username/password/port/ssl mode as pgAdmin but when I click "Test" I get: "Could not connect to server; No connection could be made because the target machine actively refused it."
Any ideas on where to start debugging? I've ruled out Windows Firewall and remote server configuration, since I can connect with the exact same information in pgAdmin.
Edit
The problem resolved itself after reinstalling Windows.
When debugging this the first thing to do is to start testing the PostgreSQL server with the psql command line utility. This avoids issues of drivers etc to see what is actually going on. Generally speaking my troubleshooting process is:
Can I ping the server?
Can I connect with psql?
When I test my connection via the control panel, does it work?
Now, assuming the problem is on #2, the first thing I would do is try disabling firewalls on both sides (they can be brought up and tuned after trying with both down). This rules out misbehaving firewalls and if it shows this to be a problem then you have the answer on where to troubleshoot.
In my experience Windows firewall can cause all manner of problems. I have even seen it block web pages halfway through the web page. I don't think you can rule out Windows Firewall based on the information you have provided.
If this happens again, the first things to do include disabling both any antivirus software and firewalls.
The other possibility would be a bad ODBC config (maybe port 5423 instead of 5432) or a badly installed DLL of some sort. The latter may be fixed (or not) using sfc /scannow or reinstalling the odbc driver, or other actions.

Resources