I am trying to run scalatra with sbt using container:start command but i get "assertion failed: No lifecycle class found!" message , this is the full stack trace i got with "last container:start" :
Blockquote
last container:restart
java.lang.AssertionError: assertion failed: No lifecycle class found!
at scala.Predef$.assert(Predef.scala:179)
at org.scalatra.servlet.ScalatraListener.probeForCycleClass(ScalatraListener.scala:50)
at org.scalatra.servlet.ScalatraListener.configureCycleClass(ScalatraListener.scala:64)
at org.scalatra.servlet.ScalatraListener.contextInitialized(ScalatraListener.scala:23)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:446)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:792)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:296)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1359)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1352)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:154)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125)
at org.eclipse.jetty.server.Server.start(Server.java:358)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
at org.eclipse.jetty.server.Server.doStart(Server.java:325)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.earldouglas.xsbtwebplugin.Jetty9Runner.start(Jetty9Runner.scala:122)
at com.earldouglas.xsbtwebplugin.Container$$anonfun$containerSettings$11.apply(Container.scala:77)
at com.earldouglas.xsbtwebplugin.Container$$anonfun$containerSettings$11.apply(Container.scala:74)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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)
[error] (container:restart) java.lang.AssertionError: assertion failed: No lifecycle class found!
Blockquote
This is my LifeCycle file is called :"ScalatraBootstrap.scala" and it's content is:
import org.Server.Controllers.Controller2
import org.scalatra.example.Server._
import org.scalatra.LifeCycle
import javax.servlet.ServletContext
class ScalatraBootstrap extends LifeCycle {
implicit val swagger = new FlowSwagger
override
def init(context: ServletContext) {
context.mount(new Controller1, "/*") context.mount(new Controller2, "/string1/*") context.mount(new Controller3, "/string2/*")
}
}
ScalatraBootstrap.scala should be in top package without any package name.
remove any package declerations you have in the ScalatraBootstrap.scala file.
You may put the bootstrap class in the top, nameless package or set the relevant context parameter like this:
context.setInitParameter(ScalatraListener.LifeCycleKey,
"my.package.MyScalatraBootstrap")
In scalatra you need to have a class extending LifeCycle. Here's an example from the docs
Note that there is also a file called Scalatra.scala in your src/main/scala directory. This is the Scalatra bootstrap config file, and it's where you should do most of your app configuration work.
The simplest version of this file, which gets generated when you make a new project using the giter8 template, looks something like this:
import org.scalatra.LifeCycle
import javax.servlet.ServletContext
import org.yourdomain.projectname._
class ScalatraBootstrap extends LifeCycle {
override def init(context: ServletContext) {
// mount servlets like this:
context mount (new ArticlesServlet, "/articles/*")
}
}
Old question, but as I just got the same issue No lifecycle class found and the previous responses didn't solve it, here's what did:
The solution for my case was simple. I had placed the ScalatraBootstrap.scala to src/main, no errors were given by IntelliJ. The correct path is src/main/scala. This is also shown in the Scalatra project structure page, but the formatting might cause one to place it in the wrong spot. src/main/scala/ScalatraBootstrap.scala works perfectly.
Related
I am using jmockit:1.20, junit:4.12 with JDK11. Earlier it was workign with Java 8 but now its not.
The test class is:
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import mockit.Deencapsulation;
import mockit.Expectations;
import mockit.Mocked;
import mockit.StrictExpectations;
import mockit.Tested;
import mockit.integration.junit4.JMockit;
#RunWith(JMockit.class)
public class FlywayHelperTest
{
Exception:
java.lang.Exception: Method XXX_catch_throw_UpgradeException should have no parameters
at org.junit.runners.model.FrameworkMethod.validatePublicVoidNoArg(FrameworkMethod.java:76)
at org.junit.runners.ParentRunner.validatePublicVoidNoArgMethods(ParentRunner.java:155)
at org.junit.runners.BlockJUnit4ClassRunner.validateTestMethods(BlockJUnit4ClassRunner.java:208)
at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:188)
at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128)
at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65)
at mockit.integration.junit4.JMockit.<init>(JMockit.java:30)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
I have tried 2 options but still not solved:
1. Jmockit dependency before junit.
2. Added below filter in build.gradle
test {
useJUnitPlatform()
filter {
exclude '**/module-info.class'
}
}
As pointed out by Alan, you can upgrade your jmockit version to the latest release
compile 'org.jmockit:jmockit:1.44'
To be precise jmockit became compatible with JDK9 and modules with release version 1.23.
I am trying to use DI to inject a webservice client in my application. I get runtime exception as i refer current application in the object being injected. Below is the skeletal of my code.
**import play.api.Play.Current**
#Singleton
class MicorServiceClient#Inject()(ws: WSclient) {
// References curret.configuraiton.getString(
....
}
class Application #Inject()(microServiceClient: MicorServiceClient) extends Controller {
def someMethod= Action {
//Calls the micorservicelient.getResponse()
}
}
I see following error when my api is called.
#709lj5bmd: Unexpected exception
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:170)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:126)
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:126)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:124)
at scala.util.Success.flatMap(Try.scala:231)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:124)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:116)
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:1689)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.RuntimeException: There is no started application
Ah, solved the issue, i need to pass play.api.Configuration to the Client and remove the references to current
so my MicroServiceClient definition looks like below
class MicroServiceClient(ws: WSclient, configuration: play.api.Configuration) {
}
I am writing a Scalafx application using FXML for the views with the scalafxml library. I am having a ton of trouble getting the classes to compile when using the #sfxml annotation on controller classes. When using them, I keep getting NoSuchMethodExceptions on my constructors as if I have no default constructor but this is definitely not the case. I have been studying this so much that I can only conclude that the problem must be with the library itself. I have followed any information on it as best I know how.
The controller is for creating a form for the user. Since the "IllegalArgumentException" will be thrown if I try to set the root node's scene twice, I use the root node's id in my constructor for purposes of avoiding the exception.
Any help is much appreciated. Thanks.
My code:
#sfxml
class ToolbarController(private val rootLayout: BorderPane) {
val parent = calcParent
import javafx.application.Platform
def newForm = {
new JFXPanel()
Platform.runLater(new Runnable() {
override def run() {
val dialogStage = new Stage {
scene = new Scene(parent) {
stylesheets = List(getClass.getResource("/scala/css/form.css").toExternalForm)
}
}
dialogStage.show()
}
})
}
def calcParent: Parent = {
val resource = getClass.getResource("scala/form.fxml")
if(rootLayout.scene == null)
FXMLView(resource, NoDependencyResolver)
else rootLayout.getParent
}
}
The FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane id="rootLayout"maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="FormController">
<center>...
And my stack trace:
Exception in Application start method
Workaround until RT-13281 is implemented: keep toolkit alive
[error] (run-main-0) java.lang.RuntimeException: Exception in Application start method
java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
at com.sun.javafx.application.LauncherImpl$$Lambda$11/1268584418.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: javafx.fxml.LoadException:
/Users/patrickslagle/scala/MyApps/PattyCakes/target/scala-2.11/classes/scala/calendar.fxml:7
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2605)
at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:104)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:928)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:967)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:216)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2711)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2531)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2445)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3218)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3179)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3152)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3128)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3108)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3101)
at Calendar$.delayedEndpoint$Calendar$1(Calendar.scala:15)
at Calendar$delayedInit$body.apply(Calendar.scala:9)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
at scala.collection.immutable.List.foreach(List.scala:383)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
at scalafx.application.JFXApp$class.init(JFXApp.scala:297)
at Calendar$.init(Calendar.scala:9)
at scalafx.application.AppHelper.start(AppHelper.scala:33)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$62/2116169040.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$58/1458556428.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$60/778909025.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$59/1397409682.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.InstantiationException: controller.ToolbarController
at java.lang.Class.newInstance(Class.java:427)
at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:923)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:967)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:216)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2711)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2531)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2445)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3218)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3179)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3152)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3128)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3108)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3101)
at Calendar$.delayedEndpoint$Calendar$1(Calendar.scala:15)
at Calendar$delayedInit$body.apply(Calendar.scala:9)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
at scala.collection.immutable.List.foreach(List.scala:383)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
at scalafx.application.JFXApp$class.init(JFXApp.scala:297)
at Calendar$.init(Calendar.scala:9)
at scalafx.application.AppHelper.start(AppHelper.scala:33)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$62/2116169040.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$58/1458556428.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$60/778909025.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$59/1397409682.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.NoSuchMethodException: controller.ToolbarController.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:923)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:967)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:216)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2711)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2531)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2445)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3218)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3179)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3152)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3128)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3108)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3101)
at Calendar$.delayedEndpoint$Calendar$1(Calendar.scala:15)
at Calendar$delayedInit$body.apply(Calendar.scala:9)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:297)
at scala.collection.immutable.List.foreach(List.scala:383)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
at scalafx.application.JFXApp$class.init(JFXApp.scala:297)
at Calendar$.init(Calendar.scala:9)
at scalafx.application.AppHelper.start(AppHelper.scala:33)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$62/2116169040.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$58/1458556428.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$60/778909025.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$59/1397409682.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
[trace] Stack trace suppressed: run last pattycakes/compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last pattycakes/compile:run for the full output.
[error] (pattycakes/compile:run) Nonzero exit code: 1
[error] Total time: 46 s, completed May 26, 2016 4:18:42 PM
You should not instantiate a class annotated with #fxml directly. This class is modified by the SFXML compiler macro. It is not shown in the code you posted but somewhere you must instantiate ToolbarController to call newForm. Posting Minimal, Complete, and Verifiable example is very important.
Attempting to directly instantiate ToolbarController is the most likely cause of the NoSuchMethodExceptions as ToolbarController constructor is modified by the macro. You need to move methods newForm and calcParent outside of ToolbarController. Only instantiate ToolbarController using FXMLView(resource, ...). You also need to add a reference to ToolbarControllerin the FXML file in the top pane:
<BorderPane ... fx:controller="mypackage.ToolbarController"> ...
With that the FXMLView can instantiate ToolbarController using only reference to the FXML file. For instance, the instantiation could look like this:
import java.io.IOException
import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafxml.core.{NoDependencyResolver, FXMLView}
object MyFXMLDemo extends JFXApp {
val resource = getClass.getResource("/scala/css/form.css")
if (resource == null) {
throw new IOException("Cannot load resource: /scala/css/form.css")
}
val root = FXMLView(resource, NoDependencyResolver)
stage = new PrimaryStage() {
scene = new Scene(root)
}
}
Please take look carefully at the example at https://github.com/vigoo/scalafxml-unit-converter-example.
I am trying to use tminglei/slick-pg v9.0.0 with slick 3.0.0 and am getting an IllegalAccessException:
akka.actor.ActorInitializationException: exception during creation
at akka.actor.ActorInitializationException$.apply(Actor.scala:166) ~[akka-actor_2.11-2.3.11.jar:na]
...
Caused by: java.lang.RuntimeException: driverClassName specified class 'com.github.tminglei.MyPostgresDriver$' could not be loaded
at com.zaxxer.hikari.AbstractHikariConfig.setDriverClassName(AbstractHikariConfig.java:370) ~[HikariCP-java6-2.3.8.jar:na]
at slick.jdbc.HikariCPJdbcDataSource$$anonfun$forConfig$18.apply(JdbcDataSource.scala:145) ~[slick_2.11-3.0.0.jar:na]
at slick.jdbc.HikariCPJdbcDataSource$$anonfun$forConfig$18.apply(JdbcDataSource.scala:145) ~[slick_2.11-3.0.0.jar:na]
at scala.Option.map(Option.scala:146) ~[scala-library-2.11.7.jar:na]
at slick.jdbc.HikariCPJdbcDataSource$.forConfig(JdbcDataSource.scala:145) ~[slick_2.11-3.0.0.jar:na]
at slick.jdbc.HikariCPJdbcDataSource$.forConfig(JdbcDataSource.scala:135) ~[slick_2.11-3.0.0.jar:na]
at slick.jdbc.JdbcDataSource$.forConfig(JdbcDataSource.scala:35) ~[slick_2.11-3.0.0.jar:na]
at slick.jdbc.JdbcBackend$DatabaseFactoryDef$class.forConfig(JdbcBackend.scala:223) ~[slick_2.11-3.0.0.jar:na]
at slick.jdbc.JdbcBackend$$anon$3.forConfig(JdbcBackend.scala:33) ~[slick_2.11-3.0.0.jar:na]
...
Caused by: java.lang.IllegalAccessException: Class com.zaxxer.hikari.AbstractHikariConfig can not access a member of class com.github.tminglei.MyPostgresDriver$ with modifiers "private"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109) ~[na:1.7.0_79]
at java.lang.Class.newInstance(Class.java:373) ~[na:1.7.0_79]
at com.zaxxer.hikari.AbstractHikariConfig.setDriverClassName(AbstractHikariConfig.java:366) ~[HikariCP-java6-2.3.8.jar:na]
... 43 common frames omitted
HikariCP is the default connection pool in slick 3.0.0
I have defined the driver class much like in the example:
trait MyPostgresDriver extends ExPostgresDriver with PgArraySupport
with PgEnumSupport
with PgRangeSupport
with PgHStoreSupport
with PgSearchSupport{
override val api = new MyAPI {}
//////
trait MyAPI extends API
with ArrayImplicits
with RangeImplicits
with HStoreImplicits
with SearchImplicits
with SearchAssistants
}
object MyPostgresDriver extends MyPostgresDriver
My database config is pretty straightforward [excerpt of typesafe config follows]:
slick.dbs.default {
driver="com.github.tminglei.MyPostgresDriver$"
db {
driver="org.postgresql.Driver"
url="jdbc:postgresql://hostname:port/dbname"
user=user
password="pass"
}
}
It does not seem as if it should not work, and yet...
Should I change my driver class somehow? Is it something else?
Note: as can be seen in the stacktrace I am using
Java 1.7.0_79
Scala 2.11.7
akka 2.3.11 (I share the config instance for slick and akka)
slick 3.0.0
HikariCP-java6 2.3.8
tminglei's slick-pg_core 0.9.0
Lastly, when debugging thru the jdk code at Class.class (decompiled line 143)
Constructor tmpConstructor1 = this.cachedConstructor;
I get the following (toString'ed) value (as shown by intellij):
private com.github.tminglei.MyPostgresDriver$()
Could this be indicative of the problem? If so how should I fix it?
EDIT
I have replaced the custom driver configuration with the stock PostgresDriver like so:
slick.dbs.default {
driver="slick.driver.PostgresDriver$"
db {
driver="org.postgresql.Driver"
url="jdbc:postgresql://hostname:port/dbname"
user=user
password="pass"
}
}
The error is the same:
akka.actor.ActorInitializationException: exception during creation
...
Caused by: java.lang.RuntimeException: driverClassName specified class 'slick.driver.PostgresDriver$' could not be loaded
...
Caused by: java.lang.IllegalAccessException: Class com.zaxxer.hikari.AbstractHikariConfig can not access a member of class slick.driver.PostgresDriver$ with modifiers "private"
I had a similar problem.
I think you are using Database.forConfig("slick.dbs.default") but your config file is in DatabaseConfig format.
Instead, try using:
val dbConfig: DatabaseConfig[PostgresDriver] = DatabaseConfig.forConfig("slick.dbs.default")
val db = dbConfig.db
Been upgrading our Glassfish app from scala 2.9 to 2.10 and I'm seeing JAXB trying to export private[this] methods as part of the web service.
For instance, here is a method signature, it's not even annotated.
private[this] def createFreeSubscription(user: User, plan: Plan): Option[UpdateResponseDO] = {}
Is there a change in 2.10 that would allow JAXB to think this should not be hidden?
Here is the error.
[#|2013-04-22T20:46:39.186-0600|SEVERE|glassfish3.1.2|javax.enterprise.webservices.org.glassfish.webservices|_ThreadID=112;_ThreadName=Thread-7;|Cannot initialize endpoint : error is :
com.sun.xml.ws.spi.db.DatabindingException: java.lang.RuntimeException: This version of JAXB might not be supported: proxy object creation failed, probably due to failing constructor method
at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:101)
at com.sun.xml.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:182)
at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:213)
at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:186)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:186)
at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:111)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:318)
at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:99)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:130)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:433)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:268)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:145)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:569)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:552)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:623)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.prepareInvocation(EjbRuntimeEndpointInfo.java:271)
at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:116)
at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:91)
at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:200)
at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:384)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: This version of JAXB might not be supported: proxy object creation failed, probably due to failing constructor method
at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxy.createProxy(JaxbContextProxy.java:55)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:111)
at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:113)
at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:89)
... 45 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor120.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextFactory.buildContext(JaxbContextFactory.java:31)
at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxyHandler.buildContext(JaxbContextProxyHandler.java:133)
at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxyHandler.<init>(JaxbContextProxyHandler.java:103)
at org.zeroturnaround.jrebel.jaxb.proxy.JaxbContextProxy.createProxy(JaxbContextProxy.java:46)
... 50 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
scala.collection.Seq is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at scala.collection.Seq
at public final scala.collection.Seq scala.util.matching.Regex.scala$util$matching$Regex$$groupNames
at scala.util.matching.Regex
at public scala.util.matching.Regex com.gaiam.gcsi.ws.jaxws.CouponRegexResponse._return
at com.gaiam.gcsi.ws.jaxws.CouponRegexResponse
com.gaiam.gcsis.system.AuthorizationSystem$ServiceStatus is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at com.gaiam.gcsis.system.AuthorizationSystem$ServiceStatus
at public com.gaiam.gcsis.system.AuthorizationSystem$ServiceStatus com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$statusToAuthCode.arg0
at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$statusToAuthCode
Two classes have the same XML type name "{http://gaiam.com/gcsi}option". Use #XmlType.name and #XmlType.namespace to assign different names to them.
this problem is related to the following location:
at scala.Option
at public scala.Option com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$getPurchasingOptionsResponse._return
at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$getPurchasingOptionsResponse
this problem is related to the following location:
at fj.data.Option
at public fj.data.Option com.gaiam.gcsi.entities.user.User.getEmail()
at com.gaiam.gcsi.entities.user.User
at public com.gaiam.gcsi.entities.user.User com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$createFreeSubscription.arg0
at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$createFreeSubscription
Two classes have the same XML type name "{http://gaiam.com/gcsi}state". Use #XmlType.name and #XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.gaiam.gcsi.entities.order.Order$State
at public com.gaiam.gcsi.entities.order.Order$State com.gaiam.gcsis.ws.dto.OrderInfoDO.getOrderState()
at com.gaiam.gcsis.ws.dto.OrderInfoDO
at public com.gaiam.gcsis.ws.dto.OrderInfoDO com.gaiam.gcsi.ws.jaxws.GetOrderInfoResponse.orderInfo
at com.gaiam.gcsi.ws.jaxws.GetOrderInfoResponse
this problem is related to the following location:
at com.gaiam.gcsi.entities.user.PaymentSource$State
at public com.gaiam.gcsi.entities.user.PaymentSource$State com.gaiam.gcsi.entities.user.PaymentSource.getState()
at com.gaiam.gcsi.entities.user.PaymentSource
at com.gaiam.gcsi.entities.user.CreditCard
at public com.gaiam.gcsi.entities.user.CreditCard com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$guessBillingAddress.arg0
at com.gaiam.gcsi.ws.jaxws.Com$gaiam$gcsi$ws$ClubSiteGateway$$guessBillingAddress
at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
... 57 more
Use #XmlTransient to exclude fields, methods or classes from mapping.