EBean with Scala on SBT (InterruptedException: sleep interrupted) - scala

I am trying to run EBean with Scala on SBT and I get an error.
This is the code (a test from: http://www.avaje.org/ebean/getstarted_props.html#test):
object Main extends App {
val sql = "select count(*) as count from dual"
val row = Ebean.createSqlQuery(sql).findUnique()
val i = row.getInteger("count")
println("Got " + i + " - DataSource good.")
}
This is the error:
[info] Loading project definition from /Volumes/etam/lift/hello-ebean/project
[info] Set current project to Main (in build file:/Volumes/etam/lift/hello-ebean/)
[info] Running hello.Main
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.core.BootupClassPathSearch search
INFO: Classpath search hits in jars[ebean-2.7.7.jar] pkgs[com.avaje.ebeaninternal.server.bean, com.avaje.ebean.meta] searchTime[51]
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.lib.sql.DataSourcePool initialise
INFO: DataSourcePool [h2] autoCommit[false] transIsolation[READ_COMMITTED] min[1] max[25]
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.core.DefaultServerFactory setDatabasePlatform
INFO: DatabasePlatform name:h2 platform:h2
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.subclass.SubClassManager$1 run
INFO: SubClassFactory parent ClassLoader [sbt.classpath.ClasspathUtilities$$anon$1]
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.deploy.DeployOrmXml findAllOrmXml
INFO: Deployment xml [orm.xml] loaded.
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager logStatus
INFO: Entities enhanced[0] subclassed[0]
runScript
executing 1 of 2 SET REFERENTIAL_INTEGRITY FALSE
executing 2 of 2 SET REFERENTIAL_INTEGRITY TRUE
... end of script
runScript
... end of script
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.transaction.log.FileTransactionLoggerWrapper initialiseLogger
INFO: Transaction logs in: logs
Got 0 - DataSource good.
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.lib.BackgroundThread$Runner run
SEVERE: null
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.avaje.ebeaninternal.server.lib.BackgroundThread$Runner.run(BackgroundThread.java:168)
at java.lang.Thread.run(Thread.java:680)
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.transaction.log.FileTransactionLogger run
INFO: Interrupted TxnLogBufferWriter
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.avaje.ebeaninternal.server.transaction.log.FileTransactionLogger.run(FileTransactionLogger.java:206)
at java.lang.Thread.run(Thread.java:680)
[success] Total time: 1 s, completed 2012-06-30 09:36:51
What is wrong with the project?
GIT repository: https://github.com/odwrotnie/hello-ebean;
main class: https://github.com/odwrotnie/hello-ebean/blob/master/main/src/main/scala/hello/main.scala;
config: https://github.com/odwrotnie/hello-ebean/blob/master/main/src/main/resources/ebean.properties.
Thanks in advance,
Etam.

By default, run executes the application in the same jvm as sbt itself for faster turnaround time. In this case, run thinks there are only daemon threads left after the main method terminates. It proceeds to interrupt those remaining threads, which gives the exceptions you see. It has to do it this way because this is the best it can do to fake a jvm shutdown without actually shutting it down.
Those exceptions don't look too harmful, but you can get rid of them by running the application in a forked jvm. To enable this, add the following to your build settings
fork in run := true
How sbt runs project code in the same jvm is described here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Running-Project-Code.html
Forking is described here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Forking.html

Related

Imported Selenium IDE script fails

I am testing out Katalon Recorder and Studio to see if they can handle imported Selenium IDE scripts. I executed the following directions successfully:
https://forum.katalon.com/discussion/4220/how-to-import-selenium-ide-test-cases-into-katalon-studio
However, the moment I click RUN I receive the following error message:
01-24-2018 06:33:12 PM - [START] - Start Test Case : Test Cases/New Test Case
01-24-2018 06:33:12 PM - [INFO] - Evaluating variables for test case
01-24-2018 06:33:13 PM - [ERROR] - Test Cases/New Test Case FAILED because (of) org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!
java.lang.RuntimeException: Method code too large!
at groovyjarjarasm.asm.MethodWriter.a(Unknown Source)
at groovyjarjarasm.asm.ClassWriter.toByteArray(Unknown Source)
at org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:815)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
etc...
I have no clue what this means. I appreciate any help.

