jimmykd Posted April 14, 2018 Posted April 14, 2018 In tommy java server session veriable not working...Showing this... HTTP Status 500 – Internal Server ErrorType Exception Report Message An exception occurred processing JSP page [/updateSyllabus.jsp] at line [106] Description The server encountered an unexpected condition that prevented it from fulfilling the request. Exception org.apache.jasper.JasperException: An exception occurred processing JSP page [/updateSyllabus.jsp] at line [106] 103: </th>104: </tr>105: <%106: String email = session.getAttribute("email").toString();107: Connection Conn = null;108: PreparedStatement PrepareStat = null;109: String sid = ""; Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:584) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:481) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)Root Cause java.lang.NullPointerException org.apache.jsp.updateSyllabus_jsp._jspService(updateSyllabus_jsp.java:220) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:742) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)Note The full stack trace of the root cause is available in the server logs. Apache Tomcat/8.5.24
wolstech Posted April 14, 2018 Posted April 14, 2018 That's a known issue caused by the limitations of Tomcat running in a shared environment like this. Some have managed to get this working by playing with the sessionCookiePath in context.xml or doing various other things (such as prefixing their war with username_ which is also required if WARs need to find resources packed inside them) but its hit or miss. We also don't have many Java programmers on here, so support for broken code is rather limited. Others have had issues with session-related code too: https://www.helionet.org/index/topic/32294-solved-request-for-war-file-to-be-deployed/?hl=%2Bjava+%2Bsession&do=findComment&comment=145801 (no fix found) https://www.helionet.org/index/topic/31718-i-have-uploaded-my-servlet-war-file-could-you-please-activate-it/?view=findpost&p=143545&hl=%2Bjava+%2Bsession (managed to get it working by messing with sessionCookiePath in his WAR's context.xml file)
arkham19 Posted April 15, 2018 Posted April 15, 2018 I think that I have the same problem. User name : arkham19War file Name : mb.war sessionCookiePath solution works?How can I fix it in my site?Putting my context.xml under WEB-INF folder in .war and upload it again? Thanks
wolstech Posted April 15, 2018 Posted April 15, 2018 Correct, you should edit the context.xml that goes in your war, rebuild the war, and redeploy it.
arkham19 Posted April 15, 2018 Posted April 15, 2018 Correct, you should edit the context.xml that goes in your war, rebuild the war, and redeploy it. Perfect.New context.xml added to mb.war under WEB-INF and uploaded. Please reload, thanks
arkham19 Posted April 15, 2018 Posted April 15, 2018 Thanks wolstech, but I think it doesn't works. This is my simple context.xml: <Context sessionCookiePath="/"> <WatchedResource>WEB-INF/web.xml</WatchedResource></Context> and I have put it under mb.war\WEB-INFI need to do something else? My JSP code is also simple: I set some vars like this: session.setAttribute("USERNAME", userName); And I get this var like this: session.getAttribute("USERNAME") It works in my local Tomcat.(I'm sorry if I made a mistake, but I'm a newbie in JSP)
Krydos Posted April 16, 2018 Posted April 16, 2018 Try naming your .war file arkham19_mb.war. Sometimes .war's can't handle being renamed. 1
arkham19 Posted April 17, 2018 Posted April 17, 2018 Try naming your .war file arkham19_mb.war. Sometimes .war's can't handle being renamed. Yeeeaaahhh! Thanks Krydos, it works!
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