TestNG, JavaFX Intellij An error occurred while instantiating class, Unable to make public <test class> accessible - javafx

I tried to call the test class programmatically and follow the instructor in the TestNG docs. When i called it in Eclipse, it worked, but when i switch to Intellij to be more convenient to use JavaFX so that i can make a UI program, it doesn't work and show this error.
This is my test call class
package com.vinh.testing.CallTest;
import org.testng.TestListenerAdapter;
import org.testng.TestNG;
import tests.LogOutTest;
public class TestLogOutCall {
public void callLogOutTest() {
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { LogOutTest.class });
testng.addListener(tla);
testng.run();
}
}
and this is my test class
package tests;
import static io.restassured.RestAssured.*;
import static org.testng.Assert.assertNotEquals;
import org.testng.annotations.Test;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
public class LogOutTest {
String ACCESS_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hdWN0aW9uLWFwcDMuaGVyb2t1YXBwLmNvbVwvYXBpXC9sb2dpbiIsImlhdCI6MTY1NTUzNzg2OSwiZXhwIjoxNjU1ODk3ODY5LCJuYmYiOjE2NTU1Mzc4NjksImp0aSI6InJuejdrMHhSQmNUTHB2TnkiLCJzdWIiOjY1LCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.sX-pWrwDyGfCIhlqy_1huxTt3GSElXrQtnpKV53q4BM";
#Test
public void Test01() {
baseURI = "https://auction-app3.herokuapp.com/api";
Response response = given().
header("Authorization", "bearer" + ACCESS_TOKEN).
contentType("application/json").
when().
post("/logout");
response.then().statusCode(200);
System.out.println(response.getBody().asString());
JsonPath jpath = response.jsonPath();
int code = jpath.getInt("code");
System.out.println(code);
assertNotEquals(code, 1000);
}
}
and then i met this
C:\Users\Lenovo\.jdks\openjdk-18.0.1.1\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1.1\lib\idea_rt.jar=50009:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-controls\18\javafx-controls-18.jar;C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-graphics\18\javafx-graphics-18.jar;C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-base\18\javafx-base-18.jar;C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-fxml\18\javafx-fxml-18.jar;C:\Users\Lenovo\.m2\repository\org\apache\groovy\groovy\4.0.1\groovy-4.0.1.jar;C:\Users\Lenovo\.m2\repository\org\apache\groovy\groovy-xml\4.0.1\groovy-xml-4.0.1.jar;C:\Users\Lenovo\.m2\repository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;C:\Users\Lenovo\.m2\repository\org\apache\httpcomponents\httpcore\4.4.13\httpcore-4.4.13.jar;C:\Users\Lenovo\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\Lenovo\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\Lenovo\.m2\repository\org\apache\httpcomponents\httpmime\4.5.13\httpmime-4.5.13.jar;C:\Users\Lenovo\.m2\repository\org\hamcrest\hamcrest\2.1\hamcrest-2.1.jar;C:\Users\Lenovo\.m2\repository\org\ccil\cowan\tagsoup\tagsoup\1.2.1\tagsoup-1.2.1.jar;C:\Users\Lenovo\.m2\repository\org\apache\groovy\groovy-json\4.0.1\groovy-json-4.0.1.jar;C:\Users\Lenovo\.m2\repository\io\rest-assured\rest-assured-common\5.1.1\rest-assured-common-5.1.1.jar;C:\Users\Lenovo\.m2\repository\io\rest-assured\xml-path\5.1.1\xml-path-5.1.1.jar;C:\Users\Lenovo\.m2\repository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;C:\Users\Lenovo\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Lenovo\.m2\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;C:\Users\Lenovo\.m2\repository\com\beust\jcommander\1.82\jcommander-1.82.jar;C:\Users\Lenovo\.m2\repository\org\webjars\jquery\3.6.0\jquery-3.6.0.jar;C:\Users\Lenovo\.m2\repository\junit\junit\4.10\junit-4.10.jar;C:\Users\Lenovo\.m2\repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar -p D:\Testing\target\classes;C:\Users\Lenovo\.m2\repository\org\testng\testng\7.6.0\testng-7.6.0.jar;C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-base\18\javafx-base-18-win.jar;C:\Users\Lenovo\.m2\repository\org\apache\commons\commons-lang3\3.11\commons-lang3-3.11.jar;C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-fxml\18\javafx-fxml-18-win.jar;C:\Users\Lenovo\.m2\repository\io\rest-assured\json-path\5.1.1\json-path-5.1.1.jar;C:\Users\Lenovo\.m2\repository\io\rest-assured\rest-assured\5.1.1\rest-assured-5.1.1.jar;C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-graphics\18\javafx-graphics-18-win.jar;C:\Users\Lenovo\.m2\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;C:\Users\Lenovo\.m2\repository\org\openjfx\javafx-controls\18\javafx-controls-18-win.jar;C:\Users\Lenovo\.m2\repository\org\controlsfx\controlsfx\11.1.1\controlsfx-11.1.1.jar -m com.vinh.testing/com.vinh.testing.AutomationTesting
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml#18/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857)
at javafx.fxml#18/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724)
at javafx.base#18/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base#18/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
at javafx.base#18/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base#18/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base#18/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base#18/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base#18/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base#18/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base#18/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base#18/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base#18/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base#18/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base#18/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics#18/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3586)
at javafx.graphics#18/javafx.scene.Scene$MouseHandler.process(Scene.java:3890)
at javafx.graphics#18/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
at javafx.graphics#18/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2607)
at javafx.graphics#18/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
at javafx.graphics#18/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics#18/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
at javafx.graphics#18/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
at javafx.graphics#18/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
at javafx.graphics#18/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
at javafx.graphics#18/com.sun.glass.ui.View.notifyMouse(View.java:937)
at javafx.graphics#18/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics#18/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:77)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at javafx.base#18/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml#18/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:84)
at javafx.fxml#18/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1854)
... 29 more
Caused by: org.testng.TestNGException:
An error occurred while instantiating class tests.LoginTest: Unable to make public tests.LoginTest() accessible: module com.vinh.testing does not "exports tests" to module org.testng
at org.testng#7.6.0/org.testng.internal.objects.SimpleObjectDispenser.createInstance(SimpleObjectDispenser.java:99)
at org.testng#7.6.0/org.testng.internal.objects.SimpleObjectDispenser.dispense(SimpleObjectDispenser.java:40)
at org.testng#7.6.0/org.testng.internal.objects.GuiceBasedObjectDispenser.dispense(GuiceBasedObjectDispenser.java:28)
at org.testng#7.6.0/org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:106)
at org.testng#7.6.0/org.testng.internal.ClassImpl.getInstances(ClassImpl.java:136)
at org.testng#7.6.0/org.testng.TestClass.getInstances(TestClass.java:129)
at org.testng#7.6.0/org.testng.TestClass.initTestClassesAndInstances(TestClass.java:109)
at org.testng#7.6.0/org.testng.TestClass.init(TestClass.java:101)
at org.testng#7.6.0/org.testng.TestClass.<init>(TestClass.java:66)
at org.testng#7.6.0/org.testng.TestRunner.initMethods(TestRunner.java:463)
at org.testng#7.6.0/org.testng.TestRunner.init(TestRunner.java:335)
at org.testng#7.6.0/org.testng.TestRunner.init(TestRunner.java:288)
at org.testng#7.6.0/org.testng.TestRunner.<init>(TestRunner.java:178)
at org.testng#7.6.0/org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:639)
at org.testng#7.6.0/org.testng.SuiteRunner.init(SuiteRunner.java:225)
at org.testng#7.6.0/org.testng.SuiteRunner.<init>(SuiteRunner.java:115)
at org.testng#7.6.0/org.testng.TestNG.createSuiteRunner(TestNG.java:1349)
at org.testng#7.6.0/org.testng.TestNG.createSuiteRunners(TestNG.java:1325)
at org.testng#7.6.0/org.testng.TestNG.runSuitesLocally(TestNG.java:1167)
at org.testng#7.6.0/org.testng.TestNG.runSuites(TestNG.java:1099)
at org.testng#7.6.0/org.testng.TestNG.run(TestNG.java:1067)
at com.vinh.testing/com.vinh.testing.CallTest.TestLoginCall.CallTestLogin(TestLoginCall.java:16)
at com.vinh.testing/com.vinh.testing.Controller.Test(Controller.java:63)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
... 36 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make public tests.LoginTest() accessible: module com.vinh.testing does not "exports tests" to module org.testng
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:191)
at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:184)
at org.testng#7.6.0/org.testng.internal.objects.SimpleObjectDispenser.instantiateUsingDefaultConstructor(SimpleObjectDispenser.java:177)
at org.testng#7.6.0/org.testng.internal.objects.SimpleObjectDispenser.createInstance(SimpleObjectDispenser.java:87)
... 59 more
Im new to TestNG, pls help me.

