diff --git a/akka-core/src/main/scala/actor/BootableActorLoaderService.scala b/akka-core/src/main/scala/actor/BootableActorLoaderService.scala
index 14ab2301df..9bbb377ed6 100644
--- a/akka-core/src/main/scala/actor/BootableActorLoaderService.scala
+++ b/akka-core/src/main/scala/actor/BootableActorLoaderService.scala
@@ -29,21 +29,28 @@ trait BootableActorLoaderService extends Bootable with Logging {
log.error("Could not find a deploy directory at [%s]", DEPLOY)
System.exit(-1)
}
- val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList.asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
+ val filesToDeploy = DEPLOY_DIR.listFiles.toArray.toList
+ .asInstanceOf[List[File]].filter(_.getName.endsWith(".jar"))
var dependencyJars: List[URL] = Nil
filesToDeploy.map { file =>
val jarFile = new JarFile(file)
val en = jarFile.entries
while (en.hasMoreElements) {
val name = en.nextElement.getName
- if (name.endsWith(".jar")) dependencyJars ::= new File(String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
+ if (name.endsWith(".jar")) dependencyJars ::= new File(
+ String.format("jar:file:%s!/%s", jarFile.getName, name)).toURI.toURL
}
}
val toDeploy = filesToDeploy.map(_.toURI.toURL)
log.info("Deploying applications from [%s]: [%s]", DEPLOY, toDeploy)
log.debug("Loading dependencies [%s]", dependencyJars)
val allJars = toDeploy ::: dependencyJars
- new URLClassLoader(allJars.toArray.asInstanceOf[Array[URL]] , getClass.getClassLoader)
+
+ val parentClassLoader = classOf[Seq[_]].getClassLoader
+ URLClassLoader.newInstance(
+ allJars.toArray.asInstanceOf[Array[URL]],
+ ClassLoader.getSystemClassLoader)
+ //parentClassLoader)
} else getClass.getClassLoader)
}
diff --git a/akka-core/src/main/scala/config/Config.scala b/akka-core/src/main/scala/config/Config.scala
index fbafdb9b68..c2060760e5 100644
--- a/akka-core/src/main/scala/config/Config.scala
+++ b/akka-core/src/main/scala/config/Config.scala
@@ -6,11 +6,13 @@ package se.scalablesolutions.akka.config
import se.scalablesolutions.akka.util.Logging
-import net.lag.configgy.{Configgy, ParseException}
+import net.lag.configgy.{Config => CConfig, Configgy, ParseException}
class ConfigurationException(message: String) extends RuntimeException(message)
/**
+ * Loads up the configuration (from the akka.conf file).
+ *
* @author Jonas Bonér
*/
object Config extends Logging {
@@ -40,6 +42,7 @@ object Config extends Logging {
"Config could not be loaded from -Dakka.config=" + configFile +
"\n\tdue to: " + e.toString)
}
+ Configgy.config
} else if (getClass.getClassLoader.getResource("akka.conf") != null) {
try {
Configgy.configureFromResource("akka.conf", getClass.getClassLoader)
@@ -49,6 +52,7 @@ object Config extends Logging {
"Can't load 'akka.conf' config file from application classpath," +
"\n\tdue to: " + e.toString)
}
+ Configgy.config
} else if (HOME.isDefined) {
try {
val configFile = HOME.get + "/config/akka.conf"
@@ -60,23 +64,24 @@ object Config extends Logging {
"\n\tbut the 'akka.conf' config file can not be found at [" + HOME.get + "/config/akka.conf]," +
"\n\tdue to: " + e.toString)
}
+ Configgy.config
} else {
- throw new ConfigurationException(
+ log.warning(
"\nCan't load 'akka.conf'." +
"\nOne of the three ways of locating the 'akka.conf' file needs to be defined:" +
"\n\t1. Define the '-Dakka.config=...' system property option." +
"\n\t2. Put the 'akka.conf' file on the classpath." +
"\n\t3. Define 'AKKA_HOME' environment variable pointing to the root of the Akka distribution." +
"\nI have no way of finding the 'akka.conf' configuration file." +
- "\nAborting.")
+ "\nUsing default values everywhere.")
+ CConfig.fromString("")
}
- Configgy.config
}
- val CONFIG_VERSION = config.getString("akka.version", "0")
+ val CONFIG_VERSION = config.getString("akka.version", VERSION)
if (VERSION != CONFIG_VERSION) throw new ConfigurationException(
"Akka JAR version [" + VERSION + "] is different than the provided config ('akka.conf') version [" + CONFIG_VERSION + "]")
- val startTime = System.currentTimeMillis
+ val startTime = System.currentTimeMillis
def uptime = (System.currentTimeMillis - startTime) / 1000
}
diff --git a/akka-core/src/main/scala/remote/Cluster.scala b/akka-core/src/main/scala/remote/Cluster.scala
index e2634b5c5d..8a3e94af47 100644
--- a/akka-core/src/main/scala/remote/Cluster.scala
+++ b/akka-core/src/main/scala/remote/Cluster.scala
@@ -62,7 +62,7 @@ trait Cluster {
* @author Viktor Klang
*/
trait ClusterActor extends Actor with Cluster {
- val name = config.getString("akka.remote.cluster.name") getOrElse "default"
+ val name = config.getString("akka.remote.cluster.name", "default")
@volatile protected var serializer : Serializer = _
@@ -233,12 +233,13 @@ abstract class BasicClusterActor extends ClusterActor with Logging {
*/
object Cluster extends Cluster with Logging {
lazy val DEFAULT_SERIALIZER_CLASS_NAME = Serializer.Java.getClass.getName
+ lazy val DEFAULT_CLUSTER_ACTOR_CLASS_NAME = classOf[JGroupsClusterActor].getName
@volatile private[remote] var clusterActor: Option[ClusterActor] = None
@volatile private[remote] var clusterActorRef: Option[ActorRef] = None
private[remote] def createClusterActor(loader: ClassLoader): Option[ActorRef] = {
- val name = config.getString("akka.remote.cluster.actor")
+ val name = config.getString("akka.remote.cluster.actor", DEFAULT_CLUSTER_ACTOR_CLASS_NAME)
if (name.isEmpty) throw new IllegalArgumentException(
"Can't start cluster since the 'akka.remote.cluster.actor' configuration option is not defined")
@@ -246,19 +247,16 @@ object Cluster extends Cluster with Logging {
"akka.remote.cluster.serializer", DEFAULT_SERIALIZER_CLASS_NAME))
.newInstance.asInstanceOf[Serializer]
serializer.classLoader = Some(loader)
+
try {
- name map {
- fqn =>
- Actor.actorOf({
- val a = Class.forName(fqn).newInstance.asInstanceOf[ClusterActor]
- a setSerializer serializer
- a
- })
- }
- }
- catch {
+ Some(Actor.actorOf {
+ val a = Class.forName(name).newInstance.asInstanceOf[ClusterActor]
+ a setSerializer serializer
+ a
+ })
+ } catch {
case e =>
- log.error(e, "Couldn't load Cluster provider: [%s]", name.getOrElse("Not specified"))
+ log.error(e, "Couldn't load Cluster provider: [%s]", name)
None
}
}
diff --git a/akka-cluster/src/main/scala/JGroupsClusterActor.scala b/akka-core/src/main/scala/remote/JGroupsClusterActor.scala
similarity index 88%
rename from akka-cluster/src/main/scala/JGroupsClusterActor.scala
rename to akka-core/src/main/scala/remote/JGroupsClusterActor.scala
index 5fce79bfae..303ebefa08 100644
--- a/akka-cluster/src/main/scala/JGroupsClusterActor.scala
+++ b/akka-core/src/main/scala/remote/JGroupsClusterActor.scala
@@ -1,13 +1,12 @@
-package se.scalablesolutions.akka.cluster.jgroups
+package se.scalablesolutions.akka.remote
import org.jgroups.{JChannel, View => JG_VIEW, Address, Message => JG_MSG, ExtendedMembershipListener, Receiver}
import org.jgroups.util.Util
-import se.scalablesolutions.akka.remote.BasicClusterActor
-
/**
* Clustering support via JGroups.
- * @Author Viktor Klang
+ *
+ * @author Viktor Klang
*/
class JGroupsClusterActor extends BasicClusterActor {
import scala.collection.JavaConversions._
@@ -20,7 +19,7 @@ class JGroupsClusterActor extends BasicClusterActor {
override def init = {
super.init
- log debug "Initiating JGroups-based cluster actor"
+ log info "Initiating JGroups-based cluster actor"
isActive = true
// Set up the JGroups local endpoint
@@ -58,7 +57,7 @@ class JGroupsClusterActor extends BasicClusterActor {
override def shutdown = {
super.shutdown
- log debug ("Shutting down %s", toString)
+ log info ("Shutting down %s", toString)
isActive = false
channel.foreach(Util shutdown _)
channel = None
diff --git a/akka-http/src/main/scala/Security.scala b/akka-http/src/main/scala/Security.scala
index b5e993fd27..a03899f474 100644
--- a/akka-http/src/main/scala/Security.scala
+++ b/akka-http/src/main/scala/Security.scala
@@ -103,10 +103,12 @@ class AkkaSecurityFilterFactory extends ResourceFilterFactory with Logging {
}
}
- lazy val authenticatorFQN =
- Config.config.getString("akka.rest.authenticator")
- .getOrElse(throw new IllegalStateException("akka.rest.authenticator"))
-
+ lazy val authenticatorFQN = {
+ val auth = Config.config.getString("akka.rest.authenticator", "N/A")
+ if (auth == "N/A") throw new IllegalStateException("The config option 'akka.rest.authenticator' is not defined in 'akka.conf'")
+ auth
+ }
+
/**
* Currently we always take the first, since there usually should be at most one authentication actor, but a round-robin
* strategy could be implemented in the future
@@ -399,19 +401,31 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w
/**
* principal name for the HTTP kerberos service, i.e HTTP/ { server } @ { realm }
*/
- lazy val servicePrincipal = Config.config.getString("akka.rest.kerberos.servicePrincipal").getOrElse(throw new IllegalStateException("akka.rest.kerberos.servicePrincipal"))
+ lazy val servicePrincipal = {
+ val p = Config.config.getString("akka.rest.kerberos.servicePrincipal", "N/A")
+ if (p == "N/A") throw new IllegalStateException("The config option 'akka.rest.kerberos.servicePrincipal' is not defined in 'akka.conf'")
+ p
+ }
/**
* keytab location with credentials for the service principal
*/
- lazy val keyTabLocation = Config.config.getString("akka.rest.kerberos.keyTabLocation").getOrElse(throw new IllegalStateException("akka.rest.kerberos.keyTabLocation"))
+ lazy val keyTabLocation = {
+ val p = Config.config.getString("akka.rest.kerberos.keyTabLocation", "N/A")
+ if (p == "N/A") throw new IllegalStateException("The config option 'akka.rest.kerberos.keyTabLocation' is not defined in 'akka.conf'")
+ p
+ }
- lazy val kerberosDebug = Config.config.getString("akka.rest.kerberos.kerberosDebug").getOrElse("false")
+ lazy val kerberosDebug = {
+ val p = Config.config.getString("akka.rest.kerberos.kerberosDebug", "N/A")
+ if (p == "N/A") throw new IllegalStateException("The config option 'akka.rest.kerberos.kerberosDebug' is not defined in 'akka.conf'")
+ p
+ }
/**
* is not used by this authenticator, so accept an empty value
*/
- lazy val realm = Config.config.getString("akka.rest.kerberos.realm").getOrElse("")
+ lazy val realm = Config.config.getString("akka.rest.kerberos.realm", "")
/**
* verify the kerberos token from a client with the server
diff --git a/config/akka-reference.conf b/config/akka-reference.conf
index 8e0a4a04bc..5311712ec4 100644
--- a/config/akka-reference.conf
+++ b/config/akka-reference.conf
@@ -68,7 +68,7 @@
service = on
name = "default" # The name of the cluster
- actor = "se.scalablesolutions.akka.cluster.jgroups.JGroupsClusterActor" # FQN of an implementation of ClusterActor
+ actor = "se.scalablesolutions.akka.remote.JGroupsClusterActor" # FQN of an implementation of ClusterActor
serializer = "se.scalablesolutions.akka.serialization.Serializer$Java$" # FQN of the serializer class
diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala
index 5139e4f392..98d6631773 100644
--- a/project/build/AkkaProject.scala
+++ b/project/build/AkkaProject.scala
@@ -56,12 +56,10 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
lazy val akka_http = project("akka-http", "akka-http", new AkkaHttpProject(_), akka_core, akka_camel)
lazy val akka_camel = project("akka-camel", "akka-camel", new AkkaCamelProject(_), akka_core)
lazy val akka_persistence = project("akka-persistence", "akka-persistence", new AkkaPersistenceParentProject(_))
- lazy val akka_cluster = project("akka-cluster", "akka-cluster", new AkkaClusterProject(_), akka_core)
lazy val akka_spring = project("akka-spring", "akka-spring", new AkkaSpringProject(_), akka_core)
lazy val akka_jta = project("akka-jta", "akka-jta", new AkkaJTAProject(_), akka_core)
lazy val akka_kernel = project("akka-kernel", "akka-kernel", new AkkaKernelProject(_),
- akka_core, akka_http, akka_spring, akka_camel, akka_persistence,
- akka_cluster, akka_amqp)
+ akka_core, akka_http, akka_spring, akka_camel, akka_persistence, akka_amqp)
// functional tests in java
lazy val akka_fun_test = project("akka-fun-test-java", "akka-fun-test-java", new AkkaFunTestProject(_), akka_kernel)
@@ -85,11 +83,11 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
// create a manifest with all akka jars and dependency jars on classpath
override def manifestClassPath = Some(allArtifacts.getFiles
.filter(_.getName.endsWith(".jar"))
+ .filter(!_.getName.contains("scala-library"))
.map("lib_managed/scala_%s/compile/".format(buildScalaVersion) + _.getName)
.mkString(" ") +
" scala-library.jar" +
" dist/akka-core_%s-%s.jar".format(buildScalaVersion, version) +
- " dist/akka-cluster%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-http_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-camel_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-amqp_%s-%s.jar".format(buildScalaVersion, version) +
@@ -154,6 +152,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
val aopalliance = "aopalliance" % "aopalliance" % "1.0" % "compile"
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.2.0" % "compile"
val multiverse = "org.multiverse" % "multiverse-alpha" % "0.5" % "compile"
+ val jgroups = "jgroups" % "jgroups" % "2.8.0.CR7" % "compile"
// testing
val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test"
@@ -232,10 +231,6 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
new AkkaCassandraProject(_), akka_persistence_common)
}
- class AkkaClusterProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
- val jgroups = "jgroups" % "jgroups" % "2.8.0.CR7" % "compile"
- }
-
class AkkaKernelProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath)
class AkkaSpringProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {