Java.net. unknownhostexception Exception Handling

Source: Internet
Author: User

When the Cluster Environment of Java products is deployed in Linux, the following exception is reported in the background. The system reports that the host named "qatest242" cannot be found:

Error-Get local host name failed-Com. TRS. infra. Cluster. clusterconfig. getmemberhost (clusterconfig. Java: 293)

Java.net. unknownhostexception: qatest242: qatest242
At java.net. inetaddress. getlocalhost (inetaddress. Java: 1353)
At xxxxxxx product exception information
At org. Apache. Catalina. Core. standardwrapper. loadservlet (standardwrapper. Java: 1029)

At org. Apache. Catalina. Core. standardwrapper. Load (standardwrapper. Java: 862)

At org. Apache. Catalina. Core. standardcontext. loadonstartup (standardcontext. Java: 4013)

At org. Apache. Catalina. Core. standardcontext. Start (standardcontext. Java: 4357)

At org. Apache. Catalina. Core. containerbase. addchildinternal (containerbase. Java: 823)

At org. Apache. Catalina. Core. containerbase. addchild (containerbase. Java: 807)

At org. Apache. Catalina. Core. standardhost. addchild (standardhost. Java: 595)
At org. Apache. Catalina. Core. standardhostdeployer. Install (standardhostdeployer. Java: 277)

At org. Apache. Catalina. Core. standardhost. Install (standardhost. Java: 832)
At org. Apache. Catalina. startup. hostconfig. deploydirectories (hostconfig. Java: 701)

At org. Apache. Catalina. startup. hostconfig. deployapps (hostconfig. Java: 432)

At org. Apache. Catalina. startup. hostconfig. Start (hostconfig. Java: 983)
At org. Apache. Catalina. startup. hostconfig. lifecycleevent (hostconfig. Java: 349)

At org. Apache. Catalina. util. lifecyclesupport. firelifecycleevent (lifecyclesupport. Java: 119)

At org. Apache. Catalina. Core. containerbase. Start (containerbase. Java: 1091)
At org. Apache. Catalina. Core. standardhost. Start (standardhost. Java: 789)
At org. Apache. Catalina. Core. containerbase. Start (containerbase. Java: 1083)
At org. Apache. Catalina. Core. standardengine. Start (standardengine. Java: 478)

At org. Apache. Catalina. Core. standardservice. Start (standardservice. Java: 480)

At org. Apache. Catalina. Core. standardserver. Start (standardserver. Java: 2313)

At org. Apache. Catalina. startup. Catalina. Start (Catalina. Java: 556)
At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)

At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)

At java. Lang. Reflect. method. Invoke (method. Java: 597)
At org. Apache. Catalina. startup. Bootstrap. Start (Bootstrap. Java: 287)
At org. Apache. Catalina. startup. Bootstrap. Main (Bootstrap. Java: 425)

 

Error JavaCode:

Inetaddress localhost = inetaddress. getlocalhost ();

 

Solution:

Open the ETC/hosts file on the Linux machine, add the following sentence at the end of the file, and restart the ekp application.

192.9.100.242 cluster242.domain qatest242

192.9.100.242: IP Address

Cluster242.domain: Second-digit Domain Name

Qatest242: Host Name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.