How do I change the port or address that Nexus binds to?

If you've download Nexus, tried to start the server, and encountered an error message like this:

2012-03-13 14:34:10 INFO [7-main-thread-1] - org.apache.shiro.config.ReflectionBuilder - An instance with name 'authcBasic' already exists. Redefining this object as a new instance of type []
2012-03-13 14:34:10 INFO [7-main-thread-1] - org.apache.shiro.config.ReflectionBuilder - An instance with name 'perms' already exists. Redefining this object as a new instance of type []
2012-03-13 14:34:11.191:WARN:oejuc.AbstractLifeCycle:FAILED SelectChannelConnector@0.0.0.0:8081 FAILED: java.net.BindException: Address already in use: bind
jvm 1 | java.net.BindException: Address already in use: bind
jvm 1 | at sun.nio.ch.Net.bind(Native Method)
jvm 1 | at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
jvm 1 | at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)

 

You will need to change your Nexus server to listen to a different port or IP address.     The default behavior of Nexus is to attempt to bind to port 8081 or 0.0.0.0 (or every available interface).   If you want to change the port or the host, you will need to modify the file in NEXUS_HOME/conf/nexus.properties.  This file contains two variables which are referenced in NEXUS_HOME/conf/jetty.xml - application-host and application-port.

Modify the bold lines in nexus.properties as shown below:

 

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus. # Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus # Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF

 

Once you have edited this file, restart Nexus and monitor the wrapper.log file to verify that Nexus can start without throwing the same BindException.

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk