Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"docStore has type OBJECT rather than LIST" error when Elastic configuration is in application.conf #104

Open
cpoissonnier opened this issue Nov 9, 2016 · 32 comments

Comments

@cpoissonnier
Copy link

Hi,

When I add these lines to application.conf :

ebean.docstore.url="http://127.0.0.1:9200"
ebean.docstore.active=true
ebean.docstore.generateMapping=false
ebean.docstore.dropCreate=false
ebean.docstore.create=false

I have the following error :
play/conf/application.conf: 26: docStore has type OBJECT rather than LIST

@cpoissonnier cpoissonnier changed the title "docStore has type OBJECT rather than LIST" when Elastic configuration in application.conf "docStore has type OBJECT rather than LIST" when Elastic configuration is in application.conf Nov 10, 2016
@cpoissonnier cpoissonnier changed the title "docStore has type OBJECT rather than LIST" when Elastic configuration is in application.conf "docStore has type OBJECT rather than LIST" error when Elastic configuration is in application.conf Nov 10, 2016
@cpoissonnier
Copy link
Author

cpoissonnier commented Nov 10, 2016

I managed to make it work thanks to the ServerConfigStartup, by adding :

package models;

import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.event.ServerConfigStartup;

public class MyServerConfigStartup implements ServerConfigStartup {
    public void onStart(ServerConfig serverConfig) {
        serverConfig.getDocStoreConfig().setUrl("http://localhost:9200");
        serverConfig.getDocStoreConfig().setActive(true);
        serverConfig.getDocStoreConfig().setGenerateMapping(false);
        serverConfig.getDocStoreConfig().setDropCreate(false);
        serverConfig.getDocStoreConfig().setCreate(false);
        serverConfig.getDocStoreConfig().setPathToResources("conf");
    }
}

@marcospereira
Copy link
Member

Problem is here:

if (raw.valueType() == ConfigValueType.STRING) {
// Support legacy comma separated string
models = Arrays.asList(((String) raw.unwrapped()).split(","));
} else {
models = ebeanConfig.getStringList(key);
}

This is just accepting/parsing String and List configurations.

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Nov 29, 2016

To use DocStore, You have to put these lines on conf/ebean.properties. The file application.conf is only used to configure datasource and model location (for enhancement and register classes with Ebean server).

@cpoissonnier
Copy link
Author

I could, but I would have to put all ebean configuration in this file (I tried to mix configuration between the ebean.properties and application.conf, but it doesn't work) and the way I deal with different environnement doesn't really allow that. A fix would be more than welcome :)

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 2, 2016

I see, it make sense, something like that (see below) could be a good approach to handle configuration of all Ebean functionalities.

application.conf

ebean {

    servers {
        default {
            enhancement = ["models.*"]

            docstore {
                url = "http://127.0.0.1:9200"
                active = true
                generateMapping = false
                dropCreate = false
                create = false
            }
        }
    }

    querybean {
        # Configure type safe queries (http://ebean-orm.github.io/docs/query/typesafe)
        ...
    }

    encryption {
        # Configure encryption key manager to use for fields annotated with @Encrypted
        encryptKeyManager = "com.zero_x_baadf00d.ebean.encryption.StandardEncryptKeyManager"
    }
}

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 2, 2016

...of course it doesn't work. It's an example of what play-ebean configuration could looks like in the future. I just said "could be a good approach to handle configuration of all Ebean functionalities.".

@cpoissonnier
Copy link
Author

My bad !

That would be perfect

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 2, 2016

I can propose a PR this weekend or next weekend... I don't promise all configuration keys will be implemented, but the docstore related keys should working.

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 10, 2016

@cpoissonnier

I have rewritted so many files, not sure it will be merged in this project. So we are published our version under our organization.

in your project/plugins.sbt file, you can override sbt-play-ebean with :

addSbtPlugin("com.payintech" % "sbt-play-ebean" % "16.12")

And use this application.conf

# Ebean
# ~~~~~
ebean {
  servers {

    # You can declare as many servers as you want.
    # By convention, the default server is named `default`
    default {

      # Locations of the classes to enhance
      enhancement = ["models.*"]

      # Extra server settings
      settings {

        # Set to true if this server is Document store only
        onlyUseDocStore = false

        # Encryption key manager to use for fields annotated with @Encrypted
        #encryptKeyManager = "com.zero_x_baadf00d.ebean.encryption.StandardEncryptKeyManager"
      }

      # Document store
      docstore {

        # URL of the ElasticSearch server to use
        url = "http://127.0.0.1:9200"

        # Enable document store integration
        active = true

        # Set the relative file system path to resources when generating mapping files
        pathToResources = "conf"

        # Generate mapping files for each index and these will by default be
        # generated into ${pathToResources} under "elastic-mapping"
        generateMapping = false

        # Drop and re-create all indexes
        dropCreate = false

        # Create only indexes that have not already been defined
        create = false
      }
    }
  }
}

@cpoissonnier
Copy link
Author

Great ! Thank you so much, I'll try this monday !

@ethereal-sandeep
Copy link

ethereal-sandeep commented Dec 19, 2016

@cpoissonnier I tried this plugin addSbtPlugin("com.payintech" % "sbt-play-ebean" % "16.12"
& still got this error
/application.conf:** 87-90: docstore has type OBJECT rather than LIST]

Anyone else who is able to run this successfully...please share the config format.

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 19, 2016

@ethereal-sandeep have you upgraded your application.conf file ? If you have in develop mode, think to restart server after editing project/plugins.sbt.

# Ebean
# ~~~~~
ebean {
  servers {

    # You can declare as many servers as you want.
    # By convention, the default server is named `default`
    default {

      # Locations of the classes to enhance
      enhancement = ["models.*"]

      # Extra server settings
      settings {

        # Set to true if this server is Document store only
        onlyUseDocStore = false

        # Encryption key manager to use for fields annotated with @Encrypted
        #encryptKeyManager = "com.zero_x_baadf00d.ebean.encryption.StandardEncryptKeyManager"
      }

      # Document store
      docstore {

        # URL of the ElasticSearch server to use
        url = "http://127.0.0.1:9200"

        # Enable document store integration
        active = true

        # Set the relative file system path to resources when generating mapping files
        pathToResources = "conf"

        # Generate mapping files for each index and these will by default be
        # generated into ${pathToResources} under "elastic-mapping"
        generateMapping = false

        # Drop and re-create all indexes
        dropCreate = false

        # Create only indexes that have not already been defined
        create = false
      }
    }
  }
}

@ethereal-sandeep Could copy / past your application.conf (gist) ? have you try to clean ivy cache ?

@cpoissonnier
Copy link
Author

I had no time to try it yet, sorry :/

@ethereal-sandeep
Copy link

ethereal-sandeep commented Dec 20, 2016

@0xBAADF00D Since i was using 3.0.0 , Firstly i fixed all the migrations then for each iteration I tried cleaning first and then recompile -> it failed with the same error

/application.conf:** 87-90: docstore has type OBJECT rather than LIST] :/

So earlier i had my 'application.conf' as:

# Ebean configuration
# ~~~~~
# You can declare as many Ebean servers as you want.
# By convention, the default server is named default
#
ebean.default="models.*"

What i wanted was something like below in 'application.conf':

# Ebean configuration
# ~~~~~
# You can declare as many Ebean servers as you want.
# By convention, the default server is named default
#
ebean.default="models.*"

ebean.docstore.url="http://127.0.0.1:9200"
ebean.docstore.active=true
ebean.docstore.generateMapping=false
ebean.docstore.dropCreate=false
ebean.docstore.create=false

What i understood from your config, i did this to 'application.conf':

