Sometimes, you may not have the information of the Linux server that you are deploying your applications on. In order to get the Linux version and distribution, all what you need to do is to use the
cat command as follows:
The distribution and version information are stored in the
/etc directory with the pattern *-release.
You may face this exception in the log file of your web application:
java.net.SocketTimeoutException: Socket operation timed out before it could be completed
After investigating in the error, I found that it happens because of the network connectivity. I could fix it by fixing the network cable.
You may need to get the path of the WEB-INF folder from your Java Servlet for reading custom configuration files or writing temporary files or doing other related work. In order to get the path of the WEB-INF folder (or its sub folders) from your Java Servlet service methods, you can do this by using the
getRealPath() API in the
ServletContext interface as follows:
String path = getServletContext().getRealPath("/WEB-INF");
If we have for example a folder called
xyz under the
WEB-INF folder, we can get its path as follows:
String path = getServletContext().getRealPath("/WEB-INF/xyz");
You may face this error when you are working with Apache commons file upload.
Error 500: java.lang.NoClassDefFoundError: org.apache.commons.io.output.DeferredFileOutputStream
In order to solve this error, you need to include the Apache commons IO jar in the lib folder of your web application. You can download this jar from: http://commons.apache.org/io/download_io.cgi.