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 java.io.UnknownServiceException extends java.lang.IOException{
//constructor
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 class | From Throwable class |
---|---|
clone() | fillInStackTrace() |
getClass() | getMessage() |
notify() | printStackTrace() |
wait() | printStackTrace(PrintWriter) |
wait(long, int) | getLocalizedMessage() |
wait(long) | printStackTrace(PrintStream) |
equals(Object) | |
toString() | |
finalize() | |
hashCode() | |
notifyAll() |