# ~~~~~
ebean {
  servers {

    # You can declare as many servers as you want.
    # By convention, the default server is named default
    default {

      # Locations of the classes to enhance
      enhancement = ["models.*"]

      # Extra server settings
      settings {

        # Set to true if this server is Document store only
        onlyUseDocStore = false

        # Encryption key manager to use for fields annotated with @Encrypted
        #encryptKeyManager = "com.zero_x_baadf00d.ebean.encryption.StandardEncryptKeyManager"
      }

      # Document store
      docstore {

        # URL of the ElasticSearch server to use
        url = "http://127.0.0.1:9200"

        # Enable document store integration
        active = true

        # Set the relative file system path to resources when generating mapping files
        pathToResources = "conf"

        # Generate mapping files for each index and these will by default be
        # generated into ${pathToResources} under "elastic-mapping"
        generateMapping = false

        # Drop and re-create all indexes
        dropCreate = false

        # Create only indexes that have not already been defined
        create = false
      }
    }
  }
}

still it failed with the same error.

** Please let me know if i am applying it incorrectly.

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 20, 2016

Your keys are not corrects. According to my example, "flat keys" follows this pattern ebean.servers.<server>.docstore.<key>.

By example:

ebean.servers.default.enhancement=["models.*"] #Must be a LIST

ebean.servers.default.docstore.url="http://127.0.0.1:9200"
ebean.servers.default.docstore.active=true
ebean.servers.default.docstore.generateMapping=false
ebean.servers.default.docstore.dropCreate=false
ebean.servers.default.docstore.create=false

@cpoissonnier
Copy link
Author

Unfortunatly, it doesn't work for me as well, but not for the same reasons :

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

1) Error injecting constructor, java.lang.NoClassDefFoundError: com/avaje/ebean/QueryEachConsumer
  at play.db.ebean.EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:55)
  at play.db.ebean.EbeanDynamicEvolutions.class(EbeanDynamicEvolutions.java:44)
  while locating play.db.ebean.EbeanDynamicEvolutions
  at play.db.ebean.EbeanModule.bindings(EbeanModule.java:24):
Binding(class play.api.db.evolutions.DynamicEvolutions to ConstructionTarget(class play.db.ebean.EbeanDynamicEvolutions) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
  while locating play.api.db.evolutions.DynamicEvolutions
  while locating play.api.db.evolutions.ApplicationEvolutionsProvider
  at play.api.db.evolutions.EvolutionsModule.bindings(EvolutionsModule.scala:22):
Binding(class play.api.db.evolutions.ApplicationEvolutions to ProviderConstructionTarget(class play.api.db.evolutions.ApplicationEvolutionsProvider) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleCon
versions$$anon$1)
  while locating play.api.db.evolutions.ApplicationEvolutions
Caused by: java.lang.NoClassDefFoundError: com/avaje/ebean/QueryEachConsumer
        at com.avaje.ebeanservice.elastic.bulk.BulkSender.<clinit>(BulkSender.java:21)
        at com.avaje.ebeanservice.elastic.ElasticUpdateProcessor.<init>(ElasticUpdateProcessor.java:47)
        at com.avaje.ebeanservice.elastic.ElasticDocStoreFactory.create(ElasticDocStoreFactory.java:43)
        at com.avaje.ebeaninternal.server.core.InternalConfiguration.createDocStoreIntegration(InternalConfiguration.java:338)
        at com.avaje.ebeaninternal.server.core.DefaultServer.<init>(DefaultServer.java:236)
        at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:129)
        at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:44)
        at com.avaje.ebean.EbeanServerFactory.createInternal(EbeanServerFactory.java:108)
        at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:67)
        at play.db.ebean.EbeanDynamicEvolutions.lambda$start$2(EbeanDynamicEvolutions.java:118)
        at java.util.HashMap.forEach(HashMap.java:1288)
        at play.db.ebean.EbeanDynamicEvolutions.start(EbeanDynamicEvolutions.java:114)
        at play.db.ebean.EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:58)
        at play.db.ebean.EbeanDynamicEvolutions$$FastClassByGuice$$52c94231.newInstance(<generated>)
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
        at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405)
        at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:400)
        at play.api.db.evolutions.ApplicationEvolutionsProvider.get$lzycompute(EvolutionsModule.scala:53)
        at play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:53)
        at play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:44)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
        at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
        at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
        at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
        at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at com.google.inject.Guice.createInjector(Guice.java:84)
        at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
        at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
        at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:164)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131)
        at scala.Option.map(Option.scala:146)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129)
        at scala.util.Success.flatMap(Try.scala:231)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:129)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:121)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.ClassNotFoundException: com.avaje.ebean.QueryEachConsumer
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 77 more

2) Error injecting constructor, java.lang.NoClassDefFoundError: Could not initialize class com.avaje.ebeanservice.elastic.bulk.BulkSender
  at play.db.ebean.EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:55)
  at play.db.ebean.EbeanDynamicEvolutions.class(EbeanDynamicEvolutions.java:44)
  while locating play.db.ebean.EbeanDynamicEvolutions
  at play.db.ebean.EbeanModule.bindings(EbeanModule.java:24):
Binding(class play.api.db.evolutions.DynamicEvolutions to ConstructionTarget(class play.db.ebean.EbeanDynamicEvolutions) eagerly) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$1)
  while locating play.api.db.evolutions.DynamicEvolutions
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.avaje.ebeanservice.elastic.bulk.BulkSender
        at com.avaje.ebeanservice.elastic.ElasticUpdateProcessor.<init>(ElasticUpdateProcessor.java:47)
        at com.avaje.ebeanservice.elastic.ElasticDocStoreFactory.create(ElasticDocStoreFactory.java:43)
        at com.avaje.ebeaninternal.server.core.InternalConfiguration.createDocStoreIntegration(InternalConfiguration.java:338)
        at com.avaje.ebeaninternal.server.core.DefaultServer.<init>(DefaultServer.java:236)
        at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:129)
        at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:44)
        at com.avaje.ebean.EbeanServerFactory.createInternal(EbeanServerFactory.java:108)
        at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:67)
        at play.db.ebean.EbeanDynamicEvolutions.lambda$start$2(EbeanDynamicEvolutions.java:118)
        at java.util.HashMap.forEach(HashMap.java:1288)
        at play.db.ebean.EbeanDynamicEvolutions.start(EbeanDynamicEvolutions.java:114)
        at play.db.ebean.EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:58)
        at play.db.ebean.EbeanDynamicEvolutions$$FastClassByGuice$$52c94231.newInstance(<generated>)
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
        at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
        at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at com.google.inject.Guice.createInjector(Guice.java:84)
        at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
        at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
        at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:164)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:131)
        at scala.Option.map(Option.scala:146)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:131)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:129)
        at scala.util.Success.flatMap(Try.scala:231)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:129)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:121)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

2 errors
        at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
        at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at com.google.inject.Guice.createInjector(Guice.java:84)
        at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
        at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
        at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:168)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:164)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:164)
        ... 14 common frames omitted

@cpoissonnier cpoissonnier reopened this Dec 20, 2016
@rbygrave
Copy link

Note that with version 9.1.1 Ebean moved to Java 8 and in release 9.3.1 made the API changes to move to use Java8 Consumer and Predicate:

#891 Refactor: Replace Ebean's QueryEachConsumer with java.util.function.Consumer
#892 Refactor: Replace Ebean's QueryEachWhileConsumer with java.util.function.Predicate

To use QueryEachConsumer you need to use a version prior to 9.3.1.

@rbygrave
Copy link

Said another way, the exception above suggests to me that the version of "ebean-elastic" used is not compatible with the version of "ebean". Check that ebean-elastic 1.5.1 is being used (and not an earlier version).

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 20, 2016

Actually, addSbtPlugin("com.payintech" % "sbt-play-ebean" % "16.12") use Ebean 9.3.1 and EbeanAgent 8.2.1.

If Ebean 9.3.1 is not suitable for you, as mentioned on the README.md, you can override Ebean version with all versions between 9.1.1 and 9.5.1. The next scheduled version of sbt-play-ebean (17.01) will built-in use the version 10.x of Ebean / EbeanAgent.

@cpoissonnier
Copy link
Author

Weirdly,the version of ebean used in my project was 8.2.3.

Overriding ebean version (9.3.1) and upgrading ebean-elastic to 1.5.1 resolves the issue.

Thank you so much for your help !

@ethereal-sandeep
Copy link

ethereal-sandeep commented Dec 21, 2016

@cpoissonnier can you please share (gist) of your application.conf and build.sbt and plugin.sbt....

@cpoissonnier
Copy link
Author

https://gist.github.com/cpoissonnier/66c8f4689d4ddae6b4ea6447315430cd

@ethereal-sandeep
Copy link

Guys, i know this must have started irritating you all but bear with me for a while. @cpoissonnier i added the settings and also clears ivy2/cache and tried a fresh compile..got this in return.

java.lang.RuntimeException: com.typesafe.config.ConfigException$WrongType: application.conf @ file:/home/user/projects/server/conf/application.conf: 86-93: servers has type OBJECT rather than LIST
	at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:159)
	at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170)
	at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)
	at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
	at com.typesafe.config.impl.SimpleConfig.getList(SimpleConfig.java:252)
	at com.typesafe.config.impl.SimpleConfig.getHomogeneousUnwrappedList(SimpleConfig.java:323)
	at com.typesafe.config.impl.SimpleConfig.getStringList(SimpleConfig.java:381)
	at play.db.ebean.EbeanParsedConfig.lambda$parseFromConfig$0(EbeanParsedConfig.java:68)
	at java.util.Map.forEach(Map.java:630)
	at play.db.ebean.EbeanParsedConfig.parseFromConfig(EbeanParsedConfig.java:62)
	at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:28)
	at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:21)
	at play.ebean.sbt.PlayEbean$$anonfun$configuredEbeanModels$1$$anonfun$apply$1.apply(PlayEbean.scala:133)
	at play.ebean.sbt.PlayEbean$$anonfun$configuredEbeanModels$1$$anonfun$apply$1.apply(PlayEbean.scala:130)
	at play.ebean.sbt.PlayEbean$$anonfun$configuredEbeanModels$1.withClassLoader$1(PlayEbean.scala:109)
	at play.ebean.sbt.PlayEbean$$anonfun$configuredEbeanModels$1.apply(PlayEbean.scala:130)
	at play.ebean.sbt.PlayEbean$$anonfun$configuredEbeanModels$1.apply(PlayEbean.scala:98)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:237)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] (compile:playEbeanModels) com.typesafe.config.ConfigException$WrongType: application.conf @ file:/home/user/projects/server/conf/application.conf: 86-93: servers has type OBJECT rather than LIST
[error] application - 

! @72ejhm9ge - Internal server error, for (POST) [/test] ->
 
play.sbt.PlayExceptions$UnexpectedException: Unexpected exception[RuntimeException: com.typesafe.config.ConfigException$WrongType: application.conf @ file:/home/user/projects/server/conf/application.conf: 86-93: servers has type OBJECT rather than LIST]
	at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:51)
	at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44)
	at scala.Option.map(Option.scala:145)
	at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44)
	at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40)
	at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17)
	at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17)
	at scala.util.Either$LeftProjection.map(Either.scala:377)
	at play.sbt.run.PlayReload$.compile(PlayReload.scala:17)
	at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3$$anonfun$2.apply(PlayRun.scala:61)
Caused by: java.lang.RuntimeException: com.typesafe.config.ConfigException$WrongType: application.conf @ file:/home/user/projects/server/conf/application.conf: 86-93: servers has type OBJECT rather than LIST
	at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:159)
	at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170)
	at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)
	at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
	at com.typesafe.config.impl.SimpleConfig.getList(SimpleConfig.java:252)
	at com.typesafe.config.impl.SimpleConfig.getHomogeneousUnwrappedList(SimpleConfig.java:323)
	at com.typesafe.config.impl.SimpleConfig.getStringList(SimpleConfig.java:381)
	at play.db.ebean.EbeanParsedConfig.lambda$parseFromConfig$0(EbeanParsedConfig.java:68)
	at java.util.Map.forEach(Map.java:630)
	at play.db.ebean.EbeanParsedConfig.parseFromConfig(EbeanParsedConfig.java:62)

my application.conf

# Ebean configuration
# ~~~~~
# You can declare as many Ebean servers as you want.
# By convention, the default server is named `default`
#
#
ebean.servers.default.enhancement=["models.*"] #Must be a LIST
# Ebean elastic search  
ebean.servers.default.docstore.url="http://127.0.0.1:9200"
ebean.servers.default.docstore.active=true
ebean.servers.default.docstore.generateMapping=false
ebean.servers.default.docstore.dropCreate=false
ebean.servers.default.docstore.create=true
ebean.servers.default.docstore.pathToResources="conf"
#

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 22, 2016

@ethereal-sandeep I think you don't use our plugin, cause you have an error on the file EbeanParsedConfig.java who has been removed since the version 16.12.

Are you sure addSbtPlugin("com.payintech" % "sbt-play-ebean" % "16.12") is in your project\plugins.sbt file ? Have you clean your project (rm targetdirectory) ?

@ethereal-sandeep
Copy link

ethereal-sandeep commented Dec 22, 2016

my plugins.sbt

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.10")

// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using "PlayEbean"
//  https://github.com/playframework/play-ebean/issues/104
addSbtPlugin("com.payintech" % "sbt-play-ebean" % "16.11")

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 22, 2016

@ethereal-sandeep You don't use the right version. 16.11 don't allow configuration of document store via application.conf. You can upgrade to release/16.12.

@ethereal-sandeep
Copy link

ethereal-sandeep commented Dec 22, 2016

@0xBAADF00D Seriously thats was the only thing ... My Bad .Let me check

@ethereal-sandeep
Copy link

ethereal-sandeep commented Dec 22, 2016

@0xBAADF00D, @cpoissonnier Thanks man!! it finally compiled . but strangely
[info] c.z.h.HikariDataSource - HikariPool-1 - Started.
then again HikariPool-1 closed and HikariPool-2 started..then HikariPool-2 closed and HikariPool-3 started...this for once went till 33..

gist of it is mentioned below...

[info] application - Shutting down connection pool.
[info] c.z.h.p.HikariPool - HikariPool-2 - Close initiated...
[info] c.z.h.p.HikariPool - HikariPool-2 - Closed.
[warn] application - Logger configuration in conf files is deprecated and has no effect. Use a logback configuration file instead.
[info] application - Creating Pool for datasource 'default'
[info] c.z.h.HikariDataSource - HikariPool-3 - Started.

@thibaultmeyer
Copy link
Contributor

thibaultmeyer commented Dec 22, 2016

Seems not related to sbt-play-ebean module. Maybe try to fix the following warning and check our datasource configuration (db.default.driver, db.default.url, db.default.username, ...)

[warn] application - Logger configuration in conf files is deprecated and has no effect. Use a logback configuration file instead.

You can read more at https://www.playframework.com/documentation/2.5.x/JavaDatabase and https://www.playframework.com/documentation/2.5.x/SettingsLogger

@ethereal-sandeep
Copy link

@0xBAADF00D okay, thanks !!

@cpoissonnier
Copy link
Author

Is this issue gonna be resolved in the 4.0.0 version?

@cpoissonnier cpoissonnier reopened this Feb 23, 2017
@allnash
Copy link

allnash commented Mar 28, 2018

Which release is this going to be in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants