Com.google.inject.guice

Code compiles fine. But I get errors at runtime. Anybody know what the reason is ?

Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/home/ubuntu/mobile-1.0/lib/com.google.inject.guice-4.2.3.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

WARNING: All illegal access operations will be denied in a future release

Oops, cannot start the server.

com.google.inject.CreationException: Unable to create injector, see the following errors:

  1. No implementation for com.nearbuylife.service.AdvertisementService was bound.
    while locating com.nearbuylife.service.AdvertisementService
    for the 4th parameter of controllers.AdvertisementCtrl.(AdvertisementCtrl.scala:38)
    while locating controllers.AdvertisementCtrl
    for the 10th parameter of router.Routes.(Routes.scala:89)
    at play.api.inject.RoutesProvider$.bindingsFromConfiguration(BuiltinModule.scala:139):
    Binding(class router.Routes to self) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$4)

https://www.playframework.com/documentation/2.8.x/ScalaDependencyInjection describes how dependency injection works in Play. Have you tried adding a module that binds an implementation of the AdvertisementService class/trait?