Petteri H
Petteri H

Reputation: 12242

Play 2.0.4 Java with Guice plugin - Error at application startup

We have guice set up as in the documentation and it seems to work fine but we get following error in the application log:

[warn] application - maybe inject.modules config parameter is not set propery? java.lang.ClassNotFoundException: module.Dependencies at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at com.typesafe.plugin.inject.InjectPlugin.createModules(InjectPlugin.java:88) at com.typesafe.plugin.inject.InjectPlugin.availableModules(InjectPlugin.java:29) at com.typesafe.plugin.inject.GuicePlugin.onStart(GuicePlugin.java:33) at play.api.Play$$anonfun$start$1.apply(Play.scala:60) at play.api.Play$$anonfun$start$1.apply(Play.scala:60) at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) at scala.collection.immutable.List.foreach(List.scala:45) at play.api.Play$.start(Play.scala:60) ...

Is that something to ignore? The inject.modules seems to be default value if nothing has been specified in application.conf for inject.modules.

Upvotes: 0

Views: 307

Answers (1)

ndeverge
ndeverge

Reputation: 21564

You have to provide a class called module.Dependencies to make the bindings, for instance:

package module;

import com.google.inject.*;
import service.*;

public class Dependencies implements Module {

 public void configure(Binder binder) {
     binder.bind(Service.class).to(SomethingService.class);
  }  
}

Take a look here.

Upvotes: 1

Related Questions