Comments (8)
If you must stay on JDK 8 the last version of Akka supporting it is 2.8.5, you could try building the quickstart with that.
from akka.
If you must stay on JDK 8 the last version of Akka supporting it is 2.8.5, you could try building the quickstart with that.
Hi Johanadren, thank you for your reply. Actually I am using Akka 2.8.5. Here is my pom file. Is there anyproblem with it?
4.0.0<groupId>hello-akka-java</groupId>
<artifactId>app</artifactId>
<version>1.0</version>
<properties>
<akka.version>2.8.5</akka.version>
</properties>
<repositories>
<repository>
<id>akka-repository</id>
<name>Akka library repository</name>
<url>https://repo.akka.io/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor-typed_2.13</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor-testkit-typed_2.13</artifactId>
<version>${akka.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
<argument>$package$.AkkaQuickstart</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
from akka.
If you must stay on JDK 8 the last version of Akka supporting it is 2.8.5, you could try building the quickstart with that.
And my java version is 1.8 and maven version is 3.8.3. Should the version of maven be same as the version of maven compiler plugin?
from akka.
Ah, I see now what is wrong, you have probably cloned the entire java quickstart repository, but that is structured for project creation through the sbt (the build tool most common for Scala) templating functionality, not to be cloned and run directly.
Generally such project creation is done via sbt new akka/akka-quickstart-scala.g8
, which will give you some prompts to specify project name, package name, Akka version etc.
If you do not want to install sbt to do that you can instead download a zip file of the project template from this page: https://developer.lightbend.com/guides/akka-quickstart-java/ and it should work as expected.
from akka.
Ah, I see now what is wrong, you have probably cloned the entire java quickstart repository, but that is structured for project creation through the sbt (the build tool most common for Scala) templating functionality, not to be cloned and run directly.
Generally such project creation is done via
sbt new akka/akka-quickstart-scala.g8
, which will give you some prompts to specify project name, package name, Akka version etc.If you do not want to install sbt to do that you can instead download a zip file of the project template from this page: https://developer.lightbend.com/guides/akka-quickstart-java/ and it should work as expected.
Hi Johanandren,
Thank you for the information. Scala is an interesting and new language for me. But it seems not to be the reason of problem.
I finally found the bug is cuased by java version incompatibility. The code below (which is a record class, only supported by java 14 version and afterwards), is not supported by java 8.
public static record Greet(String whom, ActorRef<Greeted> replyTo) {}
public static record Greeted(String whom, ActorRef<Greet> from) {}
So I change these code into typical class, and it works. Cheers!
public static final class Greet{
private final String whom;
private final ActorRef<Greeted> replyTo;
public Greet(String whom, ActorRef<Greeted> replyTo){
this.whom = whom;
this.replyTo = replyTo;
}
public String whom(){
return this.whom;
}
public ActorRef<Greeted> replyTo(){
return this.replyTo;
}
public String toString(){
return String.format("Point[x=%s, y=%s]", this.whom, this.replyTo);
}
public boolean equals(Object o){
return true;
}
public int hashCode(){
return 110;
}
}
public static final class Greeted{
private final String whom;
private final ActorRef<Greet> from;
public Greeted(String whom, ActorRef<Greet> from){
this.whom = whom;
this.from = from;
}
public String whom(){
return this.whom;
}
public ActorRef<Greet> from(){
return this.from;
}
public String toString(){
return String.format("Point[x=%s, y=%s]", this.whom, this.from);
}
public boolean equals(Object o){
return false;
}
public int hashCode(){
return 120;
}
}
from akka.
Ah, sorry, didn't remember that, yes, we switched to showcasing newer JDK features a while ago, if you start from commit akka/akka-quickstart-java.g8@269d369 I think that should still work with JDK 8 (alternatively rewrite those records to regular Java classes like you did)
from akka.
Ah, sorry, didn't remember that, yes, we switched to showcasing newer JDK features a while ago, if you start from commit akka/akka-quickstart-java.g8@269d369 I think that should still work with JDK 8 (alternatively rewrite those records to regular Java classes like you did)
Yeah, thanks. And I also create a new repo for java8 version, for new beginners like me. Here is the link https://github.com/shaoshuaidu/akka-quickstart-java8.
from akka.
Thanks for sharing, I'll close this issue now.
from akka.
Related Issues (20)
- Support PKCS8 and ECDSA HOT 3
- failed: EventSourcedBehaviorRetentionSpec HOT 5
- Issue with rending DurableState docs on how to write custom plugin
- Document how to test DurableState using testkit
- EventSourcedBehavior.lastSequenceNumber incorrect values after recovery HOT 1
- Update to slf4j 2.0 HOT 2
- Scaladoc description of Source.cycle is confusing and should be clarified HOT 1
- NotInfluenceReceiveTimeout does not work consistently with typed responses
- How can I resolve the CORS issue? HOT 1
- Is it great that akka can be used as a public chain?
- Specifying ClusterSingletonManagerSettings programatically in typed not possible HOT 5
- Source.fromJavaStream can use SplitIterator directly HOT 2
- find a bug when using scheduler() HOT 2
- Failed: ReplicatedMetricsSpec
- failed: MetricsBasedResizerSpec HOT 1
- Release 2.9.2 HOT 1
- Release 2.9.3 HOT 1
- Allow initial timer delay to be 0 HOT 3
- akka.pattern.retry tries one too many times HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from akka.