# Cannot migrate to Akka typed if there are multi-jvm/multi-node tests in project

**URL:** <https://discuss.akka.io/t/cannot-migrate-to-akka-typed-if-there-are-multi-jvm-multi-node-tests-in-project/4013>\
**Category:** Actors\
**Tags:** akka, akka-typed\
**Created:** [April 18, 2019, 10:58am UTC](https://discuss.akka.io/t/cannot-migrate-to-akka-typed-if-there-are-multi-jvm-multi-node-tests-in-project/4013 "2019-04-18T10:58:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skvithalani](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/skvithalani/32/423_2.png) [@skvithalani](https://discuss.akka.io/u/skvithalani)\
**Post date:** [April 18, 2019, 10:58am UTC](https://discuss.akka.io/t/cannot-migrate-to-akka-typed-if-there-are-multi-jvm-multi-node-tests-in-project/4013/1 "2019-04-18T10:58:07Z")

</div>

We are using akka 2.5.22 and we have been in process of migrating our project to typed for more than a week now. We replaced all our untyped actors to typed and now we are trying to replace our top level untyped actor system to typed.

We got stuck in replacing our actor system to typed because we have multi-jvm/multi-node tests in our project.

We extend `MultiNodeSpec` for our multi-jvm test and it happens to take untyped actor system to create actors internally via `untypedSystem.actorOf`. And we want to keep our top level actor system to be typed. So, When we create a typed system, adapt it to untyped and pass it to `MultiNodeSpec` then, the test fails with the following exception:

```auto
[error] Exception in thread "main" java.lang.UnsupportedOperationException: cannot create top-level actor from the outside on ActorSystem with custom user guardian
[error] at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:786)
[error] at App1$.delayedEndpoint$App1$1(App1.scala:12)
[error] at App1$delayedInit$body.apply(App1.scala:6)
[error] at scala.Function0.apply$mcV$sp(Function0.scala:39)
[error] at scala.Function0.apply$mcV$sp$(Function0.scala:39)
[error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
[error] at scala.App.$anonfun$main$1$adapted(App.scala:80)
[error] at scala.collection.immutable.List.foreach(List.scala:392)
[error] at scala.App.main(App.scala:80)
[error] at scala.App.main$(App.scala:78)
[error] at App1$.main(App1.scala:6)
[error] at App1.main(App1.scala)

```

So, while tracing back the exception, we got to know that `untypedSystem.actorOf` checks if a custom guardian is wired or not, if it is then it throws the above mentioned exception and in case of untypedSystem being created from typed system will always have a guardian actor (in our case guardian actor is an actor with empty behavior).

For more details about this error please refer this [discussion](https://discuss.akka.io/t/migrating-project-to-typed-actor-system/3971).

So, we feel that we are left with following options:

- Abandon the task of migrating project to fully typed project

- `ActorSystemImpl` does not throw the above mentioned error if typed system is adapted to untyped and used to create user space actor via `untypedSystem.actorOf`

- `MultiNodeSpec` creates internal actors via `untypedSystem.systemActorOf` instead of `untypedSystem.actorOf` as `systemActorOf` does not throw above exception when untypedSystem is adapted from typedSystem

- `akka-multi-node-testkit` gets migrated to typed and `MultiNodeSpec` expects typed system instead of untyped system

So, to conclude, our question is how should we proceed for our task of migrating our project to fully typed project?

---

<div class="post-metadata">

**Author:** ![patriknw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/patriknw/32/89_2.png) [@patriknw](https://discuss.akka.io/u/patriknw)\
**Post date:** [April 18, 2019, 1:43pm UTC](https://discuss.akka.io/t/cannot-migrate-to-akka-typed-if-there-are-multi-jvm-multi-node-tests-in-project/4013/2 "2019-04-18T13:43:43Z")

</div>

We can probably change MultiNodeSpec to use systemActorOf. Please create issue or PR. Thanks for reporting.

---

<div class="post-metadata">

**Author:** ![skvithalani](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/skvithalani/32/423_2.png) [@skvithalani](https://discuss.akka.io/u/skvithalani)\
**Post date:** [April 19, 2019, 1:49am UTC](https://discuss.akka.io/t/cannot-migrate-to-akka-typed-if-there-are-multi-jvm-multi-node-tests-in-project/4013/3 "2019-04-19T01:49:32Z")

</div>

Sure, I will create a PR
