What is the preferred way to run Sinatra application? - sinatra

EDIT: I got the application working using TorqueBox, so I guess the problem is related to Trinidad. However, I think my guestion about the preferred way to run Sinatra applications is still valid.
I am using JRuby, Bundler, and modular style. Here's my application code:
# myapp.rb
class MyApp < Sinatra::Base
configure :development do
register Sinatra::Reloader
end
set :server, 'trinidad'
set :environment, :development
set :logging, true
#...
end
# config.ru
require 'bundler/setup'
Bundler.require(:default)
$: << File.dirname(__FILE__)
require 'myapp'
run MyApp
# Gemfile
source 'http://rubygems.org'
gem 'rack'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-contrib', :require => 'sinatra/reloader'
gem 'coffee-script'
gem 'neography'
gem 'gon-sinatra'
gem 'sass'
gem 'trinidad'
What is the proper way (i.e. what kind of command) to launch my application? I'm using Trinidad, because I read that it's good solution for JRuby applications (I couldn't get TorqueBox to work). Currently I'm running my app by 'trinidad config.ru', but it throws following kind error messages:
application error
org.jruby.rack.RackInitializationException: no such file to load -- bundler/setup
from org/jruby/RubyKernel.java:991:in `require'
from /home/myhome/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:36:in `require'
from /home/myhome/RubymineProjects/myapp/config.ru:1:in `(root)'
from org/jruby/RubyBasicObject.java:1818:in `instance_eval'
from jar:file:/home/myhome/.rvm/gems/jruby-1.7.0.preview1/gems/jruby-rack-1.1.9/lib/jruby-rack-1.1.9.jar!/vendor/rack-1.4.1/rack/builder.rb:51:in `initialize'
from /home/myhome/RubymineProjects/myapp/config.ru:1:in `(root)'
at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:224)
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:58)
at org.jruby.rack.PoolingRackApplicationFactory.createApplication(PoolingRackApplicationFactory.java:323)
at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:171)
at org.jruby.rack.DefaultRackDispatcher.getApplication(DefaultRackDispatcher.java:27)
at org.jruby.rack.AbstractRackDispatcher.process(AbstractRackDispatcher.java:32)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:37)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- bundler/setup
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:991)
at Kernel.require(/home/myhome/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:36)
at RUBY.(root)(/home/myhome/RubymineProjects/myapp/config.ru:1)
at org.jruby.RubyBasicObject.instance_eval(org/jruby/RubyBasicObject.java:1818)
at RUBY.initialize(jar:file:/home/myhome/.rvm/gems/jruby-1.7.0.preview1/gems/jruby-rack-1.1.9/lib/jruby-rack-1.1.9.jar!/vendor/rack-1.4.1/rack/builder.rb:51)
at RUBY.(root)(/home/myhome/RubymineProjects/myapp/config.ru:1)
ignoring null application
I'm using versions 1.4.1 of Trinidad and Rack, 1.7.0.preview1 of JRuby, and 1.3.3 of Sinatra.
If I run 'bundle exec trinidad config.ru', I get following errors:
application error
org.jruby.rack.RackInitializationException: Valid types are [:development, :runtime],
from /home/myhome/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/dependency.rb:45:in `initialize'
from /home/myhome/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:821:in `add_dependency_with_type'
from :1:in `'
from :1:in `'
from org/jruby/RubyKernel.java:1037:in `eval'
from org/jruby/RubyArray.java:1611:in `each'
from org/jruby/RubyArray.java:1611:in `each'
from org/jruby/RubyEnumerable.java:649:in `find_all'
from org/jruby/RubyKernel.java:991:in `require'
from org/jruby/RubyKernel.java:991:in `require'
from org/jruby/RubyKernel.java:991:in `require'
at org.jruby.rack.DefaultRackApplicationFactory.createApplication(DefaultRackApplicationFactory.java:235)
at org.jruby.rack.DefaultRackApplicationFactory.newApplication(DefaultRackApplicationFactory.java:49)
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:57)
at org.jruby.rack.PoolingRackApplicationFactory.createApplication(PoolingRackApplicationFactory.java:323)
at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:171)
at org.jruby.rack.DefaultRackDispatcher.getApplication(DefaultRackDispatcher.java:27)
at org.jruby.rack.AbstractRackDispatcher.process(AbstractRackDispatcher.java:32)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:37)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) Valid types are [:development, :runtime],
at Gem::Dependency.initialize(/home/myhome/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/dependency.rb:45)
at Gem::Specification.add_dependency_with_type(/home/myhome/.rvm/rubies/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:821)
at RUBY.(:1)
at RUBY.(:1)
at org.jruby.RubyKernel.eval(org/jruby/RubyKernel.java:1037)
at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1611)
at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1611)
at org.jruby.RubyEnumerable.find_all(org/jruby/RubyEnumerable.java:649)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:991)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:991)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:991)
ignoring null application

rubygems is not loaded by default (at least with jruby --1.8) thus you'll either add require 'rubygems' on top of the config.ru as JRuby (actually JRuby-Rack) loads your app in a separate "runtime" (kind of a new ruby process but inside the same JVM process) by default.
alternatively, you might as well run using rackup -s trinidad

As far as the CLI command to invoke your rack configuration and application, kares is right. Using "rackup" with "-s trinidad" is the way to go if you are not using Torquebox.
As far as the Ruby command to call your application from within your rack config, here is what I do.. Not sure if this applies in your situation, if this is what you're looking for, but it will help regardless of HTTP handler:
You have MyApp, which mixes in Sinatra::Base. If you trim that class down to only configure your environment, and run "before do" and "after do" for every pageload... but not actually handle and get/post calls; then you can create specialized classes which handle certain paths in your overall application. This uses Rack::Builder's map() method...
require 'myapp'
require 'mylanding'
require 'myauthentication'
require 'myautocomplete'
require 'mysearch'
#de run MyApp
map "/" do
run MyLanding #de Catch-all, which would have "get '/*' do" in it too.
end
map "/authentication/" do
run MyAuthentication
end
map "/autocomplete/" do
run MyAutocomplete
end
map "/search/" do
run MySearch
end
Then inside each My* class, do this:
class MyLanding < MyApp
get "/*" do
..handle landing.. or see what's in the splat.
end
end
class MyAuthentication < MyApp
get "/sign/in" do
..present sign-in..
end
post "/sign/in" do
..handle sign-in..
end
end
etc...
Your sub-classes have the overall MyApp treatment of every pageload, but add routes, such that /authentication/sign/in is handled by MyAuthentication's /sign/in, for example. It's a cool way of having somewhat focused sub-applications all using the same foundation: MyApp.

Related

No LoginModules configured for NOTES

I'm hoping someone can point me in the right direction. I'm trying to configure a development environment for Notes 10 using Eclipse 4.6.2 (32bit on Windows 10). The plugin I'm working with works in Notes 9 compiled with Eclipse 3, and continues to work as compiled in Notes 10, but I wish to make some changes.
I've used the instructions from Mikkel Heisterberg's site and modified the VM Argument variables :
install_id = 1564665877146
rcp.home = c:\notes\framework
rcp.base_version = 10.0.0.20181128-1343
The problem is when I try and launch the plugin, the notes UI window opens with the message No LoginModules configured for NOTES, and the stack trace below in Eclipse. I've tried completely reinstalling the notes/designer installation on my machine along with eclipse. I've also tried repeating the process on a system having only the notes client, but always to the same effect. I'm guessing there is something wrong with my process, so the question is, what do I need to do to successfully get Eclipse to launch notes so I can test & debug my plugin.
Any assistance is appreciated.
Configuration location:
file:/C:/Users/sdelicata/workspace-neon/.metadata/.plugins/org.eclipse.pde.core/Notes 2/
Configuration file:
file:/C:/Users/sdelicata/workspace-neon/.metadata/.plugins/org.eclipse.pde.core/Notes 2/config.ini loaded
Install location:
file:/c:/notes/framework/eclipse
Framework located:
file:/C:/notes/framework/rcp/eclipse/plugins/org.eclipse.osgi_3.11.3.20181108-1144.jar
Framework classpath:
file:/C:/notes/framework/rcp/eclipse/plugins/org.eclipse.osgi_3.11.3.20181108-1144.jar
Debug options:
file:/C:/Windows/System32/.options not found
Time to load bundles: 22
2019/08/11 21:26:11.784 SEVERE CWPPR0101E: Could not find file C:\Windows\System32\.config\rcpinstall.properties ::class.method=com.ibm.rcp.provisioning.internal.core.ProvisioningUtils.savePropertiesFile() ::thread=Start Level: Equinox Container: 5bab7e6c-fa69-414c-8c98-843705bd127d ::loggername=com.ibm.rcp.provisioning.internal.core
2019/08/11 21:26:11.850 WARNING CLFRU0029W: Your data is not currently roaming because you started the session with a different application than the Notes client (for example, Symphony or Designer). ::class.method=com.ibm.notes.roaming.provider.operations.NotesRoamingVeto.shouldRoam() ::thread=Start Level: Equinox Container: 5bab7e6c-fa69-414c-8c98-843705bd127d ::loggername=com.ibm.notes.roaming.provider.notesadapter
Starting application: 6951
osgi> Application Started: 10164
2019/08/11 21:26:15.299 SEVERE CWPST0081E: An error occurred while trying to locate the default login context. ::class.method=com.ibm.rcp.internal.security.auth.service.DefaultLoginContextService.getLoginContext() ::thread=main ::loggername=com.ibm.rcp.internal.security.auth.service
javax.security.auth.login.LoginException: No LoginModules configured for NOTES
at javax.security.auth.login.LoginContext.init(LoginContext.java:267)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:351)
at com.ibm.rcp.internal.security.auth.service.DefaultLoginContextService.getLoginContext(DefaultLoginContextService.java:119)
at com.ibm.rcp.security.auth.service.AbstractLoginService.login(AbstractLoginService.java:112)
at com.ibm.rcp.internal.security.auth.service.DefaultLoginContextService.login(DefaultLoginContextService.java:130)
at com.ibm.rcp.platform.personality.DefaultWorkbenchWindowAdvisor.doLogin(DefaultWorkbenchWindowAdvisor.java:2683)
at com.ibm.rcp.platform.personality.DefaultWorkbenchWindowAdvisor.postWindowCreate(DefaultWorkbenchWindowAdvisor.java:2079)
at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:680)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:966)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:151)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:118)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.inject(ContextInjectionFactory.java:73)
at org.eclipse.ui.internal.Workbench.createWorkbenchWindow(Workbench.java:1534)
at org.eclipse.ui.internal.Workbench.openWorkbenchWindow(Workbench.java:2662)
at com.ibm.rcp.platform.personality.e4.DefaultWBWRenderer.processContents(DefaultWBWRenderer.java:59)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:665)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:728)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:722)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1059)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at com.ibm.rcp.personality.framework.internal.RCPApplication.run(RCPApplication.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
2019/08/11 21:26:15.346 WARNING Keybinding conflicts occurred. They may interfere with normal accelerator operation. ::class.method=unknown ::thread=Thread-9 ::loggername=org.eclipse.ui.workbench
I just ran into this same error when using Eclipse to launch Notes 11.0. I believe it was an issue with the requires plugin dependencies. This is what I did to fix it:
upgraded to Notes 12.0
reloaded the JRE files (Prefs => Java => Installed JREs)
reloaded the plugins (Prefs => Plug-in Dev => Target Platform)
updated my VM argument variables as per the new values in \Notes\framework\rcp\rcplauncher.properties
install_id=1629781684647
rcp.base_version=10.0.0.20210507-1607
rcp.home=C:\Progra~2\IBM\Notes\framework
Reselect all run config plugins (edit Run Configuration => Plug-ins tab => Select All). I had previously set this as a subset to avoid duplicates/conflicts.
I hope this helps the next person!

Lagom and Kamon: Classloading errors

We are using Kamon to instrument all of our microservices, some of them use Lagom and other use akka-http.
Our Lagom microservices are using sbt-native-packager to create a zip file that, once unzipped, will run in our server.
Whereas the akka-http ones are using sbt-pack.
We suspect that sbt-native-packager introduces some classloader magic.
The JVM is running with the aspectj-weaver agent correctly loaded,
setting JAVA_OPTS with -javaagent:/path/to/aspectjweaver-1.9.1.jar
We use scala 2.11.12
but in all of our Lagom microservices we get the following error
Exception in thread "main" java.lang.NoSuchMethodError: kamon.scala.instrumentation.FutureInstrumentation.aspectOf()Lkamon/scala/instrumentation/FutureInstrumentation;
at scala.concurrent.impl.CallbackRunnable.<init>(Promise.scala:32)
at scala.concurrent.impl.Promise$DefaultPromise.onComplete(Promise.scala:273)
at akka.actor.ActorSystemImpl$TerminationCallbacks.<init>(ActorSystem.scala:1008)
at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:800)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:246)
at com.lightbend.lagom.scaladsl.server.ActorSystemProvider$.start(LagomApplicationLoader.scala:268)
at com.lightbend.lagom.scaladsl.server.LagomApplication.actorSystem$lzycompute(LagomApplicationLoader.scala:239)
at com.lightbend.lagom.scaladsl.server.LagomApplication.actorSystem(LagomApplicationLoader.scala:238)
at play.api.BuiltInComponents$class.materializer(Application.scala:327)
at play.api.BuiltInComponentsFromContext.materializer$lzycompute(ApplicationLoader.scala:122)
at play.api.BuiltInComponentsFromContext.materializer(ApplicationLoader.scala:122)
at com.lightbend.lagom.scaladsl.server.LagomServerComponents$class.lagomServerBuilder(LagomServer.scala:84)
at com.lightbend.lagom.scaladsl.server.LagomApplication.lagomServerBuilder$lzycompute(LagomApplicationLoader.scala:222)
at com.lightbend.lagom.scaladsl.server.LagomApplication.lagomServerBuilder(LagomApplicationLoader.scala:222)
at com.lightbend.lagom.scaladsl.server.LagomApplication.<init>(LagomApplicationLoader.scala:244)
at com.lightbend.lagom.scaladsl.server.LagomApplicationLoader.load(LagomApplicationLoader.scala:78)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:51)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:25)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
And this is another slightly different stacktrace
java.lang.NoSuchMethodError: kamon.logback.instrumentation.AsyncAppenderInstrumentation.aspectOf()Lkamon/logback/instrumentation/AsyncAppenderInstrumentation;
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:47)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.info(Logger.java:579)
at akka.event.slf4j.Slf4jLogger$$anonfun$receive$1.applyOrElse(Slf4jLogger.scala:92)
at akka.actor.Actor$class.aroundReceive(Actor.scala:517)
at akka.event.slf4j.Slf4jLogger.aroundReceive(Slf4jLogger.scala:54)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:590)
at akka.actor.ActorCell.invoke(ActorCell.scala:559)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Does anyone know why?
This is a project to show you the problem
https://github.com/ricsirigu/lagom-with-kamon

Unable to run Scala Play app throwing com.typesafe.config.ConfigException$Missing: No configuration setting found for key

I am trying run a Scala Play app and got this exception:
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'memo'
at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:152) ~[config-1.3.1.jar:na]
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170) ~[config-1.3.1.jar:na]
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184) ~[config-1.3.1.jar:na]
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189) ~[config-1.3.1.jar:na]
at com.typesafe.config.impl.SimpleConfig.getObject(SimpleConfig.java:264) ~[config-1.3.1.jar:na]
at com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:270) ~[config-1.3.1.jar:na]
at com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:37) ~[config-1.3.1.jar:na]
at lila.common.PlayApp$.loadConfig(PlayApp.scala:24) ~[na:na]
at lila.memo.Env$.lila$memo$Env$$$anonfun$1(Env.scala:28) ~[na:na]
at lila.common.Chronometer$.sync(Chronometer.scala:56) ~[na:na]
I put external reference to the configuration file such as :
run -Dconfig.resource=conf/base.conf
I am new to Scala.Tried to find out conifg-1.3.1-jar but unable to find out.Can you please suggest how to overcome this situation.
**In the base.conf there is configuration for the memo is present.
Try without conf/, run -Dconfig.resource=base.conf
From Play 2.6 docs
Using -Dconfig.resource
This will search for an alternative configuration file in the application classpath (you usually provide these alternative configuration files into your application conf/ directory before packaging). Play will look into conf/ so you don’t have to add conf/.
$ /path/to/bin/ -Dconfig.resource=prod.conf
Using -Dconfig.file
You can also specify another local configuration file not packaged into the application artifacts:
$ /path/to/bin/ -Dconfig.file=/opt/conf/prod.conf
If you are configuring an sbt task from Intellij you must quote the entire command.
"run -Dconfig.resource=prod.conf"

Play 2 Twitter authentication

I have a Play 2 web app where users can login using twitter (/authenticate/twitter). After some time after the server is started, the login no longer works and I receive:
Feb 17, 2015 8:22:10 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [play] in context with path [] threw exception [Servlet execution threw an exception] with root cause
java.util.concurrent.TimeoutException: This request was timed out after 60000 ms
at play.core.server.servlet25.Play2Servlet25RequestHandler.onFinishService(RequestHandler.scala:36)
at play.core.server.servlet.Play2GenericServletRequestHandler.apply(RequestHandler.scala:371)
at play.core.server.servlet.Play2WarServer$$anonfun$handleRequest$2.apply(Play2Server.scala:64)
at play.core.server.servlet.Play2WarServer$$anonfun$handleRequest$2.apply(Play2Server.scala:64)
at scala.Option.map(Option.scala:145)
at play.core.server.servlet.Play2WarServer$.handleRequest(Play2Server.scala:64)
at play.core.server.servlet.GenericPlay2Servlet.service(Play2CommonServlet.scala:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:680)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
I simply have no clue from where to start the investigation. If I restart the server login works fine for a while... Can you give a hint?
I am using SecureSocial for doing twitter authentication. Application is deployed on Elastic Beanstalk using Tomcat server.
What is your service doing? Have you tried taking a thread dump?
This is quite likely due to running on the servlet API - especially servlet 2.5. Play is an asynchronous framework, servlet 2.5 is completely synchronous. You're asking for trouble trying to run an asynchronous webapp in a synchronous web server. If I were you, I would use a platform that supports Play natively, such as Heroku.

GWT - java.security.AccessControlException: access denied for serializer in ubuntu/tomca6 deployment

I am trying to deploy my gwt app to tomcat6 under ubuntu 9.10 and get
the (i suppose known to many of you)
"java.security.AccessControlException: access denied" error (Full
exception can be found at the end). I have searched the net in general and found that the Java default security
permissions are preventing the serializer from accessing my classes
private members (they do have getters and setters) and that i should
add to tomcat policy with a file at /etc/tomcat6/policy.d/60gwt.policy
the following:
grant codeBase "file:/var/lib/tomcat6/webapps/-" {
permission java.security.AllPermission;
}
Although i have done that (and i understand the implications) i still
get the same error, no matter how many times i restart the server. The
next step would problably be to disable tomcats security manager
completely but this app will eventually go into production and i d
like to know what's going on here. Also, i'd rather not make any
member variables public...
Any ideas?
cheers
SEVERE: Exception while dispatching incoming RPC call
java.security.AccessControlException: access denied
(java.lang.reflect.ReflectPermission suppressAccessChecks)
at java.security.AccessControlContext.checkPermission
(AccessControlContext.java:323)
at java.security.AccessController.checkPermission
(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:
532)
at java.lang.reflect.AccessibleObject.setAccessible
(AccessibleObject.java:107)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali zeClass
(ServerSerializationStreamWriter.java:694)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali zeImpl
(ServerSerializationStreamWriter.java:730)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali zeClass
(ServerSerializationStreamWriter.java:712)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali zeImpl
(ServerSerializationStreamWriter.java:730)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali ze
(ServerSerializationStreamWriter.java:612)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.write Object
(AbstractSerializationStreamWriter.java:129)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter
$ValueWriter$8.write(ServerSerializationStreamWriter.java:152)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.seriali zeValue
(ServerSerializationStreamWriter.java:534)
at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:609)
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
(RPC.java:383)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
(RPC.java:581)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
(RemoteServiceServlet.java:188)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost
(RemoteServiceServlet.java:224)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost
(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:
269)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute
(SecurityUtil.java:301)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege
(SecurityUtil.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000
(ApplicationFilterChain.java:56)
at org.apache.catalina.core.ApplicationFilterChain$1.run
(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:185)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
454)
at java.lang.Thread.run(Thread.java:619)
Never mind, i solved the problem. I was actually using file:$
{catalina.base}webapps/- instead of file:/var/lib/tomcat6/webapps that
i wrote previously.Tomcat config in /etc/default/tomcat says that if
you don't set catalina.base then /var/lib/tomcat6/ is used by default
but...
Well anyway: GWT can not serialize this kind of exception because the type is not available in the emulated JRE library. So either you define it yourself via en supersource or you hande the exception on the server and make sure that you only throw supported exceptions.