2
votes

I've made a website using JSP's using Netbeans. I want to get this site online so I've bought a VPS (linux) as well as setting up tomcat and apache.

I can get the site to work, but no functionality works such as login, register etc (which all goes through commands in java). When I try to login it redirects me to sitename.com/ServletName and comes up with a message saying:

Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Additionally, a 503 Service Temporarily Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

I've looked this up online and it seems like it's a problem with my web.xml file which means that my .war file doesn't get deployed correctly.

Here's my current web.xml file:

 <?xml version="1.0" encoding="UTF-8"?>

 <web-app xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 version="2.5">

<!--<servlet>
<servlet-name>ServletName</servlet-name>
<servlet-class>Servlet.ServletName</servlet-class>
</servlet>-->


<!-- The mapping for the JSP servlet Commented out-->
<!--servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
</servlet-mapping>-->


<session-config>
    <session-timeout>
        30
    </session-timeout>



</session-config>

<error-page>
    <error-code>404</error-code>
    <location>/error-404.jsp</location>
</error-page>  

</web-app>

Does anyone have any idea of what I need to have in here? Every time I try to log in or whatever it makes my entire site have the same error 503 message so I have to reboot the server etc. and then the same thing happens!

Thanks

Update: Still not working though

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">

<servlet>
<servlet-name>UserActionServlet</servlet-name>
<displayable-name xml:lang="en">My Servlet</displayable-name>
<description>The Servlet</description>
<servlet-class>Servlet.ServletName</servlet-class>
</servlet>


<!-- The mapping for the JSP servlet -->
<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
</servlet-mapping>


<session-config>
    <session-timeout>
        30
    </session-timeout>



</session-config>

<error-page>
    <error-code>404</error-code>
    <location>/error-404.jsp</location>
</error-page>  

</web-app>
1
So you have no servlets in your web application? Nothing but static resources and JSPs? What do the logs say? - Christopher Schultz
You are missing display-name and description tags. - developerwjk
Updated my original question with the other code I've also tried which includes the servlet being mentioned as well as display-name and description. Edit: Still no luck. - user3119841
The error page comes from HTTPD because of a 500 error in Tomcat. You need to check the Tomcat logs to see what the error was. - user207421

1 Answers

0
votes

Open the web.xml that comes with the manager app in Tomcat and look at it. It will help you figure out how to build these documents properly. At the most basic, before defining servlets or anything fancy, you need this much:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5"> 
  <display-name>NAME_TO_DISPLAY_IN_MANAGER_APP</display-name>
  <description>
    DESCRIPTION_OF_WHAT_THIS_APP_IS
  </description>
</web-app>

Even after your edit, you are still missing <display-name> and <description> directly under the <web-app> level. You only added a description of a servlet.