Related

Griffon "error injecting constructor" while trying to call loadFromFXML

I have a series of popups where I edit or view specific objects. I use these popups for editing various objects that are handled by and ORM (ORMLite), what I am trying to achieve is to have a generic/abstract class that implements similar behaviours through encapsulating methods. As I don't want to have the same FXML for all of the
popup dialogs what I came up with was to create a "template" FXML, load it through loadFXML() function provided by Griffon and store it in a Node object to be the root of the created Scene at the Abstract Class. I am familiar with dependency injection, but I am not aware of the AST of the framework so my Abstract class is able to call loadFromFXML() within the Abstract class I created.
I post my code here:
Concrete class implementing the abstract ViewPopUp class I created:
#ArtifactProviderFor(GriffonView.class)
public class VerConductoresView extends AbstractViewPopUp<ObservablePlanilla> {
private VerConductoresController controller;
private ConductoresModel model;
VerConductoresView() {
super(ObservablePlanilla.class, Conductor.class);
nodeM = new GridPane();
super.setController(controller);
}
#Override
public void initUI() {
Stage stage = (Stage) getApplication()
.createApplicationContainer(Collections.<String,Object>emptyMap());
stage.setTitle(getApplication().getConfiguration().getAsString("application.title"));
stage.setScene(init());
stage.sizeToScene();
getApplication().getWindowManager().attach("ver-conductores", stage);
}
}
Abstract view PopUp I created:
public abstract class AbstractViewPopUp<T> extends AbstractJavaFXGriffonView {
protected Class klazz;
protected Class<T> klazz2;
protected Scene viewScene;
protected ViewControllerPopUp viewController;
protected TableView tableView;
protected GridPane gridPane;
protected String[] ignoredNames;
protected String[] columnNames;
protected IModel<T> viewModel;
protected Node nodeM;
#MVCMember
public void setController(ViewControllerPopUp controller) {
this.viewController = controller;
}
AbstractViewPopUp(Class<T> k1, Class k2, Node node){
klazz = k2;
klazz2 = k1;
nodeM = node;
nodeM = loadFromFXML("com.softgan.viewPopUp");
nodeM = node;
}
AbstractViewPopUp(Class<T> k1, Class k2){
klazz = k2;
klazz2 = k1;
nodeM = loadFromFXML("com.softgan.viewPopUp");
}
protected Scene init() {
Scene scene = new Scene(new Group());
if (nodeM instanceof Parent) {
scene.setRoot((Parent) nodeM);
} else {
((Group) scene.getRoot()).getChildren().addAll(nodeM);
}
connectActions(nodeM, viewController);
connectMessageSource(nodeM);
return scene;
}
}
I want to load the FXML through the Abstract class and then store it so the concrete class can access the loaded FXML so I am able to manipulate its contents, adding labels and textfields dynamically. The problem seems to be that loadFromFXML is throwing a NullPointerException as it is not able to resolve the FXML file from the resources. I already tried to use an AST transformation to make it resources aware, but it seems to not be a valid approach as Guice is not able to resolve, I think, the ResourceHandler.
EDIT
This is the Stacktrace I am getting:
[griffon-pool-1-thread-2] WARN org.codehaus.griffon.runtime.core.controller.AbstractActionManager - An exception occurred when executing com.softgan.ConductoresController.view
griffon.exceptions.InstanceMethodInvocationException: An error occurred while invoking instance method com.softgan.ConductoresController.view()
at griffon.util.GriffonClassUtils.invokeExactInstanceMethod(GriffonClassUtils.java:3186)
Caused by: griffon.exceptions.GriffonException: An error occurred while executing a task inside the UI thread
at com.softgan.ConductoresController.view(ConductoresController.java:122)
at griffon.util.MethodUtils.invokeExactMethod(MethodUtils.java:407)
at griffon.util.MethodUtils.invokeExactMethod(MethodUtils.java:356)
at griffon.util.GriffonClassUtils.invokeExactInstanceMethod(GriffonClassUtils.java:3182)
Caused by: java.util.concurrent.ExecutionException: griffon.exceptions.InstanceNotFoundException: Could not find an instance of type com.softgan.VerConductoresView
... 4 more
Caused by: griffon.exceptions.InstanceNotFoundException: Could not find an instance of type com.softgan.VerConductoresView
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.NullPointerException
at com.softgan.VerConductoresView.<init>(VerConductoresView.java:31)
while locating com.softgan.VerConductoresView
1 error
at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086)
Caused by: java.lang.NullPointerException
at com.softgan.AbstractViewPopUp.<init>(AbstractViewPopUp.java:72)
at com.softgan.VerConductoresView.<init>(VerConductoresView.java:31)
at com.softgan.VerConductoresView$$FastClassByGuice$$d0c2bde8.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:32)
at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:98)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:120)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:93)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1050)
... 1 more
[griffon-pool-1-thread-2] ERROR griffon.core.GriffonExceptionHandler - Uncaught Exception. Stacktrace was sanitized. Set System property 'griffon.full.stacktrace' to 'true' for full report.
griffon.exceptions.InstanceMethodInvocationException: An error occurred while invoking instance method com.softgan.ConductoresController.view()
at griffon.util.GriffonClassUtils.invokeExactInstanceMethod(GriffonClassUtils.java:3186)
Caused by: griffon.exceptions.GriffonException: An error occurred while executing a task inside the UI thread
at com.softgan.ConductoresController.view(ConductoresController.java:122)
at griffon.util.MethodUtils.invokeExactMethod(MethodUtils.java:407)
at griffon.util.MethodUtils.invokeExactMethod(MethodUtils.java:356)
at griffon.util.GriffonClassUtils.invokeExactInstanceMethod(GriffonClassUtils.java:3182)
Caused by: java.util.concurrent.ExecutionException: griffon.exceptions.InstanceNotFoundException: Could not find an instance of type com.softgan.VerConductoresView
... 4 more
Caused by: griffon.exceptions.InstanceNotFoundException: Could not find an instance of type com.softgan.VerConductoresView
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.NullPointerException
at com.softgan.VerConductoresView.<init>(VerConductoresView.java:31)
while locating com.softgan.VerConductoresView
1 error
at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1086)
Caused by: java.lang.NullPointerException
at com.softgan.AbstractViewPopUp.<init>(AbstractViewPopUp.java:72)
at com.softgan.VerConductoresView.<init>(VerConductoresView.java:31)
at com.softgan.VerConductoresView$$FastClassByGuice$$d0c2bde8.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:32)
at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:98)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:120)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:93)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1050)
... 1 more
UPDATE
I already found what the problem was. The constructor was not aware of the loadFromFXML method as in the constructor of the view the UI has not been loaded yet. What I did was simply put the loadFromFXML() inside the init() method of the Abstract Class and call it directly from the Concrete View Class. I found out this by calling the loadFromFXML from the initUI method, which is where the UI can be accessed.
AST transformations only apply if you're compiling Groovy code, which may not be what you're doing. The loadFromFXML() method expects a resource to be available on the classpath by matching the given argument using the following value transformation
arg.replaceAll('.', '/') + ".fxml"
This means your code resolves "com.softgan.viewPopUp" to "com/softgan/viewPopUp.fxml". Does that file exist in src/main/resources or griffon-app/resources?

Realm doesn't work with SLF4J?

We wanted to integrate Realm in our app, and we encountered following problem:
FATAL EXCEPTION: XService
Process: xx.xxx.xxxx, PID: 16462
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/gradle/logging/internal/slf4j/OutputEventListenerBackedLoggerContext;
at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:30)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:27)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
at xx.xxx.xxxx.xxxxx.impl.core.StateMachine.<init>(StateMachine.java:52)
at xx.xxx.xxxx.xxxxx.android.XService$ServiceHandler.startController(XService.java:670)
at xx.xxx.xxxx.xxxxx.android.XService$ServiceHandler.handleMessage(XService.java:536)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.gradle.logging.internal.slf4j.OutputEventListenerBackedLoggerContext" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/xx.xxx.xxxx-2/base.apk"],nativeLibraryDirectories=[/data/app/xx.xxx.xxxx-2/lib/arm, /data/app/xx.xxx.xxxx-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:30) 
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:27) 
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128) 
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108) 
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279) 
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252) 
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265) 
at xx.xxx.xxxx.xxxxx.impl.core.StateMachine.<init>(StateMachine.java:52) 
at xx.xxx.xxxx.xxxxx.android.XService$ServiceHandler.startController(XService.java:670) 
at xx.xxx.xxxx.xxxxx.android.XService$ServiceHandler.handleMessage(XService.java:536) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
Suppressed: java.lang.ClassNotFoundException: org.gradle.logging.internal.slf4j.OutputEventListenerBackedLoggerContext
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 14 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Where StaticLoggerBinder looks like:
public class StaticLoggerBinder implements LoggerFactoryBinder {
private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
private static final String loggerFactoryClassStr = AndroidCustomLoggerFactory.class.getName();
private final ILoggerFactory loggerFactory = new AndroidCustomLoggerFactory();
private StaticLoggerBinder() {
}
public static final StaticLoggerBinder getSingleton() {
return SINGLETON; // line 27
}
public ILoggerFactory getLoggerFactory() { //line 30
return this.loggerFactory;
}
public String getLoggerFactoryClassStr() {
return loggerFactoryClassStr;
}
}
From my understanding, problem is probably with Realm's transformer. It wants to include some unknown logger to our code. Main problem with our app is, that we have some 3rd party library, that uses also SLF4J, and we can't modify it. I tried with 0.90.1 version, while SLF4J used by 3rd party library is in 1.6.4 version. Dexguard is 7.1.26.
Also, note that, Realm works with my environment and another project with same dependencies except this 3rd party library and SLF4J.
List of dependencies:
plugins:
apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'dexguard'
apply plugin: 'realm-android'
dependencies:
provided 'javax.annotation:jsr250-api:1.0'
apt 'com.google.dagger:dagger-compiler:2.0.2'
compile([
'com.google.dagger:dagger:2.0.2',
'com.mcxiaoke.volley:library:1.0.18',
'com.google.code.gson:gson:2.3.1',
'io.reactivex:rxjava:1.0.11',
'io.reactivex:rxandroid:0.24.0',
'com.jakewharton.timber:timber:3.1.0',
'com.squareup.okhttp:okhttp:2.6.0',
'com.squareup.okio:okio:1.6.0',
'com.android.support:support-v4:22.1.1'
])
compile files('libs/libconceal.jar')
compile files('libs/conceal_android.jar')
compile files('../dexguard/dexguard-runtime.jar')
compile files('libs/slf4j-api-1.6.4.jar')
compile files('libs/lib3rdparty.jar')
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.3.0'
Is this possible, that Realm mess up here with that implementation? Is there any way to prevent it?

