Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4820

Problems using Groovlet / GSP from embedded Jetty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.0
    • 2.0.6, 1.8.9
    • Groovlet / GSP
    • None
    • Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100), Jetty 6.1.26, java version "1.6.0_24"

    Description

      I'm trying to use Groovlet / GSP from within an embedded Jetty, and it's not working for me.

      I want to distribute my web application as a single jar-with-dependencies. So i start an embedded standalone Jetty that serves the webapplication from the jar-with-dependencies build with the assembly plugin.

      When I try to load a GSP I get this stacktrace:

      2011-05-10 10:50:47.168:WARN::/web/groovy/test.gsp
      java.lang.NullPointerException
      at java.io.File.<init>(File.java:222)
      at groovy.servlet.AbstractHttpServlet.getScriptUriAsFile(AbstractHttpServlet.java:306)
      at groovy.servlet.TemplateServlet.service(TemplateServlet.java:377)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:326)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      When I try to load the Groovlet I get this stacktrace:

      2011-05-10 11:00:22.961:INFO:/:GroovyServlet Error: script: '/web/groovy/test.groovy': Script processing failed.nulljava.lang.String.startsWith(String.java:1421)
      GroovyServlet Error: script: '/web/groovy/test.groovy': Script processing failed.nulljava.lang.String.startsWith(String.java:1421)
      java.lang.NullPointerException
      at java.lang.String.startsWith(String.java:1421)
      at java.lang.String.startsWith(String.java:1450)
      at groovy.servlet.AbstractHttpServlet.getResourceConnection(AbstractHttpServlet.java:170)
      at groovy.util.GroovyScriptEngine.loadScriptByName(GroovyScriptEngine.java:450)
      at groovy.util.GroovyScriptEngine.createScript(GroovyScriptEngine.java:528)
      at groovy.util.GroovyScriptEngine.run(GroovyScriptEngine.java:515)
      at groovy.servlet.GroovyServlet$1.call(GroovyServlet.java:120)
      at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:106)
      at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.access$400(GroovyCategorySupport.java:64)
      at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:246)
      at groovy.servlet.GroovyServlet.service(GroovyServlet.java:129)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:326)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      When I start the webapplication using the Jetty plugin i works perfectly.

      I have attached a simple project to demonstrate the problem. Build it "mvn install" and start jetty either from the web app using the Jetty plugin (cd web; mvn jetty:run) or the standalone (cd standalone; java -jar target/standalone-1.0-SNAPSHOT-jar-with-dependencies.jar). The embedded Jetty listens on port 8080.

      URLs to reproduce:
      http://localhost:8080/web/groovy/test.gsp
      http://localhost:8080/web/groovy/test.groovy?name=myname

      Attachments

        1. bug.zip
          8 kB
          Morten Holm

        Activity

          People

            blackdrag Jochen Theodorou
            mortenholm Morten Holm
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: