Opened 11 years ago

Last modified 11 years ago

#1295 reopened defect

JSP and UTF-8

Reported by: ianwallen Owned by: geonetwork-devel@…
Priority: major Milestone: v2.10.0 RC3
Component: User interface (web) Version: v2.10.0RC2
Keywords: Cc:

Description

If I attempted to login using invalid credentials (using the classic interface) I get an "HTTP ERROR 500" (see error below)

After looking at the webdefault.xml in the jetty folder I noticed that javaEncoding defaults to UTF-8. So I convert my login.jsp to UTF-8 format then all works well.

So my question is - where should this be fixed.

  • Should we ensure all *.jsp are in UTF-8 encoding?
  • Should be adjust to webdefault.xml to specify another encoding?
  • Should it be part of the build process to ensure all *.jsp are in UTF-8 format?
  • Other options?

java.lang.ClassNotFoundException: org.apache.jsp.login_jsp
	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at org.apache.jasper.servlet.JasperLoader.findClass(JasperLoader.java:204)
	at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:190)
	at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:122)
	at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:639)
	at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:192)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:534)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
	at org.fao.geonet.monitor.webapp.WebappMetricsFilter.doFilter(WebappMetricsFilter.java:96)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
	at org.fao.geonet.monitor.webapp.MetricsRegistryInitializerFilter.doFilter(MetricsRegistryInitializerFilter.java:31)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:178)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:155)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:474)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:480)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:934)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:404)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:184)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:869)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:346)
	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581)
	at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1040)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:592)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:526)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:41)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
	at java.lang.Thread.run(Thread.java:679)

Change History (5)

comment:1 by heikki, 11 years ago

In my opinion it's desired that all source files or in UTF-8 (without BOM).

I do not know if that's easy to check and change, e.g. in the build or commit process.

comment:2 by fxp, 11 years ago

Resolution: fixed
Status: newclosed

comment:3 by ianwallen, 11 years ago

Commit 99ef6081e8a18d95c6519e011afdcf064eb96d71 2.10.x branch Commit 17bffbf3391b9822cfe9ddde70a571adae9d422a master branch

comment:4 by ianwallen, 11 years ago

Resolution: fixed
Status: closedreopened

I'm still having this issues. I believe it is related to Jetty. I have been able to pick up a pattern.

If I start the server after a fresh install (using classic interface) and enter an invalid username password. I get the error above.

However if I perform a fresh start of the server and before attempting to login with and invalid password I go to the following page first. http://localhost:8080/geonetwork/login.jsp (This will compile the jsp page and simply ask for the login credentials) Now I can go to the home page (http://localhost:8080/geonetwork) and enter an invalid password and it works.

It seems as if the JSP gets compiled by performing a "GET" request directly to the page it seems to work OK afterwards. But if it is compiled while performing a "POST" request it fails.

Maybe we should look at converting this to a service like the rest of the pages and avoid using jsp for the moment as it seems to be causing issues.

Any comments?

comment:5 by ianwallen, 11 years ago

Another issues is that the language is lost during the authentication process which uses the login.jsp. If I select my language as French then attempt to login but get the credentials wrong then it goes to the login.jsp which presents the login screen as back English. Once authenticated, it goes back to French.

Note: See TracTickets for help on using tickets.