[JAVA-430] Connection to mongodb://localhost:27017 gets UnknownHostException if machine's hostname doesn't resolve Created: 07/Sep/11 Updated: 19/Oct/16 Resolved: 15/May/12 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | John Feibusch | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
$ cat /etc/redhat-release |
||
| Issue Links: |
|
||||||||
| Description |
|
If the machine's hostname does not resolve, then the following line will cause an UnknownHostException: That's because the constructor for ServerAddress recognises the string "localhost" and calls InetAddress.getLocalHost(). This issue does not occur if you use "127.0.0.1" instead of "localhost". If you feel this is intended behavior, would you consider noting it in the documentation. |
| Comments |
| Comment by Jeffrey Yemin [ 15/May/12 ] |
|
Not intended, and it's fixed in |