Sean Kelly created OODT-660:
-------------------------------
Summary: TestCogJGlobusFtpProtocol fails if another service is
using TCP port 9000
Key: OODT-660
URL: https://issues.apache.org/jira/browse/OODT-660
Project: OODT
Issue Type: Bug
Components: catalog
Affects Versions: 0.6
Environment: Linux CentOS release 5.10 (final) 2.6.18-348.3.1.el5
amd64 Java 1.6.0_03-b05 Maven 2.2.1 r801777
Reporter: Sean Kelly
Fix For: 0.7
When running unit tests in
org.apache.oodt.cas.protocol.ftp.TestCogJGlobusFtpProtocol on a system that
already has a service bound to TCP port 9000 on all interfaces, an error
message appears:
{noformat}
testLSandCDandPWD(org.apache.oodt.cas.protocol.ftp.TestCogJGlobusFtpProtocol):
Failed to bind to address 0.0.0.0/0.0.0.0:9000, check configuration
{noformat}
The stack trace is:
{noformat}
org.apache.ftpserver.FtpServerConfigurationException: Failed to bind to address
0.0.0.0/0.0.0.0:9000, check configuration
at
org.apache.ftpserver.listener.nio.NioListener.start(NioListener.java:181)
at
org.apache.ftpserver.impl.DefaultFtpServer.start(DefaultFtpServer.java:80)
at
org.apache.oodt.cas.protocol.ftp.TestCogJGlobusFtpProtocol.setUp(TestCogJGlobusFtpProtocol.java:78)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:98)
at
org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:107)
at
org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind(Native Method)
at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
at
org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:251)
at
org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:48)
at
org.apache.mina.core.polling.AbstractPollingIoAcceptor.registerHandles(AbstractPollingIoAcceptor.java:523)
at
org.apache.mina.core.polling.AbstractPollingIoAcceptor.access$200(AbstractPollingIoAcceptor.java:65)
at
org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:407)
at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
{noformat}
The offending code has a hard-coded port number:
{code:title=TestCogJGlobusFtpProtocol.java}
public class TestCogJGlobusFtpProtocol extends TestCase {
private static final int PORT = 9000;
private FtpServer server;
...
{code}
On computers where a service is already bound to this port, the test case fails
to set up its FTP server necessary for the test to run.
Using a system-assigned port, or trying incrementing port numbers up to a
limit, would be better ways to avoid this issue.
--
This message was sent by Atlassian JIRA
(v6.1#6144)