Hello, I'm trying to use Roller5.1.1 on WildFly8.2.0.Final, and I got into a problem that seems like dependent on WildFly.
After I finish procedures of official installation guide for JBoss, and I create a new blog, but the blog can't be visible. URLs of the top page or the blog are always returning status 500, and many NPEs are dumped on logs. like this: <snip> Caused by: java.lang.NullPointerException at io.undertow.servlet.spec.ServletContextImpl.getMimeType(ServletContextImpl.java:192) at org.apache.roller.weblogger.ui.rendering.servlets.PageServlet.doGet(PageServlet.java:423) <snip> It looks like that the cause is came from WildFly implementation of ServletContext. (https://github.com/undertow-io/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/spec/ServletContextImpl.java) It has no null-check of the argument. So I created a patch for me, so I just contribute this. And I'm not sure whether this is right solution or not, So if anyone knows better way, I will be glad if you could let me know. Thanks. Index: app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java (revision ) +++ app/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java (revision ) @@ -420,13 +420,19 @@ if (StringUtils.isNotEmpty(page.getOutputContentType())) { contentType = page.getOutputContentType() + "; charset=utf-8"; } else { + final String defaultContentType = "text/html; charset=utf-8"; + // prevent NPE at ServletContext#getMimeType(null) on some implementations + if (page.getLink() == null) { + contentType = defaultContentType; + } else { - String mimeType = RollerContext.getServletContext().getMimeType( - page.getLink()); - if (mimeType != null) { - // we found a match ... set the content deviceType - contentType = mimeType + "; charset=utf-8"; - } else { + String mimeType = RollerContext.getServletContext().getMimeType( + page.getLink()); + if (mimeType != null) { + // we found a match ... set the content deviceType + contentType = mimeType + "; charset=utf-8"; + } else { - contentType = "text/html; charset=utf-8"; + contentType = defaultContentType; + } } }