InetAddress.getLocalHost() logic with virtual IPs

Hello.
I have an application that is using:
this.serverName = java.net.InetAddress.getLocalHost().getHostName();
to determine the local machine's hostname. My Solaris box has a physical IP (obviously), and a virtual IP. Here's 'ifconfig -a':
lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232
inet 127.0.0.1 netmask ff000000
hme0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
inet 207.240.14.15 netmask ffffff00 broadcast 207.240.14.255
hme0:1: flags=843<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 207.240.14.16 netmask ffffff00 broadcast 207.240.14.255
The getLocalHost() call is always returning the IP address of the virtual IP, not the physical. Does anyone happen to know the logic that getLocalHost() uses to determine the IP of the local machine? I sure would think it would pick the physical over any virtuals, but that doesn't seem to be the case.
I tried the 'last interface brought up' theory, but that didn't pan out either.
Any help would be appreciated!
Thanks.

You may need to get your virutal hostname first.
String hostn = InetAddress.getByName(hostNm).getHostAddress();

Similar Messages

  • Using Logic with virtual guitarist

    I'm trying to use logic with virtual guitarist. Do you use this as an instrument or midi? When I use it as an instrument virtual guitarist does not follow logic tempo. And when I use it as a midi track I can not play it since virtual guitarist is not a hardware. Any sugestions?

    VG is a virtual instrument. If you want to use it within Logic, you need to convert the .vst into an AU (Audio Unit) so Logic can see and use it as .vst isn't supported anymore in OS X.
    The .vst to AU conversion is best done via the VST-AU Wrapper application, available from the http://www.fxpansion.com website or your local dealer. No, I don't work for them, but I use the wrapper extensively for older .vst instruments in Logic.
    If you need more detail information about this (and Virtual Guitarist in particular), you may want to check the VG forum here : http://bornemark.se/forum/viewforum.php?f=4&sid=a4bd0b1112e9d381261c09d8160fc1f7

  • InetAddress.getLocalHost works differently with jdk1.4.0 beta65 and rc

    I am using jdk1.4.0 on Linux with two network interfaces, one of them with a private IP.
    When using jdk1.4.0beta65
    InetAddress.getLocalHost seems to return the IP of the first entry in /etc/hosts corresponding to my machine's hostname.
    With jdk1.4.0 rc I get the last entry in /etc/hosts.
    I changed the order of these entries in /etc/hosts to check if it is really the reason.
    I had problems with an application when getLocalHost returned the private IP.
    Of course changing the order would solve my problem.
    Is there any reason why this changed?
    cu
    Achim

    I don't have the answer for you but why don't you try the following trick and see if you get a more consistent result:
    try {
        Socket socket=new Socket("java.sun.com",80);
        InetAddress addr=socket.getLocalAddress();
        String HostName=addr.getHostName();
        String HostAddr=addr.getHostAddress();
    } catch (Throwable e) {}
    V.V.

  • Difference between logical and virtual terms

    Hello,
    This is not purely oracle question; but in documentation so many times we find 2 terms:
    A. Logical
    B.Virtual.
    So what is the principle difference between logical and virtual? As I know physical is that which I can see and touch; while logical/virtual is that is imaginary. We say tablespace is logical not virtual; while Java Virtual Machine; not Java Logical Machine. So I want to know; what is the principle difference; why two words for an imaginary thing. Before posting question; I searched in google as “Difference between virtual and logical” but I couldn’t found the answer.
    Please quote your comments.
    Thanks & Kind Regards
    Girish Sharma

    Girish,
    I wont say that I am correcting you as this is like that half glass full/empty thing.May be what I see is half empty , you would see the same as half full.
    Well now coming to the explanation.I am saying honestly , I got more confused after reading your definitions.What do you mean by saing that tablespace is not virtual.I see it as purely virtual.We don't say it as virtual tablespace or logical tablespace but it is actualy logical/virtual, having no existance but just the definition right?
    How can you say that the size of virtual is larger than logcial?The size of tablespace is actualy the sum total of size of datafiles.So it actualy becomes very larger right?Much larger than JVM which is of few megs only.
    The point 3 totally knocked me out.I have no idea what you said.
    Ok I tell you this.Just remember the definition that Hans gave already.If you ask me than its the best definition that we can have. Just remember this and if some one asks you more further than give them your point 3 definition and tell them understand this ;-).Please don'tmind I am just kidding. Its just semantics.Don't get lost into it.You will find many people using both the terms interchangibly. So its ok.I shall stick with Hans's defintion,simple and concise.There are lot more other topics to dig upon in oracle.I can mail you lots of them.Spend time on those.Don't think that I am demotivating you.I understand you asked only because you have a doubt.But we got a good resolution of it and beyond that, its not of much use to dig it atleast not in the technial terms.
    Cheers
    Aman....
    PS:Are you on oraclecommunity.net?

  • Cisco Prime with two IPs

    Hi.
    I have installed Cisco Prime in machine virtual, i need that Cisco Prime have 2 network card with 2 IPs differents subnet. Is it possible?.
    Thank.
    Francisco.

    See:
    http://www.cisco.com/en/US/tech/tk648/tk361/technologies_configuration_example09186a0080950834.shtml

  • Living with virtual pc 7

    I've recently running a failure in my virtual pc 7 running on my imac g5. sin that it is, i need this product to access my quickbooks online business software.
    lately i've received the following error message (unrecoverable processor error has been encountered.) from here, it asks to be restarted. the same message appears every time i attempt to use virtural pc. i've uninstalled and reinstalled the program several times to no avail. other than this, my mac work as well as it ever has...flawless.
    does anyone have any other suggestions, whether it is with virtual pc, or how to work around quickbooks online prejudice attitude? any and all suggestions are appreciated. thanks all.

    Are you saying that Quickbooks for Mac OS X doesn't do what you need it to do?

  • Installing windows XP using discs supplied with virtual PC

    I am currently running Windows XP Home in Virtual PC under 10.3.9 in a powerbook G4. I want to upgrade to a new Macbook for Christmas.
    Can I use the Windows discs I purchased with Virtual PC to install Windows for the dual boot process?
    Thanks in advance
    Rob

    Hi Rob,
    it is indeed technically possible to use the Windows XP from Virtual PC.
    See here for procedure: http://www.macosxhints.com/article.php?story=20060527175405403
    But keep in mind that the Windows License does not allow you to use one Windows XP on two or more computers.
    And because of the Activation Process of XP they will find out...
    Good Luck
    Stefan

  • Lion 10.7.4 issues with Virtual Machines

    Hi,
    I'm having lot of issues with virtual machines (both Parallels and VMWare)
    since having update to lion 10.7.4.
    I make myself:
    If I switch on Mac OS a run any vitrual machine software
    I can run Windows XP and Ubuntu at same time with no issue and very fluently.
    But, if I switch on Mac OS and start using Eclipse, Safari 5.2 and other production stuff and
    want to use vmware or paralles
    they become unusable even if I quit all the tasks ans "purge" memory.
    (eg: if i click start button on windows I have to wait seconds before the start menu pops up)
    Any Idea?
    I have MacBook Pro 13 Unibody mid 2009 with SSD Drive AND 4GB of RAM
    and I had no such issues with Lion 10.7.3

    alex_75 wrote:
    As you wrote before, virtual mchines need big chunks of contigous RAM and
    2,5 GB of free RAM wuold have enough ammount of such a RAM.
    No, it wouldn't. 2.5 GB of free RAM could consist of 5 chunks of 500 MB of contiguous RAM, separated by RAM allocated by other processes.
    Here is a hypothetical memory map. Assume a is application memory, o is operating system memory, and - is free memory.
    boot:           oooo--------------
    run app1:    ooooaao-----------
    run app2:    ooooaaoaaaaaaoo---quit app1:   oooo---aaaaaaoo---
    Maybe there is some issue in the way 10.7.4, in some perticolar situations, handle the process of freeing RAM.
    What you can't accept, and I don't know why, is that before the update to 10.7.4 everithing was fine.
    I don't know why you don't beleve me.
    There is nothing in the 10.7.4 update description that mentions a re-write of the virtual memory system. http://support.apple.com/kb/HT5167
    I just worte here to see if someone could give any advice to do further invesigations.
    I know the price of upgrading RAM but I think that this would be a "microsoft like" solution
    and I'm trying to find what service or task or whatever is creating this issue.
    The only thing "Microsoft like" about buying more RAM is the fact that you need it to run your Microsoft operating systems. It has been this way as long as I can remember. I upgraded my MacBook to 4 GB RAM in 2008 just so I could run Windows more easily.
    Perhaps you have your virtual memory settings too high. Depending on what you are doing in the VM, you may not need the default settings. XP will run low-intensity tasks with a 500 MB VM size. It will run just about anything in 1 GB. Linux should run fine in the same range too.

  • URGENT HELP WITH VIRTUAL WLC

    We had a problem with Virtual Machine which Cisco Virtual WLC installed. Virtual Machine files were damaged and the system was not start normally. We have had to reinstall the WLC, but after installation impossible to import current license to new one.
    how can we install this licence again?

    Licenses are tied to the device they're being used on. With a virtual WLC, the license is tied to the unique identifier of the vWLC and when you recreated the vWLC after your VMware problems the new vWLC has a different unique identifier.
    It's a similar situation to what happens when a physical controller is faulty and is swapped out by cisco, the replacement will have a different serial number and you'd have to re-host the license to the new serial number.

  • Mainstage 2 : The poeples who buy complete version of Logic with Mainstage 2 will not have free update of Mainstage ??? This is outragous !!!

    Mainstage 2 : The poeples who buy complete version of Logic with Mainstage 2 will not have free update of Mainstage ??? This is outragous !!!

    I also agree that the paid update is a sham to those who bought the full boxed set of Logic.  The ONLY reason I bought the boxed version of Logic was to get MainStage....I don't use anything else in that package.  So ultimately, I've paid hundreds of dollars for a product that's now selling for $30 and I don't even get a free update.....sheesh!
    As far as this logic goes: " MS 2.2 is a feature release" and that I "never bought that version of MainStage with the Logic Studio box": bollocks!  Many consider a feature release to be more than a .1 incremental update...OSX versions excluded.  With the exception of major OSX updates, I've never experienced being charged money for a .1 incremental update, and the vast majority of software developers have a policy that incremental updates are free until a new version is released i.e. v.2.5.6 to v3.0.  I'm sure that's not always the case, but it's definitely the case in an overwhelming majority of cases.
    Shame on Apple for this price gouge.

  • Ipad2: with iOS7 it's quite impossible to type with virtual keyboard (very long time before screening letters).

    Ipad2: with iOS7 it's quite impossible to type with virtual keyboard (very long time before screening letters).

    I have found a workaround in this bug report.
    Make a script in /usr/lib/systemd/system-sleep/keyboard.sh
    #!/bin/sh
    case $1/$2 in
    post/*)
    echo -n rescan > /sys/devices/platform/i8042/serio1/drvctl
    esac
    Do not forget to make it executable:
    chmod a+x /usr/lib/systemd/system-sleep/keyboard.sh

  • InetAddress.getLocalHost retrieving 127.0.0.1, not the actual IP Address

    I am using the following code :
    try{
              InetAddress iaddr = InetAddress.getLocalHost();
              String ipaddr = iaddr.getHostAddress();
              System.out.println("IP= "+ipaddr);
              }catch(UnknownHostException ex){
                   ex.getMessage();
    to get the IP address of the server on which this code is running.
    We are actually trying to set up different machines (other than the Production machine) for Failover of the Application. So, we need to get the IP address of the machine on which the application is running in the code.
    For one machine, the above code works perfectly OK.
    But, for the three Production machines, the IP address that we are retrieving using the getLocalHost function is fetching the localhost and not the IP address of the machine. That is instead of fetching the IP � a.b.c.d (I am not writing the actual IP in this mail :) ) ... it is fetching the localhost 127.0.0.1 .
    So we need to find out a way to fetch the actual IP address so that failover can work.
    FYI, all of the machines are Solaris machines.
    Regards,
    Anjan

    I am putting up the contents of the /etc/hosts files of the 3 machines I am using.
    @@@@ Machine #1 (Code running OK for this, retrieving a.b.c.155 for InetAddress.getLocalhost().getHostAddress()) @@@@
    Excerpt from /etc/hosts file :
    ==========================
    # Internet host table
    127.0.0.1 localhost
    a.b.c.155 rating-DR loghost
    ==========================
    Host name for Machine #1
    ===================
    bash>hostname
    rating-DR
    @@@@ Machine #2 (Code returning 127.0.0.1 in this server, for InetAddress.getLocalhost().getHostAddress()) @@@@
    Excerpt from /etc/hosts file :
    ==========================
    # Internet host table
    127.0.0.1 localhost
    a.b.c.235 rating1 rating1.xyz.com loghost
    a.b.c.239 rating2
    ==========================
    Hostname for Machine #2
    ===================
    bash>hostname
    rating1
    @@@@ Machine #3 (Code returning 127.0.0.1 in this server, for InetAddress.getLocalhost().getHostAddress()) @@@@
    Excerpt from /etc/hosts file :
    ==========================
    # Internet host table
    127.0.0.1 localhost
    a.b.c.239 rating2 rating2.xyz.com loghost
    192.168.210.235 rating1
    192.168.210.155 rating-DR rating-DR.fastlink.com.jo
    ==========================
    Hostname for Machine #3
    ===================
    bash>hostname
    rating2

  • WP with Virtual PC on powerbook 867?

    Anyone ever tried Windows XP with virtual pc on powerbook 867? Does it guarantee any reasonable speed and stability?

    I cannot comment on VPC5 since I never used it. I used to run VPC6 but I was not so convinced of that version (slow and unstable as far as I remember).
    The only thing I can add are the system requirements, which can be found at http://www.microsoft.com/mac/howtobuy.aspx?pid=sysreq
    VPC 7:
    700 MHz native G3, G4 or G5
    MacOS X 10.2.8 or newer
    512 MB RAM
    1024 x 768, thousands of colors
    VPC 6.1:
    500 MHz native G3 or G4 (G5 not supported)
    256 MB RAM
    VPC 5 is no more mentioned on this site.
    Hope this helps.
    Stephan

  • GR with backflush not for reporting point logic with autom. GR option

    Dear Experts,
    While doing backflashing though MFBF we are getting following error
    "GR with backflush not for reporting point logic with autom. GR option"
    We have maintained 5 production version for this material while calling with first production version we are getting the error.
    Rate routing & BOM maintanied for the FERT material
    Thanks

    Did you check the BackFlash option are actuvated in the following places ?
    1. In the Rate routing, the backflush indicator is set in the component assignment.-CA22
    2. In the material master record, the backflush indicator has the characteristic "Always backflush".-MRP3
    3. In the material master record, the backflush indicator has the characteristic "Work center decides", the indicator being set in the work center.-CR21-Basic Data View .
    4.Goto-MM02-MRP4 View -Select the PV-Goto Details -Check particularly this production version REM Allowed or not
    5.You should use REM-Profile -0004/0003  where RP and Auto GR with RP at last Back Flashing Activated .
    6.Check Rate Routing Operation Control Key -Auto GR  with indicator Confirmation required
    Regards
    JH
    Edited by: Jiaul Haque on Jun 22, 2010 11:19 AM

  • ORA-00939 when creating XML table with Virtual Columns

    Getting error on creating table with VIRTUAL COLUMNS:
    Error at Command Line:4 Column:31
    Error report:
    SQL Error: ORA-00939: too many arguments for function
    00939. 00000 - "too many arguments for function"
    Without VIRTUAL COLUMNS works fine.
    Where to start?
    Is it possible to add Virtual Columns after a table is created?
    CREATE TABLE TDS_XML OF XMLType
    XMLSCHEMA "http://xmlns.abc.com/tds/TDSSchemaGen2.xsd"
    ELEMENT "TDSTestData"
      VIRTUAL COLUMNS
      TESTID AS (
        XMLCast(
                  XMLQuery('declare default element namespace "http://xmlns.abc.com/tds/TDSSchemaGen2.xsd"; /TDSTestData/TestID' PASSING OBJECT_VALUE RETURNING CONTENT)  AS VARCHAR2(32)
       )SQL*Plus: Release 11.2.0.2.0 Production on Mon Apr 30 20:17:29 2012
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for 64-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SQL>

    victor_shostak wrote:
    Figured, Virtual Columns work only for Binary XML.They are only supported, currently, for Binary XML.

Maybe you are looking for

  • Syncing iphone and ipod to new laptop

    I have just got a new laptop and am trying to sync my iphone and ipod to it everything is on another computer. I have managed to drag my itunes folder from my old computer to a usb stick and transfer it to my laptop. If I sync them will I loose all m

  • Screensaver eMac monitor while in extended desktop mode?

    Officially, eMacs can mirror to an external display but cannot do extended desktop. Since my 2005 eMac's built-in monitor is only functioning correctly at low resolutions (see http://discussions.apple.com/thread.jspa?threadID=2013835), I'm using a pr

  • How to change the index page of tomcat to a specific page in a  web app.

    hi all i am trying to figure out a way to change default application to a specific web application deployed in tomcat, so that when you type localhost:8080, it will start with the web app. basically i want to get ride of the context or map the contex

  • Upgrade Bug from 3.0.1 to 4.0.1 - syntax not accepted now

    Hi, I have just upgraded to Apex 4.0.1 (full installation from previous installed 3.0.1) in order to add the Ajax item functionality to my existing 3.0.1 app and getting the following really weird syntax error when I try to build an existing 'On Subm

  • Re: Reports 2.5

    Hi, I am antonidoss an OTN member. I was working in forms v3 with reports v1.1.Now I am working in forms4.5 with reports ver 2.5. I am in need of R25MREP file for upgrading my earlier version to new version(forms4.5,rep2.5). Kindly send me the above