Getting Runtime Access to Clojure version number - jar

From this so question I developed the code below. For now its only purpose (compiled as an uberjar) is to print its version number and exit.
; core.clj
(ns clojure-test-vnum.core
(:gen-class))
(defn implementation-version []
(-> (eval 'clojure-test-vnum.core) .getPackage .getImplementationVersion))
(defn -main
"I don't do a whole lot ... yet."
[& args]
;; work around dangerous default behaviour in Clojure
(alter-var-root #'*read-eval* (constantly false))
(println (implementation-version)))
;project.clj
(def version "0.1.0-SNAPSHOT")
(defproject clojure-test-vnum version
:manifest {"Implementation-Version" ~version}
:description "Test to see if I can get a version number from an uberjar."
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]]
:main clojure-test-vnum.core
:aot [clojure-test-vnum.core])
While this code compiles fine, I am getting a ClassNotFoundException at runtime. The problem seems to be with (eval 'clojure-test-vnum.core).
Following is the full stack trace:
Exception in thread "main" java.lang.ClassNotFoundException: clojure-test-vnum.core, compiling:(NO_SOURCE_PATH:0:0)
at clojure.lang.Compiler.analyze(Compiler.java:6380)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler.eval(Compiler.java:6623)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure_test_vnum.core$implementation_version.invoke(core.clj:5)
at clojure_test_vnum.core$_main.doInvoke(core.clj:14)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure_test_vnum.core.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure-test-vnum.core
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at clojure.lang.RT.classForName(RT.java:2070)
at clojure.lang.Compiler.resolveIn(Compiler.java:6855)
at clojure.lang.Compiler.resolve(Compiler.java:6818)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6779)
at clojure.lang.Compiler.analyze(Compiler.java:6343)
... 10 more
What am I doing wrong ?

You'll need to change
(eval 'clojure-test-vnum.core)
to
clojure_test_vnum.core
since the generated class will have underscores in its name in place of the hyphens in the name of the Clojure entity it is based on. No eval is necessary, the symbol will simply resolve to the class.

Related

how to pass empty string to a input element in katalon studio

I am doing automating the test cases for my web page using Katalon Studio. My problem is that I don't know how to pass or send an empty string to an input element, here I want my test case to fail so. I tried with set text and sendkeys keywords, getting following error
TC_2_testcase_for_fail-Copy FAILED because (of) (Stack trace:
groovy.lang.MissingPropertyException: No such property:
WebUiBuiltInKeywords for class: Script1539673712359 at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at Script1539673712359.run(Script1539673712359.groovy:33) at
com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:183) at
com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:108)
at
com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:294)
at
com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:285)
at
com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:264)
at
com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:256)
at
com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:200)
at
com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:99)
at
com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:90)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown
Source) at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
at TempTestCase1539675610128.run(TempTestCase1539675610128.groovy:22)
at
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
at groovy.lang.GroovyShell.run(GroovyShell.java:518) at
groovy.lang.GroovyShell.run(GroovyShell.java:507) at
groovy.ui.GroovyMain.processOnce(GroovyMain.java:653) at
groovy.ui.GroovyMain.run(GroovyMain.java:384) at
groovy.ui.GroovyMain.process(GroovyMain.java:370) at
groovy.ui.GroovyMain.processArgs(GroovyMain.java:129) at
groovy.ui.GroovyMain.main(GroovyMain.java:109) 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
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at
org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131) )
Simple, just send the empty string as a parameter:
WebUI.setText(findTestObject('Object Repository/input element'), '')

truthy doesn't work with sbt new

