playframework / play-samples

Play Framework Sample Projects
Creative Commons Zero v1.0 Universal
539 stars 543 forks source link

play-java-ebean-example is not working fails with BeanNotEnhancedException #786

Open probert100 opened 1 week ago

probert100 commented 1 week ago

The sample play-java-ebean-example has a runtime exception: [Guice/ErrorInjectingConstructor]: BeanNotEnhancedException: Bean class models.Company is not enhanced?

INFO  p.a.h.HttpErrorHandlerExceptions - Registering exception handler: guice-provision-exception-handler
INFO  p.a.d.DefaultDBApi - Database [default] initialized
INFO  p.a.d.HikariCPConnectionPool - Creating Pool for datasource 'default'
@87gkd436b: Execution exception[[CreationException: Unable to create injector, see the following errors:

1) [Guice/ErrorInjectingConstructor]: BeanNotEnhancedException: Bean class models.Company is not enhanced? Check packages specified in ebean.mf. If you are running in IDEA or Eclipse check that the enhancement plugin is installed. See https://ebean.io/docs/trouble-shooting#not-enhanced
  at EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:42)
  at EbeanDynamicEvolutions.class(EbeanDynamicEvolutions.java:35)
  while locating EbeanDynamicEvolutions
  at EbeanModule.bindings(EbeanModule.java:20):
Binding(class DynamicEvolutions to ConstructionTarget(class EbeanDynamicEvolutions) eagerly)
      \_ installed by: Modules$OverrideModule -> GuiceableModuleConversions$$anon$4
  while locating DynamicEvolutions
  while locating ApplicationEvolutionsProvider
  at EvolutionsModule.<init>(EvolutionsModule.scala:23):
Binding(class ApplicationEvolutions to ProviderConstructionTarget(class ApplicationEvolutionsProvider) eagerly)
      \_ installed by: Modules$OverrideModule -> GuiceableModuleConversions$$anon$4
  while locating ApplicationEvolutions

Learn more:
  https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR
Caused by: BeanNotEnhancedException: Bean class models.Company is not enhanced? Check packages specified in ebean.mf. If you are running in IDEA or Eclipse check that the enhancement plugin is installed. See https://ebean.io/docs/trouble-shooting#not-enhanced
    at BeanDescriptorManager.confirmEnhanced(BeanDescriptorManager.java:1234)
    at BeanDescriptorManager.setAccessors(BeanDescriptorManager.java:1120)
    at BeanDescriptorManager.readDeployAssociations(BeanDescriptorManager.java:1049)
    at BeanDescriptorManager.readEntityDeploymentAssociations(BeanDescriptorManager.java:613)
    at BeanDescriptorManager.deploy(BeanDescriptorManager.java:275)
    at InternalConfiguration.<init>(InternalConfiguration.java:111)
    at DefaultContainer.createServer(DefaultContainer.java:114)
    at DefaultContainer.createServer(DefaultContainer.java:33)
    at DatabaseFactory.createInternal(DatabaseFactory.java:135)
    at DatabaseFactory.create(DatabaseFactory.java:84)
    at EbeanDynamicEvolutions.lambda$start$2(EbeanDynamicEvolutions.java:58)
    at java.base/HashMap.forEach(HashMap.java:1430)
    at EbeanDynamicEvolutions.start(EbeanDynamicEvolutions.java:58)
    at EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:46)
    at EbeanDynamicEvolutions$$FastClassByGuice$$3dd7f92.GUICE$TRAMPOLINE(<generated>)
    at EbeanDynamicEvolutions$$FastClassByGuice$$3dd7f92.apply(<generated>)
    at DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82)
    at ConstructorInjector.provision(ConstructorInjector.java:114)
    at ConstructorInjector.construct(ConstructorInjector.java:91)
    at ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at SingletonScope$1.get(SingletonScope.java:169)
    at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
    at FactoryProxy.get(FactoryProxy.java:60)
    at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at SingletonScope$1.get(SingletonScope.java:169)
    at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
    at InjectorImpl$1.get(InjectorImpl.java:1148)
    at InjectorImpl.getInstance(InjectorImpl.java:1186)
    at GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:434)
    at GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:429)
    at ContextClassLoaderInjector.$anonfun$instanceOf$2(Injector.scala:118)
probert100 commented 1 week ago

Looks like this is related to Java version. This works when used with Java 17.0.11

mkurz commented 1 week ago

I can not reproduce this. Which branch did you use? https://github.com/playframework/play-samples/tree/3.0.x/ ?