These are chat archives for adamw/macwire

Oct 2017
Christian Kaps
Oct 09 2017 09:25

I currently try to wire an actor with an implicit parameter. The project compiles but I get an IllegalArgumentException at runtime.

The constructor looks as follow:

class Connector(brokerService: BrokerService)(
  ec: ExecutionContext
) extends Actor with LazyLogging

The error is the follow:

java.lang.IllegalArgumentException: no matching constructor found on class app.actors.Connector for arguments [class]

If I remove the implicit parameter, all works as expected.

Adam Warski
Oct 09 2017 10:35
@akkie can you post your Props?
Christian Kaps
Oct 09 2017 11:27
@adamw I instantiate the actor with val connector: ActorRef = wireActor[Connector]("connector") The BrokerService is injected in the class which instantiates the connector actor.
Adam Warski
Oct 09 2017 15:14
ah, this unwraps to Props(classOf[Connector], brokerService) which is the non-typesafe way of creating new instances of actors
and is (or at least was) recommended some time ago as "the" way to do things
if we would instead unwrap to Props(new Connector(brokerService)) things would work fine
@akkie can you file a bug?
I'll see if this is fixable easily :)
or of course if you would like to try fixing yourself, that would be even better :)