You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Ian Nowland (JIRA)" <ji...@apache.org> on 2011/08/15 19:09:27 UTC

[jira] [Created] (BUILDR-607) Java Process Forking

Java Process Forking
--------------------

                 Key: BUILDR-607
                 URL: https://issues.apache.org/jira/browse/BUILDR-607
             Project: Buildr
          Issue Type: Bug
          Components: Core features
    Affects Versions: 1.4.6
            Reporter: Ian Nowland


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
  }
}


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BUILDR-607) Java Process Forking

Posted by "Ian Nowland (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13088205#comment-13088205 ] 

Ian Nowland commented on BUILDR-607:
------------------------------------

When I run this on my OS X system instead of my CentOS system, the system out still doesn't print to the console, but killing the console process does kill the server. A ps, however, still shows two running processes.

> Java Process Forking
> --------------------
>
>                 Key: BUILDR-607
>                 URL: https://issues.apache.org/jira/browse/BUILDR-607
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4.6
>            Reporter: Ian Nowland
>
> 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
>   }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BUILDR-607) Java Process Forking

Posted by "Peter Donald (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Donald updated BUILDR-607:
--------------------------------

    Fix Version/s: 1.5
    
> Java Process Forking
> --------------------
>
>                 Key: BUILDR-607
>                 URL: https://issues.apache.org/jira/browse/BUILDR-607
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4.6
>            Reporter: Ian Nowland
>             Fix For: 1.5
>
>
> 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
>   }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (BUILDR-607) Java Process Forking

Posted by "Alex Boisvert (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090227#comment-13090227 ] 

Alex Boisvert commented on BUILDR-607:
--------------------------------------

Tried this on my system and can't reproduce.   All output shows up on the screen (jetty startup basically) and CTRL-C kills both Jetty and Buildr as expected.

boisvert@honeybrown:~/tmp/buildr-jetty$ uname -a
Linux honeybrown 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
boisvert@honeybrown:~/tmp/buildr-jetty$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
boisvert@honeybrown:~/tmp/buildr-jetty$ buildr --version
Buildr 1.4.6

(Also tried with JRuby 1.6.3 and got same results)

> Java Process Forking
> --------------------
>
>                 Key: BUILDR-607
>                 URL: https://issues.apache.org/jira/browse/BUILDR-607
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4.6
>            Reporter: Ian Nowland
>
> 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
>   }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira