vaninf Posted June 12, 2017 Share 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. Quote Link to comment Share on other sites More sharing options...
Krydos Posted June 12, 2017 Share Posted June 12, 2017 Restarted. Quote Link to comment Share on other sites More sharing options...
vaninf Posted June 12, 2017 Author Share 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? Quote Link to comment Share on other sites More sharing options...
Krydos Posted June 13, 2017 Share Posted June 13, 2017 Are you including that in your .war? Quote Link to comment Share on other sites More sharing options...
vaninf Posted June 13, 2017 Author Share 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? Quote Link to comment Share on other sites More sharing options...
Krydos Posted June 13, 2017 Share 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/ ? Quote Link to comment Share on other sites More sharing options...
vaninf Posted June 13, 2017 Author Share 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 Quote Link to comment Share on other sites More sharing options...
Krydos Posted June 13, 2017 Share Posted June 13, 2017 Restarted. Quote Link to comment Share on other sites More sharing options...
vaninf Posted June 13, 2017 Author Share 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? Quote Link to comment Share on other sites More sharing options...
Krydos Posted June 13, 2017 Share 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 Quote Link to comment Share on other sites More sharing options...
vaninf Posted June 13, 2017 Author Share Posted June 13, 2017 His guide doesn't help me. Quote Link to comment Share on other sites More sharing options...
Krydos Posted June 13, 2017 Share Posted June 13, 2017 Handling the proxy paths is also explained on our wiki http://wiki.helionet.org/Java_Servlet#Edit_index.jsp_Source Quote Link to comment Share on other sites More sharing options...
vaninf Posted June 13, 2017 Author Share Posted June 13, 2017 Krydos, I have changed the servlet code and web.xml. Could you please restart the Tomcat server? Quote Link to comment Share on other sites More sharing options...
Krydos Posted June 14, 2017 Share Posted June 14, 2017 Restarted. Quote Link to comment Share on other sites More sharing options...
vaninf Posted June 14, 2017 Author Share Posted June 14, 2017 Thank you Krydos, My servlets are fully working now! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.