java.lang.IllegalArgumentException: This Dispatcher has been shut down

I have implemented Spock Integration test TestControllerIntegrationSpec on Grails, Groovy,GROM and Mongodb environment and the Test case has been passed when only one Interation test class available in my development environment.But fails when development environment has more than one Integration test
Ran the test case "gradle clean integrationTest"
This Dispatcher has been shut down.;
nested exception is java.lang.IllegalArgumentException: This Dispatcher has been shut down.
org.springframework.transaction.CannotCreateTransactionException: This Dispatcher has been shut down.; nested exception is java.lang.IllegalArgumentException: This Dispatcher has been shut down.
at org.grails.transaction.ChainedTransactionManager.getTransaction(ChainedTransactionManager.java:127)
at org.grails.transaction.ChainedTransactionManager.getTransaction(ChainedTransactionManager.java:55)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)
at com.TestControllerIntegrationSpec.setup(TestControllerIntegrationSpec.groovy)
Caused by: java.lang.IllegalArgumentException: This Dispatcher has been shut down.
at reactor.core.support.Assert.isTrue(Assert.java:61)
at reactor.core.dispatch.AbstractLifecycleDispatcher.dispatch(AbstractLifecycleDispatcher.java:111)
at reactor.bus.EventBus.notify(EventBus.java:368)
at grails.events.Events$Trait$Helper.notify(Events.groovy:111)
at org.grails.events.spring.SpringEventTranslator.onApplicationEvent(SpringEventTranslator.groovy:66)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
at org.grails.datastore.gorm.events.ConfigurableApplicationContextEventPublisher.publishEvent(ConfigurableApplicationContextEventPublisher.groovy:30)
at org.grails.datastore.mapping.core.AbstractDatastore.publishSessionCreationEvent(AbstractDatastore.java:125)
at org.grails.datastore.mapping.core.AbstractDatastore.connect(AbstractDatastore.java:118)
at org.grails.datastore.mapping.core.AbstractDatastore.connect(AbstractDatastore.java:113)
at org.grails.datastore.mapping.transactions.DatastoreTransactionManager.doGetTransaction(DatastoreTransactionManager.java:101)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:337)
at org.grails.transaction.MultiTransactionStatus.registerTransactionManager(MultiTransactionStatus.java:68)
at org.grails.transaction.ChainedTransactionManager.getTransaction(ChainedTransactionManager.java:106)
... 4 more

Getting OutOfMemoryException :Permgern space issue in jenkins

I am getting OutOfMemoryExeption:Permgern space issue when building a Maven project in Jenkins.
At the end of the building process message is showing as "Build Success" .But after that line below error msg is printing.
Fatal Error : Permgern space
Once this exception comes ,every time whole Jenkins is getting hanged i.e no
corresponding page of Jenkins even if dash board is not opening.
Below is the Command Line argument error for Jenkins.
Java HotSpot(TM) 64-bit Server VM Warning : Exception java.lang.OutOfMemoryError
occured dispatching signal unknown to handler - The VM may need to forcibly terminated.
Below is the error details from the console O/P of job-
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EmployeeInformation 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
**[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.161 s
[INFO] Finished at: 2016-09-11T00:55:52+05:30
[INFO] Final Memory: 5M/76M**
[INFO] ------------------------------------------------------------------------
Parsing POMs
Established TCP socket on 49708
[Employee_Management] $ "C:\Program Files\Java\jdk1.7.0_03/bin/java" -cp "C:\Users\pc\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-agent-1.7.jar;C:\Program Files\Apache\maven\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Program Files\Apache\maven\apache-maven-3.3.9/conf/logging" jenkins.maven3.agent.Maven32Main "C:\Program Files\Apache\maven\apache-maven-3.3.9" C:\Users\pc\.jenkins\war\WEB-INF\lib\remoting-2.62.jar C:\Users\pc\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-interceptor-1.7.jar C:\Users\pc\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-**commons-1.7.jar 49708
FATAL: PermGen space
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
FATAL: PermGen space**
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:144)
at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:74)
Caused by: java.io.EOFException: unexpected stream termination
at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:365)
at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:310)
at hudson.remoting.Launcher.main(Launcher.java:530)
at hudson.remoting.Launcher.main(Launcher.java:513)
at hudson.remoting.Launcher.main(Launcher.java:504)
at hudson.remoting.Launcher.main(Launcher.java:500)
... 6 more
Below are some of the possible steps I tried to solve-
(1)In POM.XML below tag added.
attached image link for Changed permgern space configuration in POM.xml
(2)Set JAVA_OPTS in enviroment variable.
attached image link for setting enviromental variables
But,unfortunately none of them working.Still issue is there.
After searching some where,I got to know
-XX:PermSize=256m -XX:MaxPermSize=512m declaration will resolve the issue.But I am not sure Where and How to give the above declaration.
Guys,Plz go through the above links I attached and let me know If any thing I did wrong.
Any help will be appreciated.
BR//
Abinash
Add your options to the _JAVA_OPTIONS environment variable -- this will work for sure.
Otherwise, for customizing the compiler options in your Maven build environment, there's several possibilities. See this question for an overview.

