Getting Hostname in Solaris10

Hi all,
I have to get the hostname of a machine which is running Solaris 10 . For that I wrote the folowwing code.. But I am getting the 'UnknownHostException" .. Please tell me what is the problem...
import java.net.*;
public class LocalHost
public static void main(String a[])
try
InetAddress host = InetAddress.getLocalHost();
System.out.println(host.toString());
//String name =
//System.out.println(InetAddress.getLocalHost().getHostName());
catch(Exception e)
System.out.println(e.toString());
}

Thanks for the reply!
I do not see any element in the inbound variable representing hostname
Here is how the inbound variable looks like
<con:endpoint name="ProxyService$GatewaySecurity$ProxyService$GatewayProxy" xmlns:con="http://www.bea.com/wli/sb/context">
<con:service>
<con:providerName>GatewaySecurity/resources/X509v3ServiceKeyProvider</con:providerName>
</con:service>
<con:transport>
<con:uri>/GatewaySecurirty/ProxyService/GatewayProxy</con:uri>
<con:mode>request-response</con:mode>
<con:qualityOfService>best-effort</con:qualityOfService>
<con:request xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>application/soap+xml; charset=utf-8</http:Content-Type>
</tran:headers>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
<http:query-parameters/>
</con:request>
<con:response xsi:type="http:HttpResponseMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>application/soap+xml</http:Content-Type>
</tran:headers>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
</con:response>
</con:transport>
<con:security>
<con:transportClient>
<con:username>&lt;anonymous></con:username>
</con:transportClient>
</con:security>
</con:endpoint>>

Similar Messages

  • How to get hostname of a remote computer by ip

    how to get hostname of a remote computer by ip

    In InetAddress class we have a method
    public String getHostName() which returns the name of the host. If applet security prevents the name, the same ipaddress entered is returned back.
    This program is the implementation of this method:
    import java.net.*;
    public class ipdemo
    public static void main(String arg[])
    try
    InetAddress add=InetAddress.getByName("207.228.236.39");
    System.out.println(add.getHostName());
    catch(UnknownHostException e)
    System.out.println("Exception raised");
    This will help you.
    Regards.
    Deepa Datar

  • How to get hostname from targetlist in custom deployment procedure?

    When I make a simple procedure with a phase that will loop through a procedure hostname list
    and a hostcmd or directive inside that will use the hostname ex change a configuration file. How to get hostname from the hostname targetlist?
    I would rather not use $(hostname) or similar function if I can get the hostname from the target list.
    Edited by: user476601 on 2012-09-06 05:59

    I have tried that and cannot get it to work.
    I have tried to make a procedure with:
    parameter
    - parallel fase
    - step directive with hostname parm based on simple sh script (echo $hostname)
    - map hostname setvalue %TargetName%
    In a hostcmd step you cannot access %TargetName% directly
    it doesn't work. Please come with an example if you have tried it.
    /René

  • Print services getting hung on solaris10

    Print services are getting hung on solaris10 server patch 137137-09, i have to restart the print services after some time it try to hang the deamon again.
    Really if one has seen this problem

    Ditto here on wrong colors in items ordered from APPLE.
    I just received a book I ordered and the color of all images aren't what I submitted. They're all darker and, in some cases, pinkish.
    I checked them using APPLE preview proofing process, and the preview proof looked great... exactly what I had intended.
    The images were old photos scanned in, and I did color corrections as well as cropping. Yet, I've done this in previous books and have had fabulous results.
    Am interested to hear if anyone has any solutions because maybe I'm doing something with color corrections I shouldn't be doing?

  • Substitution Method to get hostname(ODIServer)

    Any quick substitution method I can use to get the hostname of the server the Agent is running on? Im looking for the least impact possible, could set up a variable etc. but that would mean a lot of changes in my enviroment
    If I can do so with substitution method I can swipe the repos tables in one hit.
    Many thanks
    Alastair

    Hi,
    hoping to help you could use this workaround
    -create a flexfield on pysical agent
    -create a userfunction that decodes your agent name to its internal id
    -use in your interface
    <%=odiRef.getFlexFieldValue(myFunction(odiRef.getSession("AGENT_NAME"),"<AGENT_TYPE>","FLEX_HOSTNAME")%>
    I know it's quite twisted...

  • Getting hostname associated with an interface assigned its address by DHCP

    I'm trying to get my VirtualBox install of Solaris 11 Express to assign the hostname to the DHCP acquired address for its Ethernet I/F. All attempts to find a solution has covered earlier versions of Solaris and the only reference I could find was in the Post-installation notes which directs you to use netcfg and/or netadm. Neither of these commands exist on my installed system. I need the address assigned by DHCP to be associated with the hostname as defined by /etc/nodename as I want to use an RMI server on this system.
    Any suggestions gratefully received.
    George Nelson

    Frop
    Ok what is the point to write something uou have alreadt written above?
    I said "What to do to fix it you decide", because your advice to disable IPv6 will bring to him additional problems like this preventing creation of homegroup if IPv6 is disabled and maybe some other problems!
    This is not competition, but to help means to resolve the problem, but not to solve it somehow by creating a lot of other problems

  • Get hostname from AIR?

    I'm writing a Flash-in-browser to AIR-on-desktop app.
    I can get the two to communicate via the LocalConnection API's, but AIR and Flash appear to think differently about what domain they're in.
    Even though the browser and AIR apps are on the same machine, leaving out AllowDomain() doesn't work as it would with 2 flash objects.
    This means I need to put the domain name into the AIR's AllowDomain() function, but I can't find a way to get that name.
    So far I've made it work by:
    + Manually entering the domain (which isn't 'locahost', I need to use the computer's specific name)
    + Using '*' in AllowDomain() (which seems like a security hole).
    Help?

    I have tried that and cannot get it to work.
    I have tried to make a procedure with:
    parameter
    - parallel fase
    - step directive with hostname parm based on simple sh script (echo $hostname)
    - map hostname setvalue %TargetName%
    In a hostcmd step you cannot access %TargetName% directly
    it doesn't work. Please come with an example if you have tried it.
    /René

  • Changed IP address, not get "bad inetd address, cannot get hostname"

    I'm running OS 10.4.8 Server on a MacPro.
    I've changed the IP address and name of my computer. I ran changeip and updated the IP address and hostname under Preferences > Network and Preferences > Sharing. Everything seemed to be ok, that is, I can surf the web, read email, ssh to and from (most) other computers. There are two problems:
    1. I cannot "Connect to Server..." from my laptop. It claims that the "The server may not exist or is not operational at this time. Check the server name or IP address and try again."
    2. When I try to launch some software (Tecplot, to be precise, from an xterm) which requires contacting a license server, it claims that it "Cannot get host by name or bad inet address".
    Here's some additional information:
    A. If I run "nslookup <servername>" on my computer, I get
    ** server can't find vonkarman.mae.ufl.edu: NXDOMAIN
    However, if I run the exact same command on another local machine, I get the correct IP address (not suprisingly, I can ssh to my machine from that machine).
    B. If I run "hostname" on my computer, I get the right hostname.
    C. If I run "uname -a", I also get what I expect.
    Any help would be greatly appreciated!
    Thanks
    Andreas
    MacPro   Mac OS X (10.4.8)   Server

    more information is needed about your network config.
    Specifically, are you running NAT on the server? If so, how is it configured? Is the server's firewall enabled?
    Jeff

  • Cannot get HOSTNAME to display on front panel on my new WC5955's like I can on my old WC5755's

    Hi, I have set the Display Device Information option under General Setup (used to be under Security) to "HOSTNAME".  I get an error stating that the HostName is not fully qualified.  For security reasons, we use static IP addresses and do not want our copiers registered in DNS.  We use the queue name for our host name and device name.  We require that print queue name to be displayed on the copier's front panel so the users can easily identify the print queue name of the copier.  The last 3-digits of the queue name is the 4th number in each printer/copier's IP address. The old WC57xx Series copiers happily display their hostnames without restriction.  Why was this changed?  Annoying!!! -John

    After years of battling over the security issues resident with Netbios over TCP/IP Xerox has it seems removed "Windows Networking" from all current devices. This is the same thing that disables the use of scanning to a hostname instead of an IP in a non-Domain environment. Your only option here is to lie and put it manually via choosing "Contact Name" and filling in the hostname: 

  • GET HOSTNAME SERVER IN PL/SQL

    Hi
    Is it possible to get the hostname of my unix server where my database is located in a pl/sql procedure ?
    I try to use sys_context('userenv','host') but it show me the hostname of my client where i launch the procedure not the hostname server.
    Is it possible to do such things ?
    Thanks.

    The same question has been asked yesterday here
    Re: Is the server name the Database is running on stored in a system table?

  • Get Hostname

    Hi,
    I'm trying to read the hostname to access a file inside of my portal application:
    getHostname() + request.getWebResourcePath() + "/xml/avrss.xml");
    private String getHostname() {
         try{
              IURLGeneratorService generator = (IURLGeneratorService)ResourceFactory.getInstance().
                   getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
              IHierarchicalUri absUri = generator.getAbsoluteUri(PathKey.CONTENT_ACCESS_PATH);
              return splitAfterPort(absUri.toString());
         catch(Exception e){
              return "null;" + e.getMessage();
    private String splitAfterPort(String str) {
         int start = 0;
         if (str.startsWith("http")) {
              start = 7;
         return str.substring(0, str.indexOf('/', str.indexOf(':', start)));
    this works fine on our development system. But on our productive system with two servers and four dialog instances (this is the only difference), the hostname is empty (returned value is http:/irj/portalapps/xyzproject/xml/avrss.xml).
    How can I get the hostname in all cases?
    thank you

    Hi look here:
    To call up the configuration of the URL generator service, choose System Administration u2192 System Configuration  u2192 Knowledge Management  u2192 Content Management  u2192 Global Services  u2192 Show Advanced Options  u2192 URL Generator Service in the portal.
    Regards,
    Kai

  • Getting hostname/IP of the BEA server

    Hello,
    I need to know the IP of the BEA server the request is currently working on.
    I have a cluster with 2 servers inside, each running in its HW.
    The HW has IP and the BEA has different IP.
    We need to send a request (using URLConnection) to another servlet in the same application which must be running on the same server.
    We have used InetAddress.getLocalHost() is past, but now the HW's IP and BEA's IP are different and this causes problem.
    Is there an easy way how to get the IP from Java?
    We can put the IP into a property file, but this is not prefferd way, because we'd have different properties file on different servers.
    Thanks advance for any advice.
    Lubos

    Oops. Missed the important part. It is a custom class which does something like this.
    1. Gets the initial context.
    2. Looks up for "weblogic.management.home.localhome" and assigns it to an weblogic.management.MBeanHome object.
    3. Call getMBeansByType("ServerConfig") on the object mentioned in step 3 and assign the returned value to a Set object.
    4. Iterate through the Set created in step 3 and assign it to weblogic.management.WebLogicMBean object.
    5. Call getName() on the object in step 4 and check whether it is equal to
    System.getProperty("weblogic.Name").
    If the check returns true, call
    getAttribute("ListenAddress") on the object created in step 4 and convert it to String object.
    On similar lines, you can call getAttribute("ListenPort") on the object too.
    If this works for you, please assign the reward points.
    Cheers!
    Dips

  • Getting hostname from inside Java code...

    What is the easiest method to determine the hostname of the machine my appication is running on? Any code bits would be helpful.

    Couldn't you use something like:
    String host = getClass().getClassLoader().getResource(getClass() + ".class").getHost();
    With applets you can just call getCodeBase() and do stuff with that, but I think the above might work regardless of whether the object is an applet or not.

  • Getting hostname within a java app

    Folks,
    How can I get the host name or ip address within a java app. System.getProperty() does not help here.
    Saif

    I guess you need to add getHostName() at the end as well??

  • Getting host name in clustered environment

    Hi,
    in my J2EE Web application, I'd like to get the hostname of the Portal server where my J2EE app is deployed. But this is a clustered pipeline system where many servers exist in our QA system.
    So if I were to try:
         java.net.InetAddress addr = java.net.InetAddress.getLocalHost();
            String hostname = addr.getCanonicalHostName();
    I am not sure what the call to getCanonicalHostName would return to me?
    Does it always give me the domain name of the central instance? e.g. s1.abc.mycompany.com
    Or can it give me the domain name of any of the instances?
    Has anyone tried this before?
    Alternatively within my program is there anyway to determine which pipeline system I am on - dev, QA or production?
    Appreciate your response.
    Sharath

    Hello Sharath.. I guess below statement can be useful to create clusterInformation object
    IClusterInformation clusterInformation = (IClusterInformation) PortalRuntime.getRuntimeResources().getService("com.sap.portal.runtime.system.clusterinformation.clusterinformation");
    The above object can be useful to get hostname/ip and cluster elements info....
    Regards,
    Madhu

Maybe you are looking for