Uploaded image for project: 'Buildr (Retired)'
  1. Buildr (Retired)
  2. BUILDR-607

Java Process Forking

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • 1.4.6
    • 1.5
    • Core features
    • None

    Description

      While running a simple test with a buildr-scala-JERSEY-JETTY setup, the java process is forking, such that printlns are not going to the console the process was started in, and killing that process does not kill the jetty server. It's certainly not a blocker, but it is annoying.

      Here's the buildfile (sorry I can't attach it as a file to download for the issue):
      ***************************************************************************
      require 'buildr/scala'

      repositories.remote << 'http://www.ibiblio.org/maven2'
      repositories.remote << 'http://download.java.net/maven/2'
      repositories.remote << 'http://download.java.net/maven/glassfish'

      SERVLET = ['org.glassfish:javax.servlet:jar:3.0','javax.persistence:persistence-api:jar:1.0']
      JERSEY = ['com.sun.jersey:jersey-json:jar:1.8','com.sun.jersey:jersey-server:jar:1.8','com.sun.jersey:jersey-core:jar:1.8','com.sun.jersey:jersey-bundle:jar:1.8']
      JETTY = ['org.eclipse.jetty:jetty-continuation:jar:8.0.0.M0','org.eclipse.jetty:jetty-security:jar:8.0.0.M0','org.eclipse.jetty:jetty-http:jar:8.0.0.M0','org.eclipse.jetty:jetty-io:jar:8.0.0.M0','org.eclipse.jetty:jetty-util:jar:8.0.0.M0','org.eclipse.jetty:jetty-server:jar:8.0.0.M0','org.eclipse.jetty:jetty-servlet:jar:8.0.0.M0']
      ASM = ['asm:asm-all:jar:3.3.1']

      VERSION_NUMBER = '0.1'
      GROUP = 'test'

      define "testproject" do
      project.version = VERSION_NUMBER
      project.group = GROUP
      compile.with ASM,SERVLET,JERSEY,JETTY

      task :run => :compile do
      puts('Starting up with classpath ' + compile.dependencies.to_s + " " + [compile.target.to_s].to_s)
      Java::Commands.java('launcher.MyServer', :classpath => compile.dependencies + [compile.target.to_s])
      end

      package(:jar).with :manifest=>manifest.merge('Main-Class'=>'launcher.MyServer')

      end

      ***************************************************************************
      Here is launcher.scala:

      package launcher

      import javax.servlet.http.

      {HttpServletRequest, HttpServletResponse}

      import javax.servlet.ServletException

      import java.io.IOException

      import org.eclipse.jetty.server.

      {Server, Request}

      import org.eclipse.jetty.server.handler.AbstractHandler
      import org.eclipse.jetty.server.nio.SelectChannelConnector
      import org.eclipse.jetty.servlet.

      {ServletHolder, ServletContextHandler}

      import com.sun.jersey.spi.container.servlet.ServletContainer

      import javax.ws.rs.

      {GET, Produces, Path}

      object MyServer {

      def main(args: Array[String])

      { System.out.println("Starting up server") val server = new Server(3080) val connector = new SelectChannelConnector() server.addConnector(connector) val holder:ServletHolder = new ServletHolder(classOf[ServletContainer]) holder.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig") holder.setInitParameter("com.sun.jersey.config.property.packages", "com.sample") val context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS) context.addServlet(holder, "/*") server.start server.join }

      }

      *******************************************************************************
      And here is com.sample.Ping.scala:

      package com.sample

      import javax.ws.rs.

      {GET, Produces, Path, PUT}

      @Path("/")
      class PingResource {
      @GET
      def ping() =

      { "ping" }

      @PUT
      def ping(input:String) =

      { input }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            inowland Ian Nowland
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: