I recently had sort of the same problem. Searched the forums and had to look hard to find the answer. So, I'll post the answer here, hopefully, people will find this easier.
If you change the port or (as in my case) the bind address (via the -b option at startup) that will change the bind address of the server.
But be careful - if you have clients running in your server, the jndi.properties file will take effect in your InitialContext. So, make sure that
1) Your jndi.properties file matches what you set your server (or don't specify a provider URL in jndi.properties and set it in your InitialContext programatically)
2) that you don't have a jndi.properties file somewhere in your classpath
My problem was #2 - unbeknowst to me, I had shutdown.jar in my classpath and it has a jndi.properties that defines provider URL of localhost:1099. If you change the port or bind address, this obviously won't match and you will get this exception that you mention.
Remember, if this attribute is -1 the service is disabled.