Class UnknownServiceException in Java

Class UnknownServiceException in Java

UnknownServiceException is also common exception classes in java and is thrown from the application to indicate that an unknown service exception has occurred. when we try to get/call service and the service we requested of a particular network connection does not exist.

This is could be due to MIME type(Multipurpose Main Extension) returned by a URL connection does not valid or the application is attempting to write to a read-only URL connection.

In short, it signals an attempt to use an unsupported service of a network connection.A UnknownServiceException is thrown when an unrecognized service is requested, which can occur when the MIME type returned by a URLConnection does not match any recognized types.

The structure of the class UnknownServiceException is defined as :

public class extends java.lang.IOException{
public UnknownServiceException();
//constructs an empty UnknownServiceException object that is an object with no message specified.
public UnknownServiceException(String message);
//constructs an UnknownServiceException object with the message specified.

The class UnknownServiceException also inherits methods from class Object and Throwable.

From Object classFrom Throwable class
wait(long, int)getLocalizedMessage()

Share and Enjoy !

Leave a Reply

Your email address will not be published. Required fields are marked *