I've created a template project with giter8, and trying to add conditional expression.
in the defaults.properties I added:
param=true
and in the template file I added:
$if(param.truthy)$
....
$endif$
when I'm generating the project with:
g8 file://proj.g8
everything works as expected.
in the interactive part, param would have 2 options:
param [YES/no]:
and the generated file will include the additional text based on the value of the param
But, when I generate the project with:
sbt new file://proj.g8
param is being treated as a string.
during the interactive part, there are no yes/no options:
param [yes]:
and I'm getting the following error:
Exiting due to error in the template File:
/tmp/giter8-135496483100759/src/main/g8/build.sbt, context [anonymous]
44:6 internal error: org.stringtemplate.v4.compiler.STException:
context [anonymous] 44:6 no such property or can't access:
java.lang.String.truthy Caused by:
org.stringtemplate.v4.misc.STNoSuchPropertyException: no such
property: java.lang.String.truthy at
org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java:167)
at
org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:89)
at
org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1200)
at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210) at
org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145) at
org.stringtemplate.v4.ST.write(ST.java:427) at
org.stringtemplate.v4.ST.render(ST.java:497) at
org.clapper.scalasti.ST.render(ST.scala:285) at
giter8.G8$.applyTemplate(g8.scala:102) at
giter8.G8$.write(g8.scala:154) at giter8.G8$.write(g8.scala:138) at
giter8.G8$.$anonfun$writeTemplates$3(g8.scala:396) at
scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:242)
at scala.util.control.Exception$Catch.apply(Exception.scala:224) at
scala.util.control.Exception$Catch.opt(Exception.scala:242) at
giter8.G8$.$anonfun$writeTemplates$2(g8.scala:396) at
scala.collection.immutable.Stream.foreach(Stream.scala:530) at
giter8.G8$.writeTemplates(g8.scala:386) at
giter8.G8$.$anonfun$applyT$1(g8.scala:257) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.G8$.applyT(g8.scala:249) at
giter8.G8$.fromDirectory(g8.scala:62) at
giter8.JgitHelper$.$anonfun$run$3(JgitHelper.scala:64) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.JgitHelper$.run(JgitHelper.scala:63) at
giter8.Giter8.$anonfun$run$2(giter8.scala:34) at
scala.Option.map(Option.scala:146) at
giter8.Giter8.run(giter8.scala:33) at
sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
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
sbt.TemplateCommandUtil$.call(TemplateCommand.scala:100) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:78) at
sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:58) at
sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:54)
at
scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
at
scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
at scala.collection.immutable.List.find(List.scala:86) at
sbt.TemplateCommandUtil$.run(TemplateCommand.scala:54) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:41) at
sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:24)
at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134) at
sbt.Command$.$anonfun$applyEffect$2(Command.scala:130) at
sbt.MainLoop$.processCommand(MainLoop.scala:153) at
sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:136) at
sbt.State$$anon$1.runCmd$1(State.scala:242) at
sbt.State$$anon$1.process(State.scala:248) at
sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:136) at
sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
at sbt.MainLoop$.next(MainLoop.scala:136) at
sbt.MainLoop$.run(MainLoop.scala:129) at
sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:107) at
sbt.io.Using.apply(Using.scala:22) at
sbt.MainLoop$.runWithNewLog(MainLoop.scala:101) at
sbt.MainLoop$.runAndClearLast(MainLoop.scala:57) at
sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42) at
sbt.MainLoop$.runLogged(MainLoop.scala:34) at
sbt.StandardMain$.runManaged(Main.scala:113) at
sbt.xMain.run(Main.scala:76) at
xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) at
xsbt.boot.Launch$.withContextLoader(Launch.scala:128) at
xsbt.boot.Launch$.run(Launch.scala:109) at
xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35) at
xsbt.boot.Launch$.launch(Launch.scala:117) at
xsbt.boot.Launch$.apply(Launch.scala:18) at
xsbt.boot.Boot$.runImpl(Boot.scala:41) at
xsbt.boot.Boot$.main(Boot.scala:17) at
xsbt.boot.Boot.main(Boot.scala)
at giter8.G8$STErrorHandler.runTimeError(g8.scala:110) at
giter8.G8$STErrorHandler.runTimeError(g8.scala:105) at
org.stringtemplate.v4.misc.ErrorManager.runTimeError(ErrorManager.java:137)
at
org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1203)
at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210) at
org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145) at
org.stringtemplate.v4.ST.write(ST.java:427) at
org.stringtemplate.v4.ST.render(ST.java:497) at
org.clapper.scalasti.ST.render(ST.scala:285) at
giter8.G8$.applyTemplate(g8.scala:102) at
giter8.G8$.write(g8.scala:154) at giter8.G8$.write(g8.scala:138) at
giter8.G8$.$anonfun$writeTemplates$3(g8.scala:396) at
scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:242)
at scala.util.control.Exception$Catch.apply(Exception.scala:224) at
scala.util.control.Exception$Catch.opt(Exception.scala:242) at
giter8.G8$.$anonfun$writeTemplates$2(g8.scala:396) at
scala.collection.immutable.Stream.foreach(Stream.scala:530) at
giter8.G8$.writeTemplates(g8.scala:386) at
giter8.G8$.$anonfun$applyT$1(g8.scala:257) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.G8$.applyT(g8.scala:249) at
giter8.G8$.fromDirectory(g8.scala:62) at
giter8.JgitHelper$.$anonfun$run$3(JgitHelper.scala:64) at
scala.util.Either$RightProjection.flatMap(Either.scala:702) at
giter8.JgitHelper$.run(JgitHelper.scala:63) at
giter8.Giter8.$anonfun$run$2(giter8.scala:34) at
scala.Option.map(Option.scala:146) at
giter8.Giter8.run(giter8.scala:33) at
sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
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
sbt.TemplateCommandUtil$.call(TemplateCommand.scala:100) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:78) at
sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:58) at
sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:54)
at
scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
at
scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
at scala.collection.immutable.List.find(List.scala:86) at
sbt.TemplateCommandUtil$.run(TemplateCommand.scala:54) at
sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:41) at
sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:24)
at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134) at
sbt.Command$.$anonfun$applyEffect$2(Command.scala:130) at
sbt.MainLoop$.processCommand(MainLoop.scala:153) at
sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:136) at
sbt.State$$anon$1.runCmd$1(State.scala:242) at
sbt.State$$anon$1.process(State.scala:248) at
sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:136) at
sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
at sbt.MainLoop$.next(MainLoop.scala:136) at
sbt.MainLoop$.run(MainLoop.scala:129) at
sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:107) at
sbt.io.Using.apply(Using.scala:22) at
sbt.MainLoop$.runWithNewLog(MainLoop.scala:101) at
sbt.MainLoop$.runAndClearLast(MainLoop.scala:57) at
sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42) at
sbt.MainLoop$.runLogged(MainLoop.scala:34) at
sbt.StandardMain$.runManaged(Main.scala:113) at
sbt.xMain.run(Main.scala:76) at
xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) at
xsbt.boot.Launch$.withContextLoader(Launch.scala:128) at
xsbt.boot.Launch$.run(Launch.scala:109) at
xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35) at
xsbt.boot.Launch$.launch(Launch.scala:117) at
xsbt.boot.Launch$.apply(Launch.scala:18) at
xsbt.boot.Boot$.runImpl(Boot.scala:41) at
xsbt.boot.Boot$.main(Boot.scala:17) at
xsbt.boot.Boot.main(Boot.scala)
I'm using version 0.11.0-M3 for both g8 and sbt-giter8 plugin
How can I fix this problem?
EDIT: some more details:
I'm using sbt 1.1.1 (for both the g8 project and the sbt launcher on my machine)
I added the plugin in the g8 project in the file project/plugins.sbt with
addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.11.0-M3")
if I remove the truthy parts from the template, the project is generated correctly from sbt new
This issue been fixed in sbt 1.2.0
in order to fix, should use:
sbt -Dsbt.version=1.2.0 new file://proj.g8
The version of giter8 used internally for sbt new is fixed and adding sbt-giter8 plugin won't change it. sbt 1.1.1 uses sbt-giter8-resolver v0.1.3, which uses giter8 0.7.2 (which doesn't support conditionals).
You could update sbt-giter8-resolver, publish it locally and try to replace the default Giter8TemplatePlugin, but I think it's not worth it. Just use g8 directly until sbt gets updated.
There was an effort to support arbitrary giter8 version set in the template, but something went wrong and this feature has been reverted.

ClassCastException Runtime Error

I am trying to read website URLS, remove HTML tags, tokenize them, then put them for POS tagging.
It does all the above steps fine but breaks at the POS tagging. The error is coming from thePOSTagging class, anyone figured where I'm going wrong?
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
at POSTaggers.POSTagging.run(POSTagging.java:28)
at java.lang.Thread.run(Thread.java:744)
at Assignment2.Main.main(Main.java:40)
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:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
The error is quite straightforward, (you're casting a String to ArrayList in line 29 of POSTagging.java), but I can't see that happening.
What I do see is, you can't cast a Object array to a String array. You're doing:
taggers[0] = new OpenNLP((String[]) a.toArray());
Instead, use:
taggers[0] = new OpenNLP(a.toArray(new String[a.size()]));

JavaFx TableView error

I am new to JavaFX. I am working with TableView and trying to put data entered by the user from the fields Username and Password into the table. Its just a testing program. I am getting the error below.
SEVERE: javafx.scene.control.Control loadSkinClass Failed to load skin 'StringProperty [bean: TableRow[id=null, styleClass=cell indexed-cell table-row-cell], name: skinClassName, value: com.sun.javafx.scene.control.skin.TableRowSkin]' for control TableRow[id=null, styleClass=cell indexed-cell table-row-cell]
java.lang.ClassCastException: javafx.scene.control.TableColumn cannot be cast to javafx.scene.control.TableColumn$CellDataFeatures
at javafx.scene.control.cell.PropertyValueFactory.call(PropertyValueFactory.java:93)
at com.sun.javafx.scene.control.skin.TableRowSkin.recreateCells(TableRowSkin.java:224)
at com.sun.javafx.scene.control.skin.TableRowSkin.<init>(TableRowSkin.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at javafx.scene.control.Control.loadSkinClass(Control.java:992)
at javafx.scene.control.Control.access$500(Control.java:71)
at javafx.scene.control.Control$12.invalidated(Control.java:920)
at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:127)
at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:161)
at com.sun.javafx.css.StyleableStringProperty.set(StyleableStringProperty.java:71)
at javafx.scene.control.Control$12.set(Control.java:912)
at com.sun.javafx.css.StyleableStringProperty.applyStyle(StyleableStringProperty.java:59)
at com.sun.javafx.css.StyleableStringProperty.applyStyle(StyleableStringProperty.java:31)
at com.sun.javafx.css.StyleableProperty.set(StyleableProperty.java:70)
at com.sun.javafx.css.StyleHelper.transitionToState(StyleHelper.java:902)
at javafx.scene.Node.impl_processCSS(Node.java:7415)
at javafx.scene.Parent.impl_processCSS(Parent.java:1146)
at javafx.scene.control.Control.impl_processCSS(Control.java:1102)
at com.sun.javafx.scene.control.skin.VirtualFlow.setCellIndex(VirtualFlow.java:1598)
at com.sun.javafx.scene.control.skin.VirtualFlow.getCell(VirtualFlow.java:1500)
at com.sun.javafx.scene.control.skin.VirtualFlow.getCellLength(VirtualFlow.java:1523)
at com.sun.javafx.scene.control.skin.VirtualFlow$3.call(VirtualFlow.java:478)
at com.sun.javafx.scene.control.skin.VirtualFlow$3.call(VirtualFlow.java:476)
at com.sun.javafx.scene.control.skin.PositionMapper.computeViewportOffset(PositionMapper.java:143)
at com.sun.javafx.scene.control.skin.VirtualFlow.layoutChildren(VirtualFlow.java:1001)
at javafx.scene.Parent.layout(Parent.java:1018)
at javafx.scene.Parent.layout(Parent.java:1028)
at javafx.scene.Parent.layout(Parent.java:1028)
at javafx.scene.Parent.layout(Parent.java:1028)
at javafx.scene.Scene.layoutDirtyRoots(Scene.java:513)
at javafx.scene.Scene.doLayoutPass(Scene.java:484)
at javafx.scene.Scene.access$3900(Scene.java:169)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2199)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:363)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460)
at com.sun.javafx.tk.quantum.QuantumToolkit$9.run(QuantumToolkit.java:329)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
at java.lang.Thread.run(Thread.java:722)
For some additional info. I was getting the same exception. What I found is that I needed to call the "setCellValueFactory" method when setting up the TableColumn instances. I was mistakenly calling "setCellFactory".
You may try the below link it works fine. For Further assistance you have to provide code.
Populate a tableview using database in JavaFX
Since you're specifying how to populate the values of the column, make sure to use the setCellValueFactory method.

Reflecting Assemblies on Mono for Android

I'm creating an app "plugin" dll that loads at run-time for my Mono for Android App and starts a new Activity. (the app will be installed ad-hoc - so no comments on downloading executable code)
I'm coming from Obj-C on iOS - where you can include .nibs and ViewControllers in a library.
I can have the main Android app and the loaded dll both reference another common dll, and load objects just fine.
The following works:
var test = plugin.CreateInstance("Test.Satellite.testClass");
MethodInfo getString = test.GetType().GetMethod("getString");
MethodInfo tryPatient = test.GetType().GetMethod("tryPatient");
Where
public class testClass
{
public string getString ()
{
return "This was read from the object";
}
public string tryPatient ()
{
Patient p = new Patient();
p.Name = "This was created from the Core/Common DLL";
return p.Name;
}
}
However, when I try to load an Activity (either through CreateInstance or Intent/StartActivity) it gives the following exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: test.satellite.RootActivity
at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00087] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:275
at Android.Runtime.JNIEnv.FindClass (System.Type type) [0x00009] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:233
--- End of managed exception stack trace ---
java.lang.NoClassDefFoundError: test.satellite.RootActivity
at test.MainActivity.n_onCreate(Native Method)
at test.MainActivity.onCreate(MainActivity.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: test.satellite.RootActivity in loader dalvik.system.PathClassLoader#44e8c678
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
... 15 more
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x000e0, 0x00670>
at System.Reflection.MethodBase.Invoke (object,object[]) <IL 0x00006, 0x0008f>
at Test.MainActivity.OnCreate (Android.OS.Bundle) [0x001e9] in /Users/stephen/Projects/test/test/MainActivity.cs:86
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.App.Activity.cs:1490
at (wrapper dynamic-method) object.ca46b703-b14e-4853-b371-499ea96364fc (intptr,intptr,intptr) <IL 0x00012, 0x00033>
What I can read from that is that the Dalvik can't find the class test.satellite.RootActivity - but it found test.satellite.testClass just fine...?
Any help would be appreciated.
It looks like you are inconsistent about the casing of packages. Might that be the problem?
"Test.Satellite.testClass" -- works
"test.satellite.RootActivity" -- doesn't work

Resources