e(fx)clipse equinox compilation error

I'm developing an OSGI (Equinox) Based-System and i came across JavaFX, i was trying the e(fx)clipse {OSGI bundle project} and i wrote a simple test project, but it is giving me some compilation errors.
i have a main class :
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class main extends Application {
private static main _main ;
public main () {
_main = this;
}
public static main Get_Main(){
return _main;
}
#Override
public void start(Stage primaryStage)
{
try
{
FXMLLoader loader = new FXMLLoader();
loader.setLocation(main.class.getResource("fxml.fxml"));
primaryStage.setScene(new Scene(loader.load()));
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
and i have a controller for the FXML
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
public class controller {
#FXML
private AnchorPane _AnchorPane;
#FXML
private Button _Btn;
#FXML
private void initialize() {
_AnchorPane.setOnMouseClicked(new EventHandler<MouseEvent>() {
#Override
public void handle(MouseEvent event) {
_AnchorPane.setStyle("-fx-background-color:red");
}
});
}
#FXML
private void _BtnClick() {
_AnchorPane.setStyle("-fx-background-color:blue");
}
}
and an Activator for the bundle
import javafx.stage.Stage;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class aCTIVATOR implements BundleActivator {
private Stage _stage = new Stage();
private main _main;
#Override
public void start(BundleContext context) throws Exception {
_main = main.Get_Main();
_main.start(_stage);
}
#Override
public void stop(BundleContext context) throws Exception {
_stage.close();
}
}
and this is my manifest file :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name:
Bundle-SymbolicName: root
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: javafx.animation;version="2.0.0",
javafx.application;version="2.0.0",
javafx.beans;version="2.0.0",
javafx.beans.binding;version="2.0.0",
javafx.beans.property;version="2.0.0",
javafx.beans.value;version="2.0.0",
javafx.collections;version="2.0.0",
javafx.concurrent;version="2.0.0",
javafx.event;version="2.0.0",
javafx.fxml;version="2.0.0",
javafx.geometry;version="2.0.0",
javafx.scene;version="2.0.0",
javafx.scene.chart;version="2.0.0",
javafx.scene.control;version="2.0.0",
javafx.scene.control.cell;version="2.0.0",
javafx.scene.effect;version="2.0.0",
javafx.scene.image;version="2.0.0",
javafx.scene.input;version="2.0.0",
javafx.scene.layout;version="2.0.0",
javafx.scene.media;version="2.0.0",
javafx.scene.paint;version="2.0.0",
javafx.scene.shape;version="2.0.0",
javafx.scene.text;version="2.0.0",
javafx.scene.transform;version="2.0.0",
javafx.scene.web;version="2.0.0",
javafx.stage;version="2.0.0",
javafx.util;version="2.0.0"
Bundle-Activator: aCTIVATOR
Require-Bundle: org.eclipse.osgi;bundle-version="3.10.0"
so when i go to the Run-Configuration, i choose OSGI-FrameWork and select the
project
org.eclipse.osgi
org.eclipse.fx.javafx
org.eclipse.fx.osgi
and finally it si giving my this compilation error:
!SESSION 2014-10-21 13:32:14.128 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_20
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -dev file:/home/hany/workspace/JavaFX/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog -console
!ENTRY root 4 0 2014-10-21 13:32:14.618
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Error starting module.
at org.eclipse.osgi.container.Module.doStart(Module.java:567)
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1551)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1531)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1502)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1445)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.NoClassDefFoundError: javafx/stage/Stage
at aCTIVATOR.<init>(aCTIVATOR.java:8)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:433)
at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:755)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:706)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:928)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:317)
at org.eclipse.osgi.container.Module.doStart(Module.java:558)
... 8 more
Caused by: java.lang.ClassNotFoundException: javafx.stage.Stage cannot be found by osgi.identity; osgi.identity="root"; type="osgi.bundle"; version:Version="1.0.0.qualifier"
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:365)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:331)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:323)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 19 more
Root exception:
java.lang.NoClassDefFoundError: javafx/stage/Stage
at aCTIVATOR.<init>(aCTIVATOR.java:8)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:433)
at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:755)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:706)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:928)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:317)
at org.eclipse.osgi.container.Module.doStart(Module.java:558)
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1551)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1531)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1502)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1445)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.ClassNotFoundException: javafx.stage.Stage cannot be found by osgi.identity; osgi.identity="root"; type="osgi.bundle"; version:Version="1.0.0.qualifier"
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:365)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:331)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:323)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 19 more
!ENTRY org.eclipse.osgi 4 0 2014-10-21 13:32:14.621
!MESSAGE Bundle root_1.0.0.qualifier [4] is not active.
!ENTRY org.eclipse.osgi 4 0 2014-10-21 13:32:14.622
!MESSAGE Could not find bundle: org.eclipse.equinox.console
!STACK 0
org.osgi.framework.BundleException: Could not find bundle: org.eclipse.equinox.console
at org.eclipse.core.runtime.internal.adaptor.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:58)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:323)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:222)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
!!!!!!!(this was a long one)
So any idea or help about this?
The reason you see the "java.lang.NoClassDefFoundError" is that Equinox does not consult the Ext-classpath and most likely you don't tell Equinox to use our adaptor hooks who make equinox consult that path.
What you need to do is to:
Ensure that you have org.eclipse.fx.osgi fragment in your launch
Make sure you pass -Dosgi.framework.extensions=org.eclipse.fx.osgi as VM arguments in your launch config
(Update) Preferred option launch with -Dorg.osgi.framework.bundle.parent=ext
Now that I've answered your real question. I can not end with a final note on your style of asking and replying to people. This is not good and I've thought multiple times about whether I should answer. Stop putting exclamation marks in your questions and reply and before putting someone down think twice if this the correct way to talk to someone who tried to help you!

UnsatisfiedLinkError with javafx

I am trying do learn javafx. I have a very simple program to print "Hello World" once in the main method (as a test) and once in the Application. The code looks like this:
import javafx.stage.*;
import javafx.application.*;
public class HelloApp extends Application
{
public static void main(String[] args)
{
System.out.println("Hello World");
launch(args);
}
public void start(Stage stage)
{
System.out.println("Hello World");
}
}
this gives me the following output. Note that it prints the first "Hello World", but not the second.
--------------------Configuration: javafx trials - JDK version 1.6.0_07 <Default> - <Default>--------------------
Hello World
Exception in thread "main" java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: C:\Documents and Settings\apcs.LGSUHSD\My Documents\JCreator LE\MyProjects\bin\glass.dll
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:281)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:124)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:163)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: C:\Documents and Settings\apcs.LGSUHSD\My Documents\JCreator LE\MyProjects\bin\glass.dll
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1650)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:200)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:88)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:31)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:73)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:80)
at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:36)
at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:33)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.glass.ui.win.WinApplication.<clinit>(WinApplication.java:33)
at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:20)
at com.sun.glass.ui.win.WinPlatformFactory.createApplication(WinPlatformFactory.java:17)
at com.sun.glass.ui.Application.Run(Application.java:103)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:271)
... 5 more
Process completed.
I have no Idea why this is happening. I have the jar file for javafx in the project. Can someone please explain why this is happening and what I can do about it?
if you are using eclipse add C:\Program Files\Oracle\JavaFX Runtime\lib\jfxrt.jar as external jar and rebuild project.

