vaninf Posted June 12, 2017 Posted June 12, 2017 I just put file web.xml in folder /home/vaninf/public_html/WEB-INF/ Please restart Tomcat server. My user name is vaninf. Thanks.
vaninf Posted June 12, 2017 Author Posted June 12, 2017 Why doesn't the servlet mapping in web.xml work? My web.xml is in folder /home/vaninf/public_html/WEB-INF/ Is it caused by configuration of Tomcat?
vaninf Posted June 13, 2017 Author Posted June 13, 2017 It has nothing to do with .war file, I didn't create .war file. I uploaded the servlet class files and web.xml into /home/vaninf/public_html/WEB-INF/ folder by myself, I accessed http://vaninf.heliohost.org/index.htmto invoke the servlet because index.htm is mapped to the servlet. The server shows "The requested URL /index.htm was not found on this server." I think this is caused by Apache http server, it must have been configured to pass only .jsp file requests to Tomcat server, soall other file requests are blocked by Apache http server, they can't reach Tomcat server. So the servlet mapping defined inweb.xml are not used when we access http://vaninf.heliohost.org/index.htm, because index.htm is not .jsp file name. Am I right?
Krydos Posted June 13, 2017 Posted June 13, 2017 Yes, Apache is much better at serving html files. Tomcat handles .jsp etc. It has nothing to do with .war file, I didn't create .war file.Why do you keep requesting for them to be deployed then? http://www.helionet.org/index/topic/28363-please-deploy-my-war-file/ http://www.helionet.org/index/topic/28339-please-deploy-my-war-file/ http://www.helionet.org/index/topic/28326-please-deploy-my-war-file/ ?
vaninf Posted June 13, 2017 Author Posted June 13, 2017 To prove you and I are correct, I have changed the servlet mapping in web.xml, now the servletsare mapped to .jsp file names. I have uploaded web.xml again. To let the new web.xml take effect,Tomcat server should be restarted. Could you please restart Tomcat server? Thanks
vaninf Posted June 13, 2017 Author Posted June 13, 2017 The deployed war files don't work as expected because request.getServerName(), request.getServerPort()and request.getContextPath() return wrong values. My web application won't work if I deploy it this way.The new servlet mapping defined in web.xml still doesn't work. Could you please find out why?The new servlet mapping defined in web.xml still doesn't work. Could you please find out why?
Krydos Posted June 13, 2017 Posted June 13, 2017 Another user was having issues with the way we proxy Tomcat through Apache so that Apache can handle the static files, and Tomcat can handle the java scripts. He was able to figure it out. Perhaps his guide will help you? http://www.helionet.org/index/topic/28053-solved-deploy-war-app-request/?p=128900
Krydos Posted June 13, 2017 Posted June 13, 2017 Handling the proxy paths is also explained on our wiki http://wiki.helionet.org/Java_Servlet#Edit_index.jsp_Source
vaninf Posted June 13, 2017 Author Posted June 13, 2017 Krydos, I have changed the servlet code and web.xml. Could you please restart the Tomcat server?
vaninf Posted June 14, 2017 Author Posted June 14, 2017 Thank you Krydos, My servlets are fully working now!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now