Hi Guys
I think this issue is similar to what I am seeing. Could you please shed 
some light into how I can create my own AkkaSystem on Play instead of 
Play's.

I am trying to get my Play Controller to communicate with my backend Akka 
cluster. the html get request is routed to the following method in my 
Controller:

    public CompletionStage<Result> createSession(int connectionId){
        return FutureConverters.toJava(ask(shardRegion, new 
CreateSessionMessage(connectionId), 2000))
                .thenApply(response -> ok((String) response));
    }

where

@Inject
    public ConnectionController(ActorSystem system) {
//other things
shardRegion = 
system.actorSelection("akka.tcp://[email protected]:2551/user/connection"); 
}

My Akka cluster is running and I can see that the three nodes are gossiping 
with each other constantly.

The problem is I get the following error when createSession is 
called:*play.api.http.HttpErrorHandlerExceptions$$anon$1: 
Execution exception[[CompletionException: akka.pattern.AskTimeoutException: 
Ask timed out on [ActorSelection[Anchor(akka://application/deadLetters), 
Path(/user/connection)]] after [2000 ms]. Message of type 
[com.vegaspin.actors.connection.ConnectionActorMessage$CreateSessionMessage]. 
A typical reason for AskTimeoutException is that the recipient actor didn't 
send a reply.]]*

My Akka cluster is called "sharding". I am not sure why in the error 
message it says akka://application/deadLetters

And here is the code for creating the "connection" cluster sharding

    private static ActorRef setupConnectionClusterSharding(ActorSystem 
actorSystem) {
        ClusterShardingSettings settings = 
ClusterShardingSettings.create(actorSystem);
        return ClusterSharding.get(actorSystem).start(
                "connection",
                SpringExtProvider.get(actorSystem).props("ConnectionActor"),
                settings,
                ConnectionActorMessage.messageExtractor()
        );
    }





On Thursday, February 19, 2015 at 11:45:43 AM UTC+1, Ryan Tanner wrote:
>
> Indeed.  One thing that is especially tricky is how the lifecycle of your 
> own actor system integrates with the tests.  If you don't clean up properly 
> you can wind up inadvertently reusing actors across test suites which can 
> get quite confusing if they're at all stateful.
>
> On Thursday, February 19, 2015 at 5:36:24 PM UTC+7, Patrik Nordwall wrote:
>>
>>
>>
>> On Wed, Feb 18, 2015 at 1:20 PM, Roland Kuhn <[email protected]> wrote:
>>
>>> Hi Ashesh,
>>>
>>> I take that this is the same as the StackOverflow question you opened 
>>> around the same time. As a quick recap: your issue is that your ActorSystem 
>>> on the Play side is configured without remoting because otherwise you get 
>>> bind errors, which is indicative of you creating multiple ActorSystems, 
>>> possibly inadvertently. In order to get help in these free forums it would 
>>> be nice to acknowledge that the problem does indeed not lie with the free 
>>> products you are using.
>>>
>>> Otherwise I agree with Ryan in that Play’s default ActorSystem (as 
>>> exposed by the “Akka” object) is best avoided for the purpose of remoting. 
>>> Simply create your own ActorSystem using 
>>> ConfigFactory.loadConfig().getConfig("my-sub-config") and supplying the 
>>> configuration for your actor system in that config scope.
>>>
>>
>> One thing to be careful with though. When you create your own actor 
>> system in play you must also manage its life cycle to avoid resource leaks 
>> in development mode, i.e. you must shutdown the actor system when play is 
>> reloading.
>> That is probably the reason why Ryan recommended a plugin.
>>
>> Regards,
>> Patrik
>>  
>>
>>>
>>> Regards,
>>>
>>> Roland
>>>
>>> 17 feb 2015 kl. 14:46 skrev Ashesh Ambasta <[email protected]>:
>>>
>>> Same issue with Play 2.3.6 and Akka 2.3.6, spent a day trying all kinds 
>>> of workarounds and nothing worked.
>>>
>>> Proof that technologies like these will take time to become reliable for 
>>> companies. A day lost looking for hopeless solutions to problems like these 
>>> is too much for young startups, and this is what makes people like us avoid 
>>> all of this. Truly disappointed.
>>>
>>> On Monday, 28 April 2014 09:41:07 UTC+2, Raymond Tay wrote:
>>>>
>>>> Hi Akka users,
>>>>
>>>> I've got a situation that's perplexing. It began with Akka 2.3.2 and i 
>>>> have a Play 2.3-M1 attempting to connect to a Akka 2.3.2 actor (part of a 
>>>> cluster named TrailingHammer) and it's not able to do so by throwing an 
>>>> error message like the following:
>>>>
>>>> play.api.Application$$anon$1: Execution exception[[MatchError: 
>>>> Some(Failure(akka.actor.ActorNotFound: Actor not found for: 
>>>> ActorSelection[Anchor(akka://application/deadLetters), 
>>>> Path(/user/ShadowFrontend)])) (of class scala.Some)]]
>>>> at play.api.Application$class.handleError(Application.scala:297) 
>>>> ~[play_2.10-2.3-M1.jar:2.3-M1]
>>>> at play.api.DefaultApplication.handleError(Application.scala:403) 
>>>> [play_2.10-2.3-M1.jar:2.3-M1]
>>>> at play.core.server.netty.PlayDefaultUpstreamHandler$$
>>>> anonfun$2$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:318)
>>>>  
>>>> [play_2.10-2.3-M1.jar:2.3-M1]
>>>> at play.core.server.netty.PlayDefaultUpstreamHandler$$
>>>> anonfun$2$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:318)
>>>>  
>>>> [play_2.10-2.3-M1.jar:2.3-M1]
>>>> at scala.Option.map(Option.scala:145) [scala-library.jar:na]
>>>> Caused by: scala.MatchError: Some(Failure(akka.actor.ActorNotFound: 
>>>> Actor not found for: 
>>>> ActorSelection[Anchor(akka://application/deadLetters), 
>>>> Path(/user/ShadowFrontend)])) (of class scala.Some)
>>>>
>>>> The code in the Play controller looks like this:
>>>>
>>>> lazy val config = ConfigFactory.load("TrailingHammer")
>>>>
>>>> lazy val notificationHost = config.getString("bamboo.
>>>> persistence.cluster.hostname")
>>>> lazy val notificationPort = config.getInt("bamboo.
>>>> persistence.cluster.port")
>>>> lazy val notificationServiceName = config.getString("bamboo.
>>>> persistence.cluster.name")
>>>> implicit lazy val timeOut = Timeout(config.getInt("bamboo.
>>>> persistence.cluster.query.timeout") seconds) 
>>>>
>>>> val backend = Akka.system.actorSelection(RootActorPath(backendAddress) 
>>>> / "user" / "ShadowFrontend")
>>>>
>>>>  
>>>>
>>>> This code is pretty idiomatic and i've used this successfully in Akka 
>>>> [2.2.3] and wasn't too sure what's going on but the message on 
>>>> *Path(/user/ShadowFrontend)* seems not to be catching the entire path 
>>>> which should read like "akka.tcp://[email protected]:2553/user/
>>>> ShadowFrontend" and when i plugged this string directly into the code 
>>>> and restarted all my services, it gave me the following error message 
>>>> repeatedly indicating that somehow the default actor for handling these 
>>>> faults have died as well. :
>>>>
>>>> [INFO] [04/28/2014 15:36:58.380] 
>>>> [application-akka.actor.default-dispatcher-3] 
>>>> [akka://application/deadLetters] Message [java.lang.String] from Actor[
>>>> akka://application/deadLetters] to Actor[akka://application/deadLetters] 
>>>> was not delivered. [1] dead letters encountered. This logging can be 
>>>> turned 
>>>> off or adjusted with configuration settings 'akka.log-dead-letters' and 
>>>> 'akka.log-dead-letters-during-shutdown'.
>>>> [error] play - Cannot invoke the action, eventually got an error: 
>>>> akka.pattern.AskTimeoutException: 
>>>> Recipient[Actor[akka://application/deadLetters]] 
>>>> had already been terminated.
>>>> [error] application -
>>>>
>>>> ! @6i3hf3e84 - Internal server error, for (POST) [/audit] ->
>>>>
>>>> play.api.Application$$anon$1: Execution exception[[AskTimeoutException: 
>>>> Recipient[Actor[akka://application/deadLetters]] had already been 
>>>> terminated.]]
>>>> at play.api.Application$class.handleError(Application.scala:297) 
>>>> ~[play_2.10-2.3-M1.jar:2.3-M1]
>>>> at play.api.DefaultApplication.handleError(Application.scala:403) 
>>>> [play_2.10-2.3-M1.jar:2.3-M1]
>>>> at play.core.server.netty.PlayDefaultUpstreamHandler$$
>>>> anonfun$2$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:318)
>>>>  
>>>> [play_2.10-2.3-M1.jar:2.3-M1]
>>>> at play.core.server.netty.PlayDefaultUpstreamHandler$$
>>>> anonfun$2$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:318)
>>>>  
>>>> [play_2.10-2.3-M1.jar:2.3-M1]
>>>> at scala.Option.map(Option.scala:145) [scala-library.jar:na]
>>>> Caused by: akka.pattern.AskTimeoutException: 
>>>> Recipient[Actor[akka://application/deadLetters]] 
>>>> had already been terminated.
>>>> at akka.pattern.AskableActorRef$.ask$extension(AskSupport.scala:132) 
>>>> ~[akka-actor_2.10-2.3.2.jar:na]
>>>> at akka.pattern.AskableActorRef$.$qmark$extension(AskSupport.scala:144) 
>>>> ~[akka-actor_2.10-2.3.2.jar:na]
>>>>
>>>>
>>>>
>>>> Any ideas guys ? 
>>>>
>>>> Thanks in advance!
>>>> Raymond
>>>>
>>>
>>> -- 
>>> >>>>>>>>>> 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 http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>>
>>> *Dr. Roland Kuhn*
>>> *Akka Tech Lead*
>>> Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
>>> twitter: @rolandkuhn
>>> <http://twitter.com/#!/rolandkuhn>
>>>
>>> -- 
>>> >>>>>>>>>> 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 http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>>
>> Patrik Nordwall
>> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
>> Twitter: @patriknw
>>
>> [image: Scala Days] <http://event.scaladays.org/scaladays-sanfran-2015>
>>
>>

-- 
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user 
google-group soon.
** This group will soon be put into read-only mode, and replaced by 
discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
>>>>>>>>>> 
>>>>>>>>>>      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