How do I setup a Quartz scheduler in a JAR file that is getting deployed to JBoss?

I'm using Quartz 2.1.1 and have a JAR application (Note, not a web so I don't have Spring). I'm running my app on JBoss 4.2.2 (cannot change this). I want to schedule my job to run every 5 minutes, but prefer not to create a scheduler through a static block. It doesn't seem to be working anyway. In my Job class, I have ...
static {
LOG.info("Started static process orders job at " + (new java.util.Date()).toString());
final JobDetail job = JobBuilder.newJob(ProcessOrdersJob.class).withIdentity("processOrdersJob", "group1").build();
final Trigger trigger = TriggerBuilder
.newTrigger()
.withIdentity("processOrdesrTrigger", "group1")
.withSchedule(
CronScheduleBuilder
.cronSchedule("0 5,10,15,20,25,30,35,40,45,50,55 * * * ?"))
.build();
Scheduler scheduler;
try {
scheduler = new StdSchedulerFactory().getScheduler();
scheduler.start();
scheduler.scheduleJob(job, trigger);
} catch (SchedulerException e) {
LOG.error(e.getMessage(), e);
e.printStackTrace(System.err);
}
} // static
but it doesn't appear to be run (the log never contains the info message). Does anyone know a more flexible way of configuring my Quartz job in my JAR for deployment to JBoss?
Thanks, -
Edit: I tried Rosdi's suggestion, reverting the Quartz used by my Maven build to 1.5.2 (the same version that JBoss had installed), but alas, got the exception
javax.ejb.EJBTransactionRolledbackException: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:249)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
at $Proxy113.execute(Unknown Source)
at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:57)
at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
... 11 more
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.<clinit>(BeanValidationIntegrator.java:53)
at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:46)
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.<init>(BootstrapServiceRegistryImpl.java:80)
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.<init>(BootstrapServiceRegistryImpl.java:57)
at org.hibernate.service.ServiceRegistryBuilder.<init>(ServiceRegistryBuilder.java:76)
at org.mainco.subco.dido.service.AbstractServiceProvider.getSessionFactory(AbstractServiceProvider.java:67)
at org.mainco.subco.dido.service.AbstractServiceProvider.initServices(AbstractServiceProvider.java:118)
at org.mainco.subco.dido.quartz.ProcessOrdersJob.execute(ProcessOrdersJob.java:92)
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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
This is what I use for my JBoss 5, I dont know whether it will work under JBoss 4.
package whatever;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import org.jboss.ejb3.annotation.Depends;
import org.jboss.ejb3.annotation.ResourceAdapter;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
#MessageDriven(activationConfig = {#ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0/30 * * * * ?")})
#ResourceAdapter("quartz-ra.rar")
#Depends({
"jboss.ejb:service=EJBTimerService""})
public class MyClass implements StatefulJob {
private static final Logger log = LoggerFactory.getLogger(MyClass.class);
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.debug("Job started at: " + new Date());
this.process();
log.debug("Job completed at: " + new Date());
}
private void process() {
//do whatever you want to do
}
}

Resources