Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Build a JavaFX Application Build a Pomodoro App Build the State Change Events

"Attribute OnAction is not allowed here" is what intelij says for the button

This line of code: <Button fx:id="DEBUG" OnAction="#DEBUG">DEBUG</Button> causes the "OnActtion" to be in red with an error message saying "Attribute OnAction is not allowed here" . If I ignore this error and try to run debug anyway I get this crash (see end of this message)

But the important line seems to be: Caused by: java.lang.IllegalArgumentException: Unable to coerce #DEBUG to interface javafx.event.EventHandler.

If I remove the OnAction attribute, the code compiles and runs perfectly, but of course there is no debugger hook, as the button does nothing in that case.

I am running debian with jdk1.8.0_101. "java -version" says java version "1.8.0_101"

Please help I am totally blocked.

Here is the crash I get if I try to debug with the onaction attribute, ignoring the error message:

/usr/local/lib/jvm/jdk1.8.0_101/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:40612,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath /usr/local/lib/jvm/jdk1.8.0_101/jre/lib/charsets.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/deploy.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/cldrdata.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/dnsns.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/jaccess.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/jfxrt.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/localedata.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/nashorn.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/sunec.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/sunjce_provider.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/sunpkcs11.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/ext/zipfs.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/javaws.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/jce.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/jfr.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/jfxswt.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/jsse.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/management-agent.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/plugin.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/resources.jar:/usr/local/lib/jvm/jdk1.8.0_101/jre/lib/rt.jar:/home/pelliott-jessie-amd64/tmp/pomo/project/s3v1/out/production/Pomodoro:/home/pelliott/bin/intellij/idea-IC-162.2032.8/lib/idea_rt.jar com.teamtreehouse.pomodoro.Main Connected to the target VM, address: '127.0.0.1:40612', transport: 'socket' Exception in Application start method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: 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$155(LauncherImpl.java:182) at java.lang.Thread.run(Thread.java:745) Caused by: javafx.fxml.LoadException: /home/pelliott/tmp/pomo/project/s3v1/out/production/Pomodoro/fxml/home.fxml:15

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at com.teamtreehouse.pomodoro.Main.start(Main.java:16)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
... 1 more

Caused by: java.lang.IllegalArgumentException: Unable to coerce #DEBUG to interface javafx.event.EventHandler. at com.sun.javafx.fxml.BeanAdapter.coerce(BeanAdapter.java:496) at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:258) at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:54) at javafx.fxml.FXMLLoader$Element.applyProperty(FXMLLoader.java:512) at javafx.fxml.FXMLLoader$Element.processValue(FXMLLoader.java:363) at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:325) at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:235) at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:767) at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532) ... 17 more Exception running application com.teamtreehouse.pomodoro.Main Disconnected from the target VM, address: '127.0.0.1:40612', transport: 'socket'

Process finished with exit code 1

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Paul Elliott

I just realized that the only way to delete a question, only if no one answered it, comments to main questions are OK, they don't play role.

So I'd just deleted all my answers, and if you delete yours, I think the by pressing '***' button you will be able to delete question.

Or you can e-mail to support, and they will do it if you want for you. I just did, it worked

3 Answers

OK please clone https://github.com/pelliott80/pomo-s3v1 This code exhibits the problem I have been referring to. In addition, the root directory contains "onaction.jpg" which is a screenshot of the problem. Perhaps the bug will not exhibit itself on your system. It may be a write once debug everywhere bug.

Ok, I got it working thanks to your help. Sometines people are just blind. I don't know why I did not see that capital "O". One thing about that video, though. I could not hear any sound. Sometimes if you use the wrong video format, Linux users can't hear any sound. YouTube has some docs about maximum portability of a your tube video.

Please delete this question, it represents momentary blindness on my part.