Strange exception in SBT test

I am facing an issue with SBT (version 0.13.9). One of my ScalaTest tests fails not deterministic with EOFException.
Stack trace:
Exception in thread "Thread-155" Exception in thread "Thread-159" java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at sbt.React.react(ForkTests.scala:114)
at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:74)
at java.lang.Thread.run(Thread.java:745)
java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1$React.react(Framework.scala:953)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1.run(Framework.scala:942)
at java.lang.Thread.run(Thread.java:745)
sbt.ForkMain 59974 failed with exit code 134
I don't see any JVM logs or thread dumps.
Almost certainly this is related to the Java classpath being too long when invoking sbt.ForkMain in certain linux distros. To avoid this I added
javaOptions in Test ++= Seq("-Xms1G","-XX:+CMSClassUnloadingEnabled","-XX:+UseConcMarkSweepGC")
to the build.sbt file. I reckon CMSClassUnloadingEnabled is where the magic happens.
SBT single thread or multi threaded tests forks the JVM and if the host name is not resolved it just fails with this error message. If you look at the logs in the tests, you might see
Uncaught exception when running tests: java.net.ConnectException: Operation timed out
So the easy way to resolve this is to add your hostname to the /etc/hosts and map it to localhost something like this
::1 localhost blahblah
This should resolve the issue.

typesafe activator ui not launching

play.api.Application$$anon$1: Execution exception[[IllegalArgumentException: req
uirement failed: Source file 'C:\Users\shriv_000\.activator\1.3.6\templates\inde
x.db_e25b80033130c08.tmp' is a directory.]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_
2.11-2.3.9.jar:2.3.9]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_
2.11-2.3.9.jar:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfu
n$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [play_2.11-2.3.9.jar
:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfu
n$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [play_2.11-2.3.9.jar
:2.3.9]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.s
cala:36) [scala-library.jar:0.13.8]
Caused by: java.lang.IllegalArgumentException: requirement failed: Source file '
C:\Users\shriv_000\.activator\1.3.6\templates\index.db_e25b80033130c08.tmp' is a
directory.
at scala.Predef$.require(Predef.scala:219) ~[scala-library.jar:0.13.8]
at sbt.IO$.copyFile(IO.scala:584) ~[client-all-2-11-0.3.5.jar:0.3.5]
at sbt.IO$.move(IO.scala:786) ~[client-all-2-11-0.3.5.jar:0.3.5]
at activator.package$RichIO$.createViaTemporary$extension(package.scala:
30) ~[activator-templates-cache-1.0-a0afb008ea619bf9d87dc010156cddffa8a6f880.jar
:1.3.6]
at activator.templates.repository.UriRemoteTemplateRepository$$anonfun$r
esolveIndexTo$1.apply(UriRemoteTemplateRepository.scala:228) ~[activator-templat
es-cache-1.0-a0afb008ea619bf9d87dc010156cddffa8a6f880.jar:1.0-a0afb008ea619bf9d8
7dc010156cddffa8a6f880]
[info] application - onStop received closing down the app
I am at activator 1.3.6
I have seen TypeSafe Activator installation error and it might be different then my problem. I have been able to create and launch a play project.
The solution provided there did not work for me.
I see this problem frequently.
I found a workaround. Try to execute activator as an administrator.