我正在学习akka-remoting,这是我的项目看起来
项目结构如下所示
project/pom.xml
project/mymodule/pom.xml
project/mymodule/src/main/resources/application.conf
project/mymodule/src/main/scala/com.harit.akkaio.remote.RemoteApp.scala
project/mymodule/src/main/scala/com.harit.akkaio.remote.ProcessingActor.scala
当我在命令行
上运行我的项目时,我看到
$ java -jar akkaio-remote/target/akka-remote-jar-with-dependencies.jar com.harit.akkaio.remote.RemoteApp
Hello:com.harit.akkaio.remote.RemoteApp
Exception in thread "main" com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka.version'
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:124)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:145)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:151)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:159)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:164)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:206)
at akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:169)
at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:505)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:142)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:119)
at com.harit.akkaio.remote.RemoteApp$.startProcessingActorSystem(RemoteApp.scala:16)
at com.harit.akkaio.remote.RemoteApp$.main(RemoteApp.scala:12)
at com.harit.akkaio.remote.RemoteApp.main(RemoteApp.scala)
package com.harit.akkaio.remote
import akka.actor.{ActorRef, ActorSystem, Props}
import com.typesafe.config.ConfigFactory
import scala.concurrent.duration._
object RemoteApp {
def main(args: Array[String]): Unit = {
println("Hello:" + args.head)
startProcessingActorSystem()
}
def startProcessingActorSystem() = {
val system = ActorSystem("ProcessingSystem", ConfigFactory.load())
println("ProcessingActorSystem Started")
}
}
package com.harit.akkaio.remote
import akka.actor.{Actor, ActorLogging}
case object Process
case object Crash
class ProcessingActor extends Actor with ActorLogging {
def receive = {
case Process => log.info("processing big things")
case Crash => log.info("crashing the system")
context.stop(self)
}
}
akka {
remote.netty.tcp.port = 2552
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>akkaio</artifactId>
<groupId>com.harit</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>akkaio-remote</artifactId>
<properties>
<akka-remote_2.11.version>2.3.11</akka-remote_2.11.version>
</properties>
<dependencies>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-remote_2.11</artifactId>
<version>${akka-remote_2.11.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>akka-remote</finalName>
<archive>
<manifest>
<mainClass>com.harit.akkaio.remote.RemoteApp</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.harit</groupId>
<artifactId>akkaio</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>akkaio-remote</module>
</modules>
<packaging>pom</packaging>
<inceptionYear>2015</inceptionYear>
<properties>
<scala.version>2.11.6</scala.version>
<junit.version>4.12</junit.version>
<scalatest_2.11.version>2.2.5</scalatest_2.11.version>
<akka-actor_2.11.version>2.3.11</akka-actor_2.11.version>
<akka-slf4j_2.11.version>2.3.11</akka-slf4j_2.11.version>
<akka-testkit_2.11.version>2.3.11</akka-testkit_2.11.version>
<mockito-all.version>1.10.19</mockito-all.version>
<maven-scala-plugin.scalaCompatVersion>2.11.6</maven-scala-plugin.scalaCompatVersion>
<scalatest-maven-plugin.version>1.0</scalatest-maven-plugin.version>
</properties>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.11</artifactId>
<version>${akka-actor_2.11.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-slf4j_2.11</artifactId>
<version>${akka-slf4j_2.11.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>${scalatest-maven-plugin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-testkit_2.11</artifactId>
<version>${akka-testkit_2.11.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>${scalatest_2.11.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean install</defaultGoal>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaCompatVersion>${maven-scala-plugin.scalaCompatVersion}</scalaCompatVersion>
<scalaVersion>${scala.version}</scalaVersion>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-target:jvm-1.8</arg>
</args>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
我错过了什么?谢谢
您的问题似乎绑定到jar-with-dependencies
,这会导致Akka出现问题,如文档中所述:
警告
Akka的配置方法在很大程度上依赖于每个模块/JAR都有自己的reference.conf文件的概念,所有这些都将被配置发现并加载。不幸的是,这也意味着如果您将多个jar放入/合并到同一个jar中,您还需要合并所有的reference.confs。否则,所有的默认值都将丢失,Akka将无法运行。
我已经将其隔离到一个非常简单的测试项目中,该项目除了简单的log4j2test配置使用之外没有其他用途。文件目录结构: 建筑sbt: log4j2.xml内容复制/粘贴从示例在官方留档:https://logging.apache.org/log4j/2.x/manual/configuration.html SimpleMain。斯卡拉: 我跑步与 输出:
在试图用PHPUnit设置Eclipse作为单元测试库时,我陷入了试图运行一个简单测试用例的困境。作为参考,我按照本教程使用PHPUnit/Xdebug/Makegood来设置Eclipse,唯一偏离给出的指导方针是为PHPUnit/Makegood设置以下配置文件: 现在,问题的根源在于,我似乎无法使用Makegood从Eclipse运行PHPUnit测试。我编写的唯一测试(位于名为test.p
问题内容: 在控制台上运行演示JSF应用程序时出现以下错误 问题答案: 这不是错误。这是一个警告。差异非常大。该特定警告基本上意味着中的元素包含未知属性,并且Tomcat不知道如何处理该属性,因此将忽略它。 Eclipse WTP将自定义属性添加source到Tomcat中与项目相关的元素,该属性标识上下文的源(工作空间中的实际项目,该项目已部署到特定服务器)。这样,Eclipse可以将部署的
我有这个型号 而我有这个方法 但是hibernate没有设置实际地址id和注册地址id(它是OneTONE) Hibernate:插入客户(名字、姓氏、中间名、性别)值(?、、?、?)2021-03-18 14:01:58.340警告12836---[nio-8080-exec-1]o.h.发动机。jdbc。spi。SqlExceptionHelper:SQL错误:0,SQLState:23502
我正在尝试修复glassfish警告:上下文路径与bundle不同,但至少通过IDE无法创建glassfish-web.xml文件: 找不到此项目的部署配置。无法正确设置部署描述符版本。