sorm h2 DB for play framework scala - NoSuchMethodError - scala

I'm encountering this error when I followed play-scala template tutorial:
[error] play - Cannot invoke the action, eventually got an error: java.lang.RuntimeException: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
[error] application -
! #6jmiof8bp - Internal server error, for (POST) [/provision] ->
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.4.jar:2.3.4]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.4.jar:2.3.4]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.4.jar:2.3.4]
at scala.Option.map(Option.scala:145) [scala-library-2.11.1.jar:na]
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:523) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.11-2.3.4.jar:2.3.4]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) ~[play_2.11-2.3.4.jar:2.3.4]
Caused by: java.lang.NoSuchMethodError: scala.reflect.api.Types$TypeApi.members()Lscala/reflect/api/Scopes$ScopeApi;
at sorm.reflection.ScalaApi$TypeApi.members(ScalaApi.scala:11) ~[sorm-0.3.13.jar:na]
at sorm.reflection.ScalaApi$TypeApi.properties(ScalaApi.scala:13) ~[sorm-0.3.13.jar:na]
at sorm.reflection.Reflection.properties(Reflection.scala:31) ~[sorm-0.3.13.jar:na]
at sorm.core.Initialization$.sorm$core$Initialization$$checkType$1(Initialization.scala:75) ~[sorm-0.3.13.jar:na]
at sorm.core.Initialization$.recursiveEntities$1(Initialization.scala:79) ~[sorm-0.3.13.jar:na]
I encounter this error when I added this line DB.save(person) on my provision method Application.scala
My DB Object looks like this:
object MemDB extends Instance(entities = Seq(Entity[Person]()), url ="jdbc:h2:mem:play") {}
I also removed the comments on my application.conf file
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
I can't figure out how to fix this error. I just followed the video tutorial in the playframework websito for play framework and scala. I also tried changing the url to jdbc:h2:mem:test just like what the tutorial suggest. I am using the following versions
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.4")
libraryDependencies += "org.sorm-framework" % "sorm" % "0.3.13"
libraryDependencies += "com.h2database" % "h2" % "1.4.181"
scalaVersion := "2.11.1"

SORM is only compatible with the version 2.1 of Play at the time. Your problems must be caused by this.
Here's a related ticket.

Related

googlecloudpubsub:java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

I am facing this issue when trying to run a google cloud subscriber within a scala sbt project on local windows environment. The versions used are as follows:
java : 1.8.0_171"
scala : 2.11.8
below are the versions of sbt library dependencies:
"com.google.cloud" % "google-cloud-pubsub" % "1.108.1",
"com.google.cloud" % "google-cloud-shared-dependencies" % "0.8.6" pomOnly(),
"com.google.api.grpc" % "grpc-google-cloud-pubsub-v1" % "1.90.1",
"io.grpc" % "grpc-all" % "1.30.2"
The deployment is done by running a fat JAR in nohup build using sbt assembly plugin.
This is the error log which I am getting:
Caused by: java.lang.IllegalStateException: Expected the service InnerService [FAILED] to be RUNNING, but the service has FAILED
at com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:366)
at com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:302)
at com.google.api.core.AbstractApiService.awaitRunning(AbstractApiService.java:96)
at services.externalservices.pubsub.GoogleCloudSubscriber$class.subscribeAsyncExample(GoogleCloudSubscriber.scala:89)
at services.externalservices.pubsub.GoogleCloudSubscriber$class.initialise(GoogleCloudSubscriber.scala:37)
at services.externalservices.pubsub.GoogleCloudSubscriberImpl.initialise(GoogleCloudSubscriber.scala:95)
at services.externalservices.pubsub.GoogleCloudSubscriber$class.$init$(GoogleCloudSubscriber.scala:27)
at services.externalservices.pubsub.GoogleCloudSubscriberImpl.<init>(GoogleCloudSubscriber.scala:95)
at services.externalservices.pubsub.GoogleCloudSubscriberImpl$$FastClassByGuice$$a4a053ae.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
at com.google.inject.internal.ConstructorBindingImpl$Factory .get(ConstructorBindingImpl.java:268)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:194)
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:1085)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
... 9 more
Caused by: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:233)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:144)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:93)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:414)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:513)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:314)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1600(InstantiatingGrpcChannelProvider.java:71)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:210)
at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:217)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:200)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:156)
at com.google.cloud.pubsub.v1.stub.GrpcSubscriberStub.create(GrpcSubscriberStub.java:272)
at com.google.cloud.pubsub.v1.Subscriber.doStart(Subscriber.java:273)
at com.google.api.core.AbstractApiService$InnerService.doStart(AbstractApiService.java:148)
at com.google.common.util.concurrent.AbstractService.startAsync(AbstractService.java:248)
at com.google.api.core.AbstractApiService.startAsync(AbstractApiService.java:120)
at com.google.cloud.pubsub.v1.Subscriber.startAsync(Subscriber.java:265)
However, the same subscriber works as expected when running the application in foreground using sbt run command.

Hibernate Search Throwing org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype

I am trying to integrate the hibernate search to my existing hibernate application
I am Using following versions as part of my application
Using: Java versions: 8
hibernate.version:4.2.18.Final 4.0.5.RELEASE
hibernate-search-orm:4.4.6.Final
now i have am using Hibernate Search in my application to integrate it with my application
But while i use Hibernate Search Annotations for example#Indexed and try to start my server
the following error is thrown
ERROR:
Error creating bean with name 'myEntityManagerFactory' defined in class path resource [spring-jpa.xml]: Invocation of init method failed; nested exception is java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype
Stack Trace:
ERROR [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 71) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myEntityManagerFactory' defined in class path resource [spring-jpa.xml]: Invocation of init method failed; nested exception is java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at .config.listener.PortalSpringContextLoaderListener.contextInitialized(PortalSpringContextLoaderListener.java:45)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:205)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:174)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:239)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:99)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
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)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:246)
at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:53)
at org.hibernate.service.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:188)
at org.hibernate.ejb.Ejb3Configuration.buildLifecycleControledServiceRegistry(Ejb3Configuration.java:935)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:900)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:336)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
... 33 more
According to my observation as i am using the jboss7 wher we have hibernate 5 version dependencies and the pom.xml contains 4.2.18 hibernate dependencies and i am using compatible hibernate search for the 4.2.18 hibernate version which results in conflicts of the dependencies between the jboss hibernate modules and dependencies from pom.xml caused this error..
Basically its hibernate dependencies compatibility issues
u can go throw the following link froenter link description here

Scala Play Framework: Header doesn't exists

I am trying to run play application and it runs correctly. However, while serving to few APIs, I get following error:
[error] play - Cannot invoke the action, eventually got an error: java.lang.RuntimeException: Header doesn't exist
[error] application -
! #714mk098l - Internal server error, for (POST) [/ivi/customer/login/] ->
play.api.Application$$anon$1: Execution exception[[RuntimeException: Header doesn't exist]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.10-2.3.9.jar:2.3.9]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.10-2.3.9.jar:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.9.jar:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.9.jar:2.3.9]
at scala.Option.map(Option.scala:145) [scala-library-2.10.5.jar:na]
Caused by: java.lang.RuntimeException: Header doesn't exist
at scala.sys.package$.error(package.scala:27) ~[scala-library-2.10.5.jar:na]
at play.api.mvc.Headers$$anonfun$apply$10.apply(Http.scala:338) ~[play_2.10-2.3.9.jar:2.3.9]
at play.api.mvc.Headers$$anonfun$apply$10.apply(Http.scala:338) ~[play_2.10-2.3.9.jar:2.3.9]
at scala.Option.getOrElse(Option.scala:120) [scala-library-2.10.5.jar:na]
at play.api.mvc.Headers$class.apply(Http.scala:338) ~[play_2.10-2.3.9.jar:2.3.9]
I feel like this should related to configuration rather than code issue. Can someone please guide here?

SecureSocial InvocationTargetException

I'm trying to get the SecureSocial scala/demo (3.0-M1-play-2.2.x) integrated in my own Play app.
I copied the Scala files from the demo and added a securesocial.conf and extended my routes file to link to the SecureSocial routes.
Compilation is fine but when I am trying to run I get the following exception:
[error] application -
! Internal server error, for (GET) [/] ->
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_25]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_25]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_25]
at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[na:1.8.0_25]
at Global$$anonfun$2.apply(Global.scala:35) ~[na:na]
Caused by: java.lang.NoSuchMethodError: play.api.mvc.Results$Status.apply(Ljava/lang/Object;Lplay/api/http/Writeable;)Lplay/api/mvc/SimpleResult;
at securesocial.core.SecureSocial$class.$init$(SecureSocial.scala:46) ~[securesocial_2.10-3.0-M1-play-2.2.x.jar:3.0-M1-play-2.2.x]
at controllers.Application.<init>(Application.scala:23) ~[na:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_25]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_25]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_25]
Global.scla: 35 is:
the getControllerInstance Method from the example the line is:
_.asInstanceOf[Constructor[A]].newInstance(MyRuntimeEnvironment)
So it looks like it can not instantiate the Application Class the header of the application class looks like:
class Application(override implicit val env: RuntimeEnvironment[DemoUser]) extends securesocial.core.SecureSocial[DemoUser] {
The example is working but my own project isn't, I can't figure out the problem and would be glad if someone could help me.
Ok I found the error.
I had to use:
"ws.securesocial" %% "securesocial" % "master-SNAPSHOT"
instead of:
"ws.securesocial" % "securesocial_2.10" % "3.0-M1-play-2.2.x"

TimeoutException while creating new app in Typesafe Activator Commandline

Every time i'm getting following error when i try to create new app using typesafe activator command line.By Activator UI its working normal & m using Typesafe Activator 1.0.10 in Fedora20.
Enter an application name
> hello-scala
Futures timed out after [6 seconds]
java.util.concurrent.TimeoutException: Futures timed out after [6 seconds]
at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:96)
at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:100)
at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:107)
at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)
at scala.concurrent.Await$.result(package.scala:107)
at activator.ActivatorCli$$anonfun$apply$1.apply$mcI$sp(ActivatorCli.scala:32)
at activator.ActivatorCli$$anonfun$apply$1.apply(ActivatorCli.scala:17)
at activator.ActivatorCli$$anonfun$apply$1.apply(ActivatorCli.scala:17)
at activator.ActivatorCli$.withContextClassloader(ActivatorCli.scala:127)
at activator.ActivatorCli$.apply(ActivatorCli.scala:17)
at activator.ActivatorLauncher.run(ActivatorLauncher.scala:27)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
This has been resolved with the latest Activator: https://github.com/typesafehub/activator/issues/225
Download it: http://typesafe.com/platform/getstarted