File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Solved: Tomcat wont start from Eclipse - java.net.SocketException: select failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Solved: Tomcat wont start from Eclipse - java.net.SocketException: select failed" Watch "Solved: Tomcat wont start from Eclipse - java.net.SocketException: select failed" New topic
Author

Solved: Tomcat wont start from Eclipse - java.net.SocketException: select failed

george st. clair
Greenhorn

Joined: Aug 20, 2008
Posts: 6
Hi, i did have java, tomcat, etc installed and working fine. just recently i installed some SFTP software to setup a Virtual Machine with a similar setup, since returning to my IDE (Eclipse Ganymede) i am unable to start a tomcat 6 server on localhost.

I've since uninstalled everything java and installed the following:

Java 6u7
Java SE Dev kit 6u7
Apache Tomcat 6

The following are set in my env variables:
BASEDIR c:\apache-tomcat-6.0.16\
CATALINA_BASE c:\apache-tomcat-6.0.16\
CATALINA_HOME c:\apache-tomcat-6.0.16\

CLASSPATH C:\Program Files\Java\jdk1.6.0_07;C:\Program Files\Java\jdk1.6.0_07\bin;C:\Program Files\Java\jdk1.6.0_07\lib;C:\Program Files\Java\jdk1.6.0_07\include; <other stuff removed>

JAVA_HOME C:\Program Files\Java\jdk1.6.0_07

JRE_HOME C:\Program Files\Java\jre1.6.0_07\bin

PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem ${ant.home}/bin;C:\Program Files\Java\jdk1.6.0_07\bin;

When i run "Tomcat Manager" (Start > programs > tomcat 6 > monitor tomcat) I get the icon in the taskbar, this tells me that service is manual startup and stopped (as i want it to be), if i tell this to start and check the logs it seems to have started successfully however i am unable to connect to it (windows firewall is disabled, no other firewalls) ie, http://localhost/ does not do anything :-( of course i've edited the server.xml file to use port 80 not 8080 but this problem was there even before that.

What i am actually trying to do is to get this server to work again from within Eclipse. I created a new server within Eclipse (Apache Tomcat 6 on localhost), and then told the server to start. this results in the following (very unlike when i run it from tomcat manager):

20-Aug-2008 17:23:08 org.apache.jk.common.ChannelSocket acceptConnections
WARNING: Exception executing accept
java.net.SocketException: select failed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(Unknown Source)
at java.net.ServerSocket.implAccept(Unknown Source)
at java.net.ServerSocket.accept(Unknown Source)
at org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:306)
at org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:660)
at org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:870)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Unknown Source)

This message is repeated until the Tomcat timeout is reached.

As a test i tried starting the server from tomcat manager and then starting it again from eclipse, the following log shows tomcat manager starting tomcat just fine:

20-Aug-2008 17:29:01 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
20-Aug-2008 17:29:01 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
20-Aug-2008 17:29:01 org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
20-Aug-2008 17:29:01 org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:29:01 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1129 ms
20-Aug-2008 17:29:02 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
20-Aug-2008 17:29:02 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
20-Aug-2008 17:29:02 org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-80
20-Aug-2008 17:29:02 org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:29:02 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1006 ms
20-Aug-2008 17:32:39 org.apache.coyote.http11.Http11AprProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-80
20-Aug-2008 17:32:39 org.apache.coyote.ajp.AjpAprProtocol pause
INFO: Pausing Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:32:40 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
20-Aug-2008 17:32:40 org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-80
20-Aug-2008 17:32:40 org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:34:45 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
20-Aug-2008 17:34:45 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
20-Aug-2008 17:34:45 org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
20-Aug-2008 17:34:45 org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:34:45 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1223 ms
20-Aug-2008 17:34:45 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
20-Aug-2008 17:34:45 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
20-Aug-2008 17:34:46 org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-80
20-Aug-2008 17:34:46 org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:34:46 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1015 ms


which of course, with this started i cannot start another instance of the server on the same ports, the error tells me that some of the ports are already in use.

Ok, so whats going on here?
problem 1) I cant connect to http://localhost/ and view the Tomcat main pages when it has clearly started fine using tomcat manager
problem 2) I cant get Eclpse to start the Tomcat server successfully on its own.

Both of these are things that i could do before.
There are no unusual services running in windows services and no unusual tasks in taskmanager. there are definitely not any other web servers or similar running on this machine.

any help, much appreciated. PS> Winxp SP3 (it was SP3 before too so this cant be the issue)

Regards, George St. Clair

[ August 26, 2008: Message edited by: george st. clair ]

[ August 26, 2008: Message edited by: Bear Bibeault ]

[ August 28, 2008: Message edited by: george st. clair ]
[ August 28, 2008: Message edited by: george st. clair ]

I don't suffer from insanity, i enjoy every minute of it.
george st. clair
Greenhorn

Joined: Aug 20, 2008
Posts: 6
Please help. I need this working desperately!
Mario Minutolo
Greenhorn

Joined: Aug 06, 2008
Posts: 23
Try :

At least we can be sure no ports are already in use.
george st. clair
Greenhorn

Joined: Aug 20, 2008
Posts: 6
Hi Mario,
before i start the tomcat server netstat shows that nothing is using 8080 in any way. After I've started tomcat then the following is happening on those ports:

TCP MAGNESIUM:8009 magnesium:0 LISTENING
TCP MAGNESIUM:8080 magnesium:0 LISTENING
Mario Minutolo
Greenhorn

Joined: Aug 06, 2008
Posts: 23
Originally posted by george st. clair:
Hi Mario,
before i start the tomcat server netstat shows that nothing is using 8080 in any way. After I've started tomcat then the following is happening on those ports:

TCP MAGNESIUM:8009 magnesium:0 LISTENING
TCP MAGNESIUM:8080 magnesium:0 LISTENING


Then, if port 8080 is listening, you should be able to open http://localhost:8080/[webapp-name]

If you have not deployed an application yet you should get a 404 error, which is fine (means tomcat is working, even if you don't find the page).
george st. clair
Greenhorn

Joined: Aug 20, 2008
Posts: 6
I've found out that http://localhost:8080 does not work, however http://127.0.0.1:8080 works fine.

This is when i start Tomcat 6 from Tomcat Manager.

I dont mind using 127.0.0.1 rather than localhost, thats not a problem for me however i wish to start Tomcat (and deploy apps) from Eclipse. This is not working.

from having Tomcat started (and working) i first stop the server and then in eclipse add a new server and start it. i get the following:


26-Aug-2008 16:05:57 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run
SEVERE: Socket accept failed
java.net.SocketException: select failed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:453)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)
at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310)
at java.lang.Thread.run(Thread.java:619)
26-Aug-2008 16:05:57 org.apache.jk.common.ChannelSocket acceptConnections
Mario Minutolo
Greenhorn

Joined: Aug 06, 2008
Posts: 23
Try tcpview TCP View (download), I suspect you have rather some TCP problem then eclipse/tomcat problem.
With tcp view you can 'see' what socket your apps try to open, so you may understand what is failing.

Other then that I think I can't help much more, being a problem of a specific machine, you can do so much without having access to the machine itself.
george st. clair
Greenhorn

Joined: Aug 20, 2008
Posts: 6
thanks for your help Mario, unfortunately i am unable to rectify this problem still, there appears ot be no problems opening ports according to tcp view.
oddly enough i've just tried to run an axis2 server and encountered the exact same error, lucky me.
george st. clair
Greenhorn

Joined: Aug 20, 2008
Posts: 6
problem solved - Uninstall Microsoft TCP/IP v6.
Sumit Pandya
Greenhorn

Joined: Dec 12, 2008
Posts: 1
********** This worked for me BOSS **********

Now the point is to take this issue to Sun Java.... Also this issue require to be circulated on many of Java community web-site.

Believe me I'm struggling to get around on this problme since May 2008 and here you come to save my opinion about Java.

Due to this Ms IPv6 I always face problem with Java based server and ONLY with Java based servers. That means there is problem in JVM/JRE and require to bring into knowledge of Java community before people start cursing Java.

I really don't know any of "influncial" Java community member hence requesting somebody to pick-up this issue seriously and quickly.

You can also see one on my Java support post, which is in same line of BUG. Unfortunately I got internal review ID of 1259803. Even though with follow-up I couldnot got response from them.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Solved: Tomcat wont start from Eclipse - java.net.SocketException: select failed