Hi,

Removing akka.Main from your last command should help:
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -classpath ".:$JARS"
docs.http.javadsl.server.HighLevelServerExample

akka.Main is only required to start your application when all you have is a
top-level actor. In this case HighLevelServerExample.java
<https://github.com/akka/akka/blob/master/akka-docs/rst/java/code/docs/http/javadsl/server/HighLevelServerExample.java>
 is a main class itself — it has a public static void main() that creates
ActorSystem, setups a flow and waits for input on the stdin before shutdown.

On 11 September 2016 at 13:21, <[email protected]> wrote:

> Hi,
>
> I'm trying to build a rest server with akka-http, but I'm having trouble
> getting anything to run. I'm still trying to get the tutorials to run, but
> I'm stuck. What am I missing? Any help would be appreciated. Here's what I
> tried:
>
> Clone the akka repository:
> cd ~/workspace
> git clone https://github.com/akka/akka.git
>
> Find the example servers:
> cd ~/workspace/akka/akka-docs/rst/java/code/docs/http/javadsl/server
>
> Use jar-files that maven has downloaded previously, and make a classpath
> string from them:
> JARS=".:$(find ~/.m2/repository/{com/typesafe/,org/scala-lang/} -name
> \*.jar|tr '\n' ':'|sed 's/:$//')"
> echo $JARS|sed "s#$HOME#~#g"
>
> These results in:
> .:~/.m2/repository/com/typesafe/akka/akka-actor_2.11/
> 2.4.9/akka-actor_2.11-2.4.9.jar:~/.m2/repository/com/
> typesafe/akka/akka-parsing_2.11/2.4.9/akka-parsing_2.11-2.
> 4.9.jar:~/.m2/repository/com/typesafe/akka/akka-http-core_
> 2.11/2.4.9/akka-http-core_2.11-2.4.9.jar:~/.m2/repository/
> com/typesafe/akka/akka-stream_2.11/2.4.9/akka-stream_2.11-2.
> 4.9.jar:~/.m2/repository/com/typesafe/akka/akka-http-
> experimental_2.11/2.4.9/akka-http-experimental_2.11-2.4.9.
> jar:~/.m2/repository/com/typesafe/ssl-config-core_2.11/
> 0.2.1/ssl-config-core_2.11-0.2.1.jar:~/.m2/repository/com/
> typesafe/ssl-config-akka_2.11/0.2.1/ssl-config-akka_2.11-0.
> 2.1.jar:~/.m2/repository/com/typesafe/config/1.3.0/config-
> 1.3.0.jar:~/.m2/repository/org/scala-lang/modules/scala-
> java8-compat_2.11/0.7.0/scala-java8-compat_2.11-0.7.0.jar:~/
> .m2/repository/org/scala-lang/modules/scala-parser-
> combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.
> jar:~/.m2/repository/org/scala-lang/scala-library/2.11.
> 8/scala-library-2.11.8.jar
>
> Compile the HighLevelServerExample:
> /usr/lib/jvm/java-8-openjdk-amd64/bin/javac -classpath ".:$JARS"
> HighLevelServerExample.java
>
> Execute it from the right directory:
> cd ~/workspace/akka/akka-docs/rst/java/code/
> /usr/lib/jvm/java-8-openjdk-amd64/bin/java -classpath ".:$JARS" akka.Main
> docs.http.javadsl.server.HighLevelServerExample
>
> Which gives me:
> Exception in thread "main" java.lang.ClassCastException: interface
> akka.actor.Actor is not assignable from class docs.http.javadsl.server.
> HighLevelServerExample
>     at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(
> ReflectiveDynamicAccess.scala:23)
>     at akka.actor.ReflectiveDynamicAccess$$anonfun$getClassFor$1.apply(
> ReflectiveDynamicAccess.scala:20)
>     at scala.util.Try$.apply(Try.scala:192)
>     at akka.actor.ReflectiveDynamicAccess.getClassFor(
> ReflectiveDynamicAccess.scala:20)
>     at akka.Main$.main(Main.scala:32)
>     at akka.Main.main(Main.scala)
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to