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

Similar Messages

  • IPv6 not using actual IP address

    IPv6 is active by default and uses an IP address that is not the actual IP address. This means we cannot configure a proxy script file to correctly work. Our only solution is to ban Firefox from compay computers and no longer support.

    Hi, Ignore my config. The problem is with all IPv6 supported versions and mostly PC versions. My organisation has 6000 staff and those with laptops can't use firefox because the IP address Firefox gives is not the true address and therefore not covered in our automatic proxy configuration script - so the browser does not route via the proxy server or send direct as it should.

  • I am trying to rebuild my iPhoto library and noticed my backup contains aliases (pointers?) and not the actual file. What's the best way to rebuild my library?

    I am trying to rebuild my iPhoto library and noticed my backup contains aliases (pointers?) and not the actual file. What's the best way to rebuild my library?
    Facts:
    In moving to a new iMac, I copied the iPhoto library to an external HDD assuming that I would point the new iMac to the backed up iPhoto Library
    All worked fine when I pointed the new library but noticed that some folders contained aliases and not the original file. So when I attempt to open that photo it can't find it because the alias is pointing to another drive.
    I do have all original photos from a couple of external HDDs. In the folders titled, "Originals" (from older versions of iPhoto) and "Masters" (from current iPhoto)
    I'm thinking I can create a new folder and drop the original files and make that my new iPhoto library. Is there a better way to rebuild my library? I do not want to create any future aliases.
    Thanks in advance for any help!

    do you have a strongly recommended default "managed" library (the iPhoto preference to "copy imported items to the iPhoto library is in its checked state) or a referenced library - you have unchecked that option?
    It sounds like you have a referenced library and are now experiancing one of the very siginificant drawbacks of a referenced library and one of the many reasons they are strongly not recommended
    Also note that iPhoto '11 may use alises in the originals folder as part of the upgrade
    It is important that we understand exactly what you have and what is not sorking - what error messages you are getting
    You must NEVER make any changes of any sort to the structure of content of the iPhoto library - there are no user servicable parts in it  --  and you can not rebuild yoru librtary - only iPhoto ir iPhoto Library Manager - http://www.fatcatsoftware.com/iplm/ -  can rebuild a library unless you are a SQL programmer and understand the structure that iPhoto uses
    LN

  • How can I get a picture to go with my email signature when sending emails from my iPad? Only a square box shows up on my signature not the actual picture I iploaded in my settings.

    How can I get a picture to go with my email signature when sending emails from my iPad? Only a square box shows up on my signature not the actual picture I iploaded in my settings.

    Only Apple Account Security could help at this point. You can try calling Apple Support in Canada - you'll have to find one of the several ways, such as Skype, to call an 800 number from outside of the relevant country - and ask for Account Security and see if they can help. Or you can find a friend who speaks Chinese and ask them to help you talk to Apple Support in China. There are really no other options that I know of.
    Note, by the way, that these are user-to-user support forums. You aren't speaking with Apple when you post here.
    Regards.

  • Events folders display photo that is not the actual photo file

    When I open an event file, the photos displayed are not the actual photos. For instance, in the event "Graduation," I now have random photos of my daugher's dance recital displayed, but when I open them, the photos are indeed of graduation. So, I can't see what photos are in an event until I open each photo file There is no rhyme or reason to what photos randomly pop up on the surface, and it doesn't happen with all the files within an event, just some. Please tell me someone else has had a similar problem as it is making me feel a bit batty!

    Welcome to the Apple Discussions. Launch iPhoto with the Command+Option keys depressed and follow the instructions to rebuild the library. Select the first three options.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've written an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • I received a replacement iPad. On my original iPad I had dozens of books and PDF's. I completely backed up my original iPad. The categories of my iBook files transferred but NOT the actual PDF and Books. Please help.

    I received a replacement iPad. On my original iPad I had dozens of books and PDF's. I completely backed up my original iPad. The categories of my iBook files transferred but NOT the actual PDF and Books. Please help.

    Are the PDFs and ibooks on your computer's iTunes ? If so then you should be able to re-sync them, if not then you can re-download ibooks for free as long as they are still available in the store and you use the same iTunes account as you originally used to buy them : http://support.apple.com/kb/HT2519 . The backup doesn't contain the contents of the ibooks app, so for them to be restored to the device they needed to be in your iTunes library.

  • When manually creating delivery notes, the Actual GI time ?

    Hello,
    When manually creating delivery notes, the Actual GI time (used for pricing determination) is set to the document creation time (CPU time) but expressed in the UserId's local time zone.
    Regards,
    Neel

    Hello Ram
    Please help me out to solve this issue
    When manually creating delivery notes, the Actual GI time (used for  pricing determination) is set to the document c
    Creation time (CPU time) but expressed in the UserId's local time zone.
    The correct Actual GI time should be the CPU time in CST time zone, independant of the user.
    The Delivery doc. was created on 04/20/2011 at 11:11:32 UserId's local time zone (CET).
    The Actual GI time was set per default to 11:12 based on CET CPU time the expected time is 04:12 CST
    Edited by: neeljasani on Apr 27, 2011 5:20 PM

  • I bought a movie on iTunes and when it loads up I can only play the bonus features and not the actual film. The title screen is also glitched and merges with the scene selection. I don't think it downloaded properly. what can I do?

    I bought a movie on iTunes and when it loads up I can only play the bonus features and not the actual film. The title screen is also glitched and merges with the scene selection. I don't think it downloaded properly. what can I do?

    It happens sometimes. Delete the current copies, don't hide from iTunes in the cloud if prompted, close iTunes, reopen, download from iTunes Store > Quicklinks > Purchased > Music > Not on this computer.
    While downloading click the download icon at the top right and uncheck Enable simultaneous downloads. You may find it more reliable that way.
    tt2

  • Sending email using Exchange 2013 defined email addresses not the account email address.

    Currently we are using exchange 2013. Let's say a user has a mailbox account defined that has a default email reply address of [email protected] Now I define additional email address for the same account. When the user tries to send an email he can only send from
    the default email address. Is it possible to send from a defined email anndress and not the default account email address?
    Best Regards
    Best Regards

    Not natively with Exchange.
    You will need 3rd party software if you want to have only one mailbox and the ability to send as any of the proxy addresses associated with it
    Example:
    http://www.ivasoft.biz/choosefrom2007.shtml
    Not sure if Exchange 2013 is supported with it yet
    Twitter!: Please Note: My Posts are provided “AS IS” without warranty of any kind, either expressed or implied.

  • ITunes library mysteriously dissapeared (not the actual files where they are stored) and once I transfered songs back to iTunes, some purchased songs had been corrupted (missing tags

    Last week, I purchased around 9-10 songs. The previous day, I had played songs from my iTunes library... everything working normal. The day after purchasing those 9-10 songs... I noticed that my entire songs in my library (and playlist) where gone, essentially being re-set like new. I updated my iTunes version, re-started my PC and still... nothing was showing up except those 9-10 songs. I did the next logical thing which was to check the actual music folder that stores the songs. They where all there. It did not make any sense as I had not done or noticed anything unsual while using iTunes before. Now, I want to mention that I use a DJ software (mixvibe) with the ION Discovery DJ that pulls tracks from iTunes. For the past couple of months they both have worked great. Fast forwarding to my issue, I went ahead and copied all the music back to iTunes. I spent a good hour making sure that everything worked and re-created my playlists. One thing that struck me as odd was that while checking everything... some songs that I had purchased recently and even a couple of months ago that I've used on my mixvibe software... had the track info deleted. The only information was the track name, ex. (01 - Bird One). For some reason, they were dumped into a "Unknown Artists" file. There was a good 20-25 songs that had this issue. The one thing that I noticed was that when I would highlight the song within the Uknown Artist folder... All of the information including cover art was showing up at the bottom of the folder (if you are familiar with Windows 7 you know what I'm talking about). How can it be that all of the actual information was still there yet not showing up in iTunes? I had to manually go one by one of those 20-25 songs and add all of the track info (as much as I could). I was also able to recover some of the cover art but not all. It seems like the files got corrupted. Can I re-download these tracks again or how can I get them to how they were originally? HELP!

    I find the best way to do this is to right click on the song in iTunes and convert then select convert ID3 tags to V1.1 this usually completes the tag and adds all the missing info, provided it is in iTunes corectly.
    Were these songs you Dled or ripped form a cd directly?

  • Picture Library : upload image with same name overwrite the image in thumbmail or WebVersion view but not the actual image link points to the old image

    Hello,
    I am facing a wired issue with Picture Libraries in SharePoint.
    We created a custom field and added it to UserInfo list, the column based on custom field lets user upload their personal images to a Picture Library with the name <User ID>.<Image Extension> e.g. 1.jpg where UserID is internal Listitem ID of the UserInfo list and set its URL to the field value which we use to display the image on our custom user profile and some other WebParts.
    If the user uploads a different image, it will overwrite the existing one it keeping the same name.
    The field worked perfectly with sites using widows Based authentication, but as we move the field to sites with form based authentication we find that the field is able to upload the image properly first time but on each successive upload, although a new image gets uploaded with the name userid.imagextension and is shown in the allitems.aspx page in the thumbnail view and in the picture preview on the dispform.aspx page, but the link next to the name field and the image shown on clicking the preview points to the old image.
    To put it other way
    https://<Web URL>/Picture%20Library/_w/Upload_jpg.jpg
    https://<Web Url>/Picture%20Library/_t/Upload_jpg.jpg
    Would show the updated image
    but the actual URL
    https://<Web Url>/Picture%20Library/Upload.jpg 
    points to the old image
    what’s even more strange is that even after deleting the image the url still shows the old image at
    https://<Web Url>/Picture%20Library/Upload.jpg 
    I confirmed the same by actually repeating the same exercise on a picture Library in the User Interface
    Uploading an image say upload.jpeg in the picture library using SharePoint interface.
    Then uploading a different jpeg image keeping the same name upload.jpeg again in the picture library.
    In allitems.aspx thumbnail view and on dispform.aspx page preview filed image now show the newly uploaded image but when you click the preview image or click the link in the name field value it takes you back to the old image.
    I have seen this issue on environment where we have enabled form based authentication and the issue is not seen on another server where we have wss with windows based authentication.
    Has anyone noticed such behavior and is there any workaround to that!
    Thanks & Regards
    Saurabh Rustagi

    All,
    I had the same issue. 
    In my case, Blob Cache was enabled for the web application in which the image issue was occuring.
    I cleared blob cache, and after doing a hard refresh of my browser, the correct image was then displayed.
    To clear blob cache, do the following:
    Navigate to:   
    http://yourwebapp:port/yoursite/_layouts/objectcachesettings.aspx
    Select:  "Object Cache Flush"  and  "Force all servers in the farm to flush their object cache" check boxes
    Click the OK button
    Hope this helps.

  • Digital Signature shows as a large X, not the actual signature

    I have some documents digitally signed in Reader (Windows) by someone else.  When I got those documents back, and opened the documents in Reader (Mac) the signatures show as a large X inside a rectangular box, instead of showing the person's signature.  Since both parties are using Reader, I am not sure why I would not be able to see the signature.  Ideas? 
    Thanks

    I had this and fixed it.
    I had upgraded to Mountain Lion and my signatures in Mail were fine. But then about a week later, I got a new computer and used Migration Assistant to copy my stuff to the new machine. Upon opening Mail, I had all the correct Signature information in the Preferences>Signatures window, but nothing worked.
    After lots of hunting, I found the Signature Folder. It's in:
    Yourusername>Library>Mail>V2>MailData>Signatures
    Looking at my previous setup (which works) I saw in that folder two types of files: .webarchive and .siganture
    Looking in my new machine's Signature folder, I saw only the .webarchive folders, not the .signature folders
    Since this was literally a clone of my previous setup to a new machine, here's what I did:
    1. Quit Mail
    2. In Problem machine, go to
    Yourusername>Library>Mail>V2>MailData>Signatures
    3. Move the Signatures folder someplace safe, but out of the MailData folder
    4. Get the Signatures Folder from the working install (like a backup) and copy it to the MailData folder on the problematic machine
    5. Start Mail on the problem machine
    This worked for me. I don't know why Migration Assistant didn't copy the full signature folder, but this fixed it. It worked perfectly partly because I had just backed up with Carbon Copy Cloner and the very next day set up the new machine. I don't know where Lion or earlier versions of mail stored signatures, but the absence of the .signature filetype seems to be the problem.
    Hope this helps

  • Emond/afctl not showing actual ip address

    Here's one weird emond (?) problem. I get those lines in the log:
    Nov 18 03:15:21 myserver emond[57]: Host at ssh2 will be blocked for at least 15.00 minutes
    I'm trying to understand how it manages to replace the real IP address that's making attempts to connect via ssh repeatedly with a name.
    There are also a couple of properly formatted entries that supposedly work but this "host at ssh2" obviously never gets blacklisted because one cannot do that (it's not a local host). I see a lot of activity coming from a very specific real IP that has a correct rDNS pointer and I assume that's the host it's trying to block but somehow it gets it wrong.
    Any advice?
    PS. afctl -a IP -t time command works fine on both black- and whitelists.
    And I also get
    reverse mapping checking getaddrinfo for 165.50.174.61.dial.wz.zj.dynamic.163data.com.cn [61.174.50.165] failed - POSSIBLE BREAK-IN ATTEMPT!
    in secure.log.
    So what's going on? Is it that it tries to convert IP address to a name and then the name back to IP address and when it fails everything fails?

    Hi, Ignore my config. The problem is with all IPv6 supported versions and mostly PC versions. My organisation has 6000 staff and those with laptops can't use firefox because the IP address Firefox gives is not the true address and therefore not covered in our automatic proxy configuration script - so the browser does not route via the proxy server or send direct as it should.

  • Emailing playlist - not the actual songs, just the list

    I would like to share my playlists with a friend via email. Specifically, I want to share the names of the songs on my playlists with my friend, not the songs themselves. I know that I can 'publish' the playlist as an imix and she could then see all the songs. I know that I can also print my playlist but it will use up over 40 pages and I don't want to kill any trees unnecessarily!
    Any ideas?

    Select the playlist you want (or your whole music library). View in list mode. Go to iTunes > View > View Options and check the columns you want to share with your friend. Name is automatic, and I would add Artist and Album.
    Go to iTunes > File > Print. In the print dialog, under Print choose Song listing and in the Theme scroll down menu, choose Custom. That prints only the columns used in current view in the iTunes window. Click the Print button.
    In the next dialog, don't click the Print button, but click the PDF button at the lower left. In the drop down menu, select "Mail PDF". That will bring up your Mail app so you can email the PDF file.
    When you are finished, go back to view options and reset them as you prefer.

  • How do I backup the *contents* of a sparseimage (but not the actual image)?

    This is related to my iPhoto question:
    http://discussions.apple.com/thread.jspa?threadID=2590319
    I'd like to backup the contents of a sparseimage using TM. If I just point TM to the imagefile, I run in to the issue that each time I add/modify a file inside the image, then TM marks the whole image as changed and hence backs it all up. And since the image is large I run out of diskspace.
    Is there some way I can just back up the contents of the image? If my sparse image file is:
    /Users/shared/foo.sparseimage and it gets mounted as:
    /Volumes/foo
    is there someway I can point TM to /Volumes/foo and then exclude TM backing up /Users/shared/foo.sparseimage (I know how to do the latter).
    Thanks in advance.

    each time I add/modify a file inside the image, then TM marks the whole image as
    changed and hence backs it all up. And since the image is large I run out of
    diskspace.
    If you use a sparsebundle disk image instead of a sparseimage, that shouldn't happen.
    From this article
    [Discovering Sparse Bundle Disk Images|http://db.tidbits.com/article/9673]:
    A sparse bundle looks and acts just like a sparse image - it can grow in size, can optionally be compressed or encrypted, and so on. What's different is that it isn't actually a single file, as all previous disk image formats were. It's a bundle (also known as a package) - a folder that Mac OS X treats as a single file, which is also true of applications. (To verify this, you can Control-click or right-click a sparse bundle, choose Show Package Contents from the pop-up menu, and browse through its contents.) Inside that package is a folder full of bands - files that are each 8 MB in size, as many as are needed to hold the image's data.
    What's cool about this is that if you change something on a sparse bundle (adding or modifying a file, for instance), only the band(s) containing that data change, not the whole bundle. As a result, assuming your backup software treats the contents of bundles as individual files, you no longer have to back up a huge disk image just because a tiny file changed. Your backup software only has to copy the 8 MB band(s) containing any of that file's data (often only one). So I converted my encrypted sparse image to an encrypted sparse bundle, and now I can include it along with all my other files in my ordinary backups.
    ---------------------

Maybe you are looking for