[
https://issues.apache.org/jira/browse/CASSANDRA-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13930287#comment-13930287
]
Johan Idrén commented on CASSANDRA-2380:
----------------------------------------
Uncommenting and editing that line in cassandra-env.sh does actually not help.
Adding a line in /etc/hosts works fine, but if hostname doesn't resolve to
anything it fails regardless of having specified ip addresses in the
configuration.
Suggest reopening as this is actually broken, if not very serious.
Cassandra 2.0.5, jdk-1.7.0_51-fcs.x86_64.
> Cassandra requires hostname is resolvable even when specifying IP's for
> listen and rpc addresses
> ------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-2380
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2380
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Affects Versions: 0.7.4
> Environment: open jdk 1.6.0_20 64-Bit
> Reporter: Eric Tamme
> Priority: Trivial
>
> A strange looking error is printed out, with no stack trace and no other log,
> when hostname is not resolvable regardless of whether or not the hostname is
> being used to specify a listen or rpc address. I am specifically using IPv6
> addresses but I have tested it with IPv4 and gotten the same result.
> Error: Exception thrown by the agent : java.net.MalformedURLException: Local
> host name unknown: java.net.UnknownHostException
> I have spent several hours trying to track down what is happening and have
> been unable to determine if this is down in the java
> getByName->getAllByName->getAllByName0 set of methods that is happening when
> listenAddress = InetAddress.getByName(conf.listen_address);
> is called from DatabaseDescriptor.java
> I am not able to replicate the error in a stand alone java program (see
> below) so I am not sure what cassandra is doing to force name resolution.
> Perhaps the issue is not in DatabaseDescriptor, but some where else? I get
> no log output, and no stack trace when this happens, only the single line
> error.
> import java.net.InetAddress;
> import java.net.UnknownHostException;
> class Test
> {
> public static void main(String args[])
> {
> try
> {
> InetAddress listenAddress = InetAddress.getByName("foo");
> System.out.println(listenAddress);
> }
> catch (UnknownHostException e)
> {
> System.out.println("Unable to parse address");
> }
> }
> }
> People have just said "oh go put a line in your hosts file" and while that
> does work, it is not right. If I am not using my hostname for any reason
> cassandra should not have to resolve it, and carrying around that application
> specific stuff in your hosts file is not correct.
> Regardless of if this bug gets fixed, I want to better understand what the
> heck is going on that makes cassandra crash and print out that exception.
--
This message was sent by Atlassian JIRA
(v6.2#6252)