-1

i have one server installed in my system.It takes one of the ip addresses and acts as own system.

In my java program i connect to that server using the following code.

ServiceInstance si = new ServiceInstance(new URL("https://10.100.13.36/sdk"), "user", "password", true);

true indicates the ignore certificate to be true.

when i tried to execute with false parameter it says the following error.

CertificateException: No subject alternative names matching IP address 10.100.13.36 found

i got here that i have to use the dns name instead of ip address in case of certificate mode of server.

So i found in the server configuration settings that the server is taking the DNS name as localhost.localdomain

so i tried with the url as https://localhost.localdomain/sdk

it has shown the error that localhost.locadomain has not been found.

i guess it has some problem with DNS name resolution with localhost as my system and localhost.localdomain as my server dns name.

can we find the dns name with giving ip address through java program.So that it finds the DNS name on its own and pass the value in the url.

can anybody give some suggestion on this.

Thank you..

Levon
  • 138,105
  • 33
  • 200
  • 191
Pratap M
  • 1,059
  • 3
  • 21
  • 31

1 Answers1

0

A DNS name is assigned by your local DNS server. The name localhost.localdomain is usually assigned in the host file so various local operations function (e.g., system logging, sending email to the root user from periodic tasks). I would guess that your server is not registered in the local DNS server. It is rare that locally run virtual machines actually have a valid registration in DNS - this is especially true for Linux systems running in a Windows environment.

If it were registered in DNS and both your server and client were using the same DNS hierarchy, then all that you need to do is create an java.net.InetAddress using the IP address of the machine and call getCanonicalHostName() to retrieve its DNS name. If it does not have a name registered in the local DNS server, then you will simply get the IP address back.

D.Shawley
  • 58,213
  • 10
  • 98
  • 113
  • I intially put www.cabc.com as match in host file of my system.Now it is displaying the output as www.cabc.com.........but what i need is to get the DNS name assigned by vmware server for this ip address(10.100.13.36) – Pratap M Jun 03 '12 at 13:08
  • i guess my vmware server only takes the ip address from private network and assignes its own dns name for itself.and it is not known to any other systems.Even my computer is independent to vmware server.So thats why given a dns name java program is unable to find the server.But given a ip name(as it is taken from pool of ip addresses) we can able to ping the ip address 10.100.13.36 . with this program runs successfully. what i am thinking in my mind this task can not be achieved. – Pratap M Jun 03 '12 at 13:19
  • this mentioned task is not achieved.But my main task of certificate is acheived. – Pratap M Jun 04 '12 at 10:00