Note that there are some explanatory texts on larger screens.

plurals
  1. POPlay framework: Running separate module of multi-module application
    primarykey
    data
    text
    <p>I'm trying to create a multi-module application and run one of it's modules separately from the others (from another machine). Project structure looks like this: </p> <pre><code> main / \ module1 module2 </code></pre> <p>I want to run a module1 as a separate jar file (or there is a better way of doing this?), which I will run from another machine (I want to connect it to the main app using Akka remoting). </p> <p>What I'm doing:</p> <ol> <li>Running "play dist" command </li> <li>Unzipping module1.zip from universal folder </li> <li>Setting +x mode to bin/module1 executable. </li> <li>Setting my main class (will paste it below): instead of <code>play.core.server.NettyServer</code> im putting my main class: <code>declare -r app_mainclass="module1.foo.Launcher"</code> </li> <li>Running with external application.conf file.</li> </ol> <p>Here is my main class:</p> <pre><code>class LauncherActor extends Actor { def receive = { case a =&gt; println(s"Received msg: $a ") } } object Launcher extends App { val system = ActorSystem("testsystem") val listener = system.actorOf(Props[LauncherActor], name = "listener") println(listener.path) listener ! "hi!" println("Server ready") } </code></pre> <p>Here is the console output:</p> <pre><code>@pavel bin$ ./module1 -Dconfig.file=/Users/pavel/projects/foobar/conf/application.conf [WARN] [10/18/2013 18:56:03.036] [main] [EventStream(akka://testsystem)] [akka.event-handlers] config is deprecated, use [akka.loggers] akka://testsystem/user/listener Server ready Received msg: hi! @pavel bin$ </code></pre> <p>So the system switches off as soon as it gets to the last line of the main method. If I run this code without Play - it works as expected, the object is loaded and it waits for messages, which is expected behavior. </p> <p>Maybe I'm doing something wrong? Or should I set some options in module1 executable? Other ideas? </p> <p>Thanks in advance!</p> <p>Update: Versions:</p> <ul> <li>Scala - 2.10.3 </li> <li>Play! - 2.2.0</li> <li>SBT - 0.13.0</li> <li>Akka - 2.2.1</li> <li>Java 1.7 and 1.6 (tried both)</li> </ul> <p>Build properties:</p> <pre><code>lazy val projectSettings = buildSettings ++ play.Project.playScalaSettings ++ Seq(resolvers := buildResolvers, libraryDependencies ++= dependencies) ++ Seq(scalacOptions += "-language:postfixOps", javaOptions in run ++= Seq( "-XX:MaxPermSize=1024m", "-Xmx4048m" ), Keys.fork in run := true) lazy val common = play.Project("common", buildVersion, dependencies, path = file("modules/common")) lazy val root = play.Project(appName, buildVersion, settings = projectSettings).settings( resolvers ++= buildResolvers ).dependsOn(common, module1, module2).aggregate(common, module1, module2) lazy val module1 = play.Project("module1", buildVersion, path = file("modules/module1")).dependsOn(common).aggregate(common) lazy val module2: Project = play.Project("module2", buildVersion, path = file("modules/module2")).dependsOn(common).aggregate(common) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload