This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 34709 - Unexpected java.net.SocketException
Summary: Unexpected java.net.SocketException
Status: RESOLVED DUPLICATE of bug 29625
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 3.x
Hardware: Macintosh Mac OS X
: P3 blocker (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-01 16:23 UTC by inertia
Modified: 2006-06-05 00:51 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ide.log (291.48 KB, text/plain)
2003-07-01 16:24 UTC, inertia
Details
patched tomcat40 module (522.85 KB, application/octet-stream)
2003-07-07 08:40 UTC, Milan Kuchtiak
Details
server.xml (2.47 KB, text/plain)
2003-07-07 16:59 UTC, inertia
Details
ide.log - attempt 1) without the patched tomcat40.jar, attempt 2) with the patched tomcat40.jar (188.87 KB, patch)
2003-07-09 16:46 UTC, inertia
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description inertia 2003-07-01 16:23:53 UTC
While trying to start a Tomcat application, I got an exception: java.net.SocketException.  
This may have something to do with the fact that I'm behind a wireless NAT AP that's 
being issued IP addresses through DHCP.  When I resolve the IP address, OS X reports a 
different computer name than what it should be.  This could be the root cause, but I'm 
not sure.  Most other applications work just fine.  The computer name is uniblab, but it 
resolves to carrie_2k on our office network.  Not that that is important, but just in case 
there is a match in the log, you'll know why.  (log will be attached)

Stack trace is as follows:

java.net.SocketException: Malformed reply from SOCKS server
	at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:74)
	at java.net.SocksSocketImpl.connectV4(SocksSocketImpl.java:237)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:308)
	at java.net.Socket.connect(Socket.java:426)
	at java.net.Socket.connect(Socket.java:376)
	at java.net.Socket.<init>(Socket.java:291)
	at java.net.Socket.<init>(Socket.java:119)
	at 
org.netbeans.modules.tomcat.tomcat40.Tomcat40Installation.testPortAvailability(Tomca
t40Installation.java:755)
	at 
org.netbeans.modules.tomcat.tomcat40.Tomcat40Installation.createNewTomcatProcess(
Tomcat40Installation.java:919)
	at 
org.netbeans.modules.tomcat.tomcat40.Tomcat40Installation.startServerInExecMode(To
mcat40Installation.java:905)
	at 
org.netbeans.modules.tomcat.tomcat40.Tomcat40Installation.synchronizeStart(Tomcat
40Installation.java:1053)
	at 
org.netbeans.modules.tomcat.tomcat40.Tomcat40Installation.incrementalDeploy(Tomc
at40Installation.java:689)
	at 
org.netbeans.modules.tomcat.tomcat40.Tomcat40Instance.deploy(Tomcat40Instance.ja
va:273)
	at 
org.netbeans.modules.j2ee.impl.DefaultServerInstanceManager.doDeploy(DefaultServerI
nstanceManager.java:120)
	at 
org.netbeans.modules.j2ee.impl.DefaultServerInstanceManager.startExecution(DefaultSe
rverInstanceManager.java:140)
	at 
org.netbeans.modules.j2ee.impl.DefaultServerInstanceManager.serverInstanceStartExec
ution(DefaultServerInstanceManager.java:85)
	at 
org.netbeans.modules.j2ee.impl.DefaultExecPerformer.startExecution(DefaultExecPerfor
mer.java:67)
	at 
org.netbeans.modules.web.execution.WebDefaultExecPerformer.startExecution(WebDefa
ultExecPerformer.java:238)
	at org.netbeans.modules.j2ee.impl.ServerExecutor.execute(ServerExecutor.java:69)
	at org.netbeans.modules.j2ee.impl.ExecSupport.start(ExecSupport.java:122)
	at 
org.netbeans.modules.j2ee.impl.ServerExecSupport.start(ServerExecSupport.java:140)
	at org.openide.actions.ExecuteAction.execute(ExecuteAction.java:140)
	at org.openide.actions.ExecuteAction.execute(ExecuteAction.java:217)
	at org.openide.actions.ExecuteAction.performAction(ExecuteAction.java:102)
	at 
org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:4
31)
	at org.netbeans.core.ModuleActions$1.run(ModuleActions.java:97)
	at org.openide.util.Task.run(Task.java:136)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:670)
Comment 1 inertia 2003-07-01 16:24:24 UTC
Created attachment 10848 [details]
ide.log
Comment 2 Milan Kuchtiak 2003-07-03 08:42:27 UTC
SocketException is thrown, when there is an error
in underlying protocol, such as a TCP error.

The exception is thrown from the code fraction :
try {
    ...
    socket = new java.net.Socket(hostName,port);
    ...
} catch (java.net.ConnectException ex) {
 // everything is OK because cannot create Socket connection
}catch (java.io.IOException ex) {
 // Here the exception message dialog is opened
 // The SocketException is subclass of the IOException  
}

I will farther investigate the Socket() constructor why the
SocketException is thrown.

It seems that given host is not available.
Did you try to change the host ?
Comment 3 Milan Kuchtiak 2003-07-03 09:25:05 UTC
The exception is thrown when trying to read from the socket connection.

I cannot reproduce the bug on my computer.

By the way, we don't support deploying to remote Tomcat server.

Could you attach the server.xml file.
Is the server start/stop action working ? (From Runtime Tab -> Server
Configuration -> Installed Servers -> Tomcat -> Internal Tomcat)
Comment 4 Petr Jiricka 2003-07-04 10:17:37 UTC
Well, the important thing about this code is the fact that method
testPortAvailability(...) is not important for deployment
functionality - it is only there in order to give a friendly error
message in case the ports needed by the server are taken. If this
method fails, then deployment might still succeed. So I would suggest
commenting out the call of testPortAvailability(...) and giving it to
our user (inertia) to test. That way we will see whether the
deployment actually succeeds.

It would also be interesting to put in debug messages which would tell
us which host and port the IDE is trying to connect to.

A possible solution could be to try to connect to localhost instead of
to the actual host name (or, connect to both localhost and the actual
name, and require that at least one of these two attempts succeeds). 

Or, we may consider in some cases to just ignore the exception, and
only log it to the log file (but not to the error window).

BTW, Milan, I am not surprised that you can't reproduce this on PC,
socket behavior tends to be very platform specific. Or could we test
it in our office on a Mac ?
Comment 5 Milan Kuchtiak 2003-07-07 08:40:33 UTC
Created attachment 10869 [details]
patched tomcat40 module
Comment 6 Milan Kuchtiak 2003-07-07 08:47:14 UTC
What I was trying - was playing with different host names (even on
Solaris machine) - either with available or unavailable hosts, but I
was not able to provoke the SocketException.

The attachment contains the tomcat40 module without testing the port
availability and with DEBUG messages (host name, port number).

Please put the tomcat40.jar to netbeans_home/modules directory.
Comment 7 inertia 2003-07-07 16:59:07 UTC
> It seems that given host is not available.
> Did you try to change the host ?

Not that I know of.  But Mac OS X is showing the wrong host name for some reason.  
This only happens at the office when I'm behind the wireless NAT AP.

> By the way, we don't support deploying to remote Tomcat server.

I am testing this locally.

> Could you attach the server.xml file.

Attached.

> Is the server start/stop action working ? (From Runtime Tab -> Server
> Configuration -> Installed Servers -> Tomcat -> Internal Tomcat)


The action of start/stop goes through the motions, and localhost still cannot be 
accessed.

> The attachment contains the tomcat40 module without testing the port
> availability and with DEBUG messages (host name, port number).

Thanks, I'll try it.
Comment 8 inertia 2003-07-07 16:59:45 UTC
Created attachment 10876 [details]
server.xml
Comment 9 inertia 2003-07-09 16:44:40 UTC
Well, I tried the patched tomcat40.jar file.  It did act different, but in the end, Tomcat 
did not start properly.

It acted different in that the original exception was not shown.  But port 8081 did not 
respond.  Here is the console output in NetBeans (and ide.log will be attached):

2003-07-09 08:39:29 WebappLoader[]: Deploying class repositories to work directory /
Users/anthonym/Applications/NetBeans/tomcat406_base/work/Tomcat-Internal/
localhost/_
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-
collections.jar to /Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/
commons-collections.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-dbcp.jar to 
/Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/commons-dbcp.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-lang.jar to 
/Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/commons-lang.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-logging.jar 
to /Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/commons-logging.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/commons-pool.jar to 
/Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/commons-pool.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/debugstatement.jar 
to /Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/debugstatement.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/firebirdsql.jar to /
Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/firebirdsql.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/interclient.jar to /
Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/interclient.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/jaas.jar to /Users/
anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/jaas.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/jcsapi.jar to /Users/
anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/jcsapi.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/jdbc2_0-stdext.jar to 
/Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/jdbc2_0-stdext.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/log4j.jar to /Users/
anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/log4j.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/mini-concurrent.jar 
to /Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/mini-concurrent.jar
2003-07-09 08:39:29 WebappLoader[]: Deploy JAR /WEB-INF/lib/mini-j2ee.jar to /
Users/anthonym/nbproject/cbb/context/cbb/WEB-INF/lib/mini-j2ee.jar
2003-07-09 08:39:30 StandardManager[]: Seeding random number generator class 
java.security.SecureRandom
2003-07-09 08:39:33 StandardManager[]: Seeding of random number generator has 
been completed
2003-07-09 08:39:43 ContextConfig[]: Added certificates -> request attribute Valve
2003-07-09 08:39:49 StandardWrapper[:default]: Loading container servlet default
Comment 10 inertia 2003-07-09 16:46:04 UTC
Created attachment 10916 [details]
ide.log - attempt 1) without the patched tomcat40.jar, attempt 2) with the patched tomcat40.jar
Comment 11 Milan Kuchtiak 2004-01-12 14:01:31 UTC

*** This issue has been marked as a duplicate of 29625 ***