Forum Discussion

jchas5's avatar
jchas5
Contributor
14 years ago

java.net.BindException: Address already in use

I am installing the latest version of loadUI agent on to a centos 5.6 64 bit machine. I have done an install on a previous system and it worked fine. Now when I install i get the following error:

Launching loadUI Build: loadUI-2011-06-21-[3] 2011/06/21 11:10
ERROR: Bundle com.eviware.loadui.http-server [32] Error starting file:/home/jcklose/eviware/loadUI-Agent-1.5.1-SNAPSHOT/bundle/loadui-http-server-1.5.1-SNAPSHOT.jar (org.osgi.framework.BundleException: Activator start error in bundle com.eviware.loadui.http-server [32].)
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:170)
at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:356)
at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:248)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.Server.doStart(Server.java:269)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at com.eviware.loadui.http.HttpServerActivator.start(HttpServerActivator.java:78)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1842)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1759)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1163)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Unknown Source)

It looks like the file: eviware/loadUI-Agent-1.5.1-SNAPSHOT/bundle/loadui-http-server-1.5.1-SNAPSHOT.jar is not starting. Also from the error message it says the address is already in use. Is there a config file where I can change the port number? I was looking through the threads and could not find it. Perhaps I just missed. Any help would be awesome.

-J
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    There are two ports used in loadUI, one for HTTP communication and one for HTTPS communication. The defaults for these are 8080 and 8443 respectively.
    You can change the ports that loadUI uses by specifying them as command line arguments:


    -Dloadui.https.port=<HttpPort>
    -Dloadui.http.port=<HttpsPort>

    Ex: loadUI-agent.sh -Dloadui.https.port=1234 -Dloadui.http.port=1235


    You can add these to the loadUI-agent.sh file to make them more permanent.

    Regards,
    Dain
    eviware.com
  • Thanks Dain. I will give that a go. Is there a repository for documentation that specifies this type of stuff? I looked around and could not find a detailed online user manual. I am probably not looking in the right places.

    -J
  • Hi Dain;

    I tired both methods, i.e adding it to the shell script and adding ito to the command line as a flag. Both almost worked.

    Setting the https and http ports to different values allows the execution script to actually fully start and get to the line:

    11:47:29,630 INFO [ControllerImpl] Agent started and listening on cometd!

    Which indicates it is working, however about 5 seconds later, another java exception is thrown:

    11:47:29,630 INFO [ControllerImpl] Agent started and listening on cometd!
    11:47:32,601 ERROR [ContextLoaderListener] Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.eviware.loadui.runner-base, config=osgibundle:/META-INF/spring/*.xml))
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.eviware.loadui.impl.discovery.DiscoveryResponder#0' defined in URL [bundle://34.0:0/META-INF/spring/bundle-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.eviware.loadui.impl.discovery.DiscoveryResponder]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.net.UnknownHostException: deathstar: deathstar
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
    at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
    at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
    at java.lang.Thread.run(Unknown Source)
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.eviware.loadui.impl.discovery.DiscoveryResponder]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.net.UnknownHostException: deathstar: deathstar
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
    ... 15 more
    Caused by: java.lang.RuntimeException: java.net.UnknownHostException: deathstar: deathstar
    at com.eviware.loadui.impl.discovery.DiscoveryResponder.<init>(DiscoveryResponder.java:46)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
    ... 17 more
    Caused by: java.net.UnknownHostException: deathstar: deathstar
    at java.net.InetAddress.getLocalHost(Unknown Source)
    at com.eviware.loadui.impl.discovery.DiscoveryResponder.<init>(DiscoveryResponder.java:41)
    ... 22 more
    11:47:32,604 ERROR [AbstractAutowireCapableBeanFactory] Uncaught exception in Thread "SpringOsgiExtenderThread-12":
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.eviware.loadui.impl.discovery.DiscoveryResponder#0' defined in URL [bundle://34.0:0/META-INF/spring/bundle-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.eviware.loadui.impl.discovery.DiscoveryResponder]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.net.UnknownHostException: deathstar: deathstar
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
    at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
    at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
    at java.lang.Thread.run(Unknown Source)
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.eviware.loadui.impl.discovery.DiscoveryResponder]: Constructor threw exception; nested exception is java.lang.RuntimeException: java.net.UnknownHostException: deathstar: deathstar
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
    ... 15 more
    Caused by: java.lang.RuntimeException: java.net.UnknownHostException: deathstar: deathstar
    at com.eviware.loadui.impl.discovery.DiscoveryResponder.<init>(DiscoveryResponder.java:46)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
    ... 17 more
    Caused by: java.net.UnknownHostException: deathstar: deathstar
    at java.net.InetAddress.getLocalHost(Unknown Source)
    at com.eviware.loadui.impl.discovery.DiscoveryResponder.<init>(DiscoveryResponder.java:41)
    ... 22 more


    My guess is that the flags are not being passed properly. Is there something else I may need to do? Previously, most of the installs I have done of loadUI-Agent have worked out of the box. This one is giving me some trouble. Is there something in java that is not set right?

    Thanks for the help.


    -J
  • I figured it out. My /etc/hosts file need a line entry to specify ip address, host.domain and host alias. Once I did that, it worked. Thank you for the flags.

    -J
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Glad you got it working, and thanks for the stacktrace regarding the hosts issue. I'm making a change to the next nightly build which causes DiscoveryResponder to fail more gracefully!

    Regards,
    Dain
    eviware.com