Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:59:27+00:00 2026-05-22T22:59:27+00:00

Question: How do I set the canonical hostname as reported by java’s InetAddress.getCanonicalHostname() method?

  • 0

Question: How do I “set” the canonical hostname as reported by java’s InetAddress.getCanonicalHostname() method?

Context: I’m trying to run Neo4j (which has an embedded jetty server) on CentOS 5.6. The service starts up just fine, but it’s binding to the wrong address (IPv6) as evidenced by netstat. Instead of :::*, I need it to bind to 0.0.0.0 (IPv4).

Is there a JVM parameter I can use to force getCanoncialHostname() to return the string I want? If not, what can I add to my hosts file or other linux config file to achieve the same?

[edit – added netstat output]

$ netstat -plten
...
Proto  Local Address    Foreign Address    State       User       Inode      PID/Program name
tcp    0.0.0.0:930      0.0.0.0:*          LISTEN      0          10240      -
tcp    0.0.0.0:139      0.0.0.0:*          LISTEN      0          57484      -
tcp    0.0.0.0:111      0.0.0.0:*          LISTEN      0          10104      -
tcp    127.0.0.1:25     0.0.0.0:*          LISTEN      0          12714      -
tcp    0.0.0.0:445      0.0.0.0:*          LISTEN      0          57483      -
tcp    :::7474          :::*               LISTEN      500        524965     28200/java
tcp    :::22            :::*               LISTEN      0          62967      -
tcp    :::1337          :::*               LISTEN      500        524953     28200/java
tcp    :::15003         :::*               LISTEN      500        481149     3926/java
tcp    :::60156         :::*               LISTEN      500        524951     28200/java
tcp    :::15004         :::*               LISTEN      500        524917     28177/java

Port 22 is ssh – I can ssh into the machine just fine, so there’s evidence that the :::* foreign address is (in principle) just fine.

[edit – added remote nmap output]

Running nmap from another host, specifically listing all the above produces this:

$ nmap -T4 -A -v -PE -PS22,25,80 -PA21,23,80,930,139,111,25,445,7474,22,1337,15003,60156,15004,3389 192.168.176.138
...
Initiating SYN Stealth Scan at 13:31
Scanning 192.168.176.138 [1000 ports]
Discovered open port 111/tcp on 192.168.176.138
Discovered open port 139/tcp on 192.168.176.138
Discovered open port 445/tcp on 192.168.176.138
Discovered open port 22/tcp on 192.168.176.138
Discovered open port 15003/tcp on 192.168.176.138
Discovered open port 15004/tcp on 192.168.176.138
Completed SYN Stealth Scan at 13:31, 0.04s elapsed (1000 total ports)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:59:28+00:00Added an answer on May 22, 2026 at 10:59 pm

    You can tell your JVM to use IPv4 instead of IPv6 via the following network property: -Djava.net.preferIPv4Stack=true

    See Networking properties

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question is Interface Set has method add(E e) and it extends interface Collection
I am trying to create a math question set for a website where the
As the question says, how do I set the value of a DropDownList control
As described in another question , I have a set of Model objects and
I have a Question class: class Question { public int QuestionNumber { get; set;
After reading the Test-and-Set Wikipedia entry , I am still left with the question
Simple question, but I haven't found a good explanation on google. When using Set
I'm working with core plot on iPhone now, and I'm trying to set up
Follow-on to an earlier question: Force SET IDENTITY_INSERT to take effect faster from MS
I have develop one app in which four box question are there. all question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.