scialpif Posted August 29, 2018 Posted August 29, 2018 Hey there, I just successfully deployed a war.The page is accessible at http://judgetree.heliohost.org/JudgeTree/ , but doesn't display properly.It seems that it is unable to load some jsf resources, and also some images, see screenshot.Please help.
scialpif Posted August 29, 2018 Author Posted August 29, 2018 (edited) The following jsf fragment <p:graphicImage url="/images/italy-flag-icon-32.png" id="root" /> on my machine translates into <img id="j_idt7:theTree:root" src="/JudgeTree/images/italy-flag-icon-32.png;jsessionid=94DD261FDF15620DC637F85005D082F8.jvm1?pfdrid_c=true" alt=""> on heliohost, it translates into <img id="j_idt7:theTree:root" src="/scialpif_JudgeTree/images/italy-flag-icon-32.png;jsessionid=94DD261FDF15620DC637F85005D082F8.jvm1?pfdrid_c=true" alt=""> and returns 404 not found. (scialpif is my username) Same for js and css files references. Please help. Edited August 29, 2018 by scialpif
wolstech Posted August 29, 2018 Posted August 29, 2018 Virtually nobody here knows anything about Java, so the odds of getting help on this are low. Krydos is the only one who has an understanding of it. Perhaps he can answer this.
scialpif Posted August 29, 2018 Author Posted August 29, 2018 Virtually nobody here knows anything about Java, so the odds of getting help on this are low. Krydos is the only one who has an understanding of it. Perhaps he can answer this. So, what is your suggestion?Should I reach for Krydos? How can I do it?
wolstech Posted August 29, 2018 Posted August 29, 2018 I'd wait and see if Krydos responds and can help you with why this doesn't work. More often than not these sorts of things are code issues, and none of us are Java programmers. The vast majority of people here know and use PHP.
secege Posted August 29, 2018 Posted August 29, 2018 I was able to get Java servlets working by renaming the context path to /username_appname so in your case that would be /scialpif_JudgeTree including the war file: scialpif_JudgeTree.war I was not able to get session management working reliably.
wolstech Posted August 29, 2018 Posted August 29, 2018 I was able to get Java servlets working by renaming the context path to /username_appname so in your case that would be /scialpif_JudgeTree including the war file: scialpif_JudgeTree.war I was not able to get session management working reliably.We always recommend naming WAR files with username_ in front of them specifically for this issue. I had assumed this was done when it was not, and was confused by your terminology (I don't know what JSF is, I do know that resources won't load without the file named this way though). As you discovered, it needs to be this way in order for a lot of things to work right. As for Sessions...that one's a known issue. They don't work reliably (or in most cases, at all). Editing context.xml can sort of fix it. Also, be sure to rebuild your war to rename it, don't just rename the file. See this topic: https://www.helionet.org/index/topic/32553-tommy-server-java-session-variable-not-working/
scialpif Posted August 29, 2018 Author Posted August 29, 2018 I was able to get Java servlets working by renaming the context path to /username_appname Where did you set this exactly? Thanks.
secege Posted August 29, 2018 Posted August 29, 2018 add file context.xml to the META-INF folder, with this content: <?xml version="1.0" encoding="UTF-8"?><Context path="/scialpif_JudgeTree"/>
scialpif Posted August 29, 2018 Author Posted August 29, 2018 Ok, I have deployed scialpif_TheJudgeTree.war, and it works like a charm. I am happy.Thanks everyone! We always recommend naming WAR files with username_ in front of them specifically for this issue. I had assumed this was done when it was not, and was confused by your terminology (I don't know what JSF is, I do know that resources won't load without the file named this way though). As you discovered, it needs to be this way in order for a lot of things to work right. May I suggest you add this information here? https://wiki.helionet.org/Java_Servlet
Recommended Posts