1

I had a java web app which was working fine on the AWS server. However, after some time and perhaps some slight changes, which I can't remember, I am getting 404 error.

I have tried to reboot the server, restart the tomcat re-deploy the app.

Nothing works, I have also set public RWX permission.

The Tomcat version is 7, Java as well. It all came in an AMI package by AWS.

I am getting the same result when I try to go: /manager/index.jsp

Any idea? Is there more information I can provide?

web.xml:


 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
    <display-name>Visma_UploadInterface</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>LoginServlet</servlet-name>
        <servlet-class>servlets.LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>LoginServlet</servlet-name>
        <url-pattern>/main/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>MainPageServlet</servlet-name>
        <servlet-class>servlets.MainPageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>MainPageServlet</servlet-name>
        <url-pattern>/mainPage/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>MappingServlet</servlet-name>
        <servlet-class>servlets.MappingServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>MappingServlet</servlet-name>
        <url-pattern>/mapping/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>ListImportServlet</servlet-name>
        <servlet-class>servlets.ListImportServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ListImportServlet</servlet-name>
        <url-pattern>/listImport/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>RejectedRecordsServlet</servlet-name>
        <servlet-class>servlets.RejectedRecordsServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>RejectedRecordsServlet</servlet-name>
        <url-pattern>/rejectedRecords/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>UploadServlet</servlet-name>
        <servlet-class>servlets.UploadServlet</servlet-class>

    </servlet>



</web-app>

Maybe the solution would be to reinstall the Tomcat, but is there a way just to get a fresh installation of it from AWS? Or some rollback?

Some logs from Catalina.out they show errors:

SEVERE: Failed to initialize end point associated with ProtocolHandler ["ajp-bio-8009"]
java.net.BindException: Address already in use <null>:8009
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:413)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:649)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:821)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400)
    ... 16 more

Aug 12, 2015 12:44:43 PM org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector [Connector[AJP/1.3-8009]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[AJP/1.3-8009]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:821)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:980)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 12 more
Caused by: java.net.BindException: Address already in use <null>:8009
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:413)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:649)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
    ... 13 more
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400)
    ... 16 more

I have changed a port from 8009 to 8089 in the server.xml configuration file.

I was able to get rid of the above error in catalina.out however, the issue with the 404 still persists.

Now I was able to get to the Tomcat manager and also log in. However, my app still shows 404.

Ondrej Tokar
  • 4,898
  • 8
  • 53
  • 103
  • Can you paste your web.xml here – Kumar Abhinav Aug 12 '15 at 12:13
  • Can u provide the logs? – Sumit Gupta Aug 12 '15 at 12:13
  • I have pasted the web.xml of the web app, but as I said in the description, I am not even able to see the /manager/index.jsp. – Ondrej Tokar Aug 12 '15 at 12:20
  • what are the contents of `Tomcat/webapps`? – meskobalazs Aug 12 '15 at 12:21
  • @meskobalazs ROOT, manager, host-manager, examples, docs, my app – Ondrej Tokar Aug 12 '15 at 12:22
  • have you changed something in web.xml or any other configuration files? – Kai Woska Aug 12 '15 at 12:23
  • @KaiWoska, yes I wanted to add the file size limitation and I also changed owner of the file. That was the only thing I've done. Then when I thought that might be the issue, I have removed the part with the size limitation. However, I have no idea who was owner of the file before... that is AWS, I am logged in as user: "ubuntu" – Ondrej Tokar Aug 12 '15 at 12:24
  • is there a user "tomcat" you can assign as owner? – Kai Woska Aug 12 '15 at 12:29
  • I have tried to assign owner of the conf folder to tomcat and then also to bitnami (which is owned by tomcat I guess). Also I have restarted the tomcat both times. Doesn't work. – Ondrej Tokar Aug 12 '15 at 12:33
  • @KaiWoska, I think I found the issue, can you please take a look at the logs? – Ondrej Tokar Aug 12 '15 at 13:03
  • Hmm? Seems like another instance of tomcat is still running. Sadly I have no experience with AWS. How much access do you have to find the running process listening on port 8009 and killing it? – Kai Woska Aug 14 '15 at 07:59
  • Thank you for help. I have figured it out. I had to restart the whole server, reset permissions etc. Also I got much help by looking into logs, which was another file: catalina-daemon.out ... I don't exactly remember what have I done... – Ondrej Tokar Aug 14 '15 at 10:58

0 Answers0