Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

JAMon WAR and Embedded Jetty

Jeffrey
2012-03-27
2013-05-20
  • Jeffrey
    Jeffrey
    2012-03-27

    Hi, I'm trying to deploy JAMon with my web application. I've successfully set up the filter and the JDBC proxy, but I'm having some issues with the WAR to see the results. We're running embedded jetty, and I'm initializing the JAMon WAR servlet like this:

    final WebAppContext jamonContext = new WebAppContext();
    jamonContext.setContextPath("/jamon");
    jamonContext.setWar("webapps/jamon.war");
    

    However, when I visit the URL I get this error:

    java.lang.NullPointerException
        at org.apache.jsp.menu_jsp._jspService(menu_jsp.java from :57)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:476)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:366)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:284)
        at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:115)
        at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:552)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
        at org.eclipse.jetty.server.Server.handle(Server.java:346)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1048)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:601)
        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:535)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
        at java.lang.Thread.run(Thread.java:662)
    

    I can't seem to find the java files in which the NPEs are occurring either. We're running Jetty 7.4.4 with JDK 1.6. Any ideas? Thanks!

     
  • Regarding Jetty and compiled JSP Java classes see

    http://docs.codehaus.org/display/JETTY/Jsp+Configuration

    "Also be aware that for JDK1.6, the default for "keepgenerated" is "false", therefore .java files will only be left after compilation if there is a compilation error."

     
  • Jeffrey
    Jeffrey
    2012-03-27

    Thanks for the link, but I've tried that already. Setting the init parameter "keepgenerated" to "true" for the WebAppContext doesn't seem to do anything.

     
  • Jeffrey
    Jeffrey
    2012-03-27

    I've diagnosed it to the fact that a JspFactory.getPageContext() call seems to return null when rendering menu.jsp. Anyone have any ideas about why this might happen?

     
  • Steve Souza
    Steve Souza
    2012-03-27

    I''m not familiar with jetty.  It might be a good question for their forum. 

    Or you could try to add a simple hello word jsp to the jamon war and see if it renders.  Alternatively you could creaate your own simple war with one jsp that simply returns the String html table returned by MonitorFactory.getReport() and see if it renders.  If it renders at least you can tell if jamon is working or not.  Try those and report back.

     
  • Jeffrey
    Jeffrey
    2012-03-28

    Turns out it was just due to mismatching jar dependencies. Thanks for the help!