I keep getting an error message about Instrumentation for ActiveJDBC in IntelliJ

0

I am doing some Java and Cucumber learning and trying to get MySQL to work. I am following the code from a course book. It all seems simple enough, but I just cannot get it to work. I keep getting the error: org.javalite.activejdbc.DBException: failed to determine Model class name, are you sure models have been instrumented?. I have literally tried every single bit of advice from lots of different posts. I realise you will all say that it has not been instrumented after the last compile, but for the life of me I cannot work out why or what is causing it.

I get the same error no matter how I run it. Please, please help me, this is driving me crazy. I will use Maven Verify as my example:

POM:


<plugin>
                <groupId>org.javalite</groupId>
                <artifactId>activejdbc-instrumentation</artifactId>
                <version>${activejdbc.version}</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>instrument</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>3.0.5</version>
                <configuration>
                    <changeLogFile>src/main/resources/bank_schema.xml</changeLogFile>
                    <driver>com.mysql.cj.jdbc.Driver</driver>
                    <url>jdbc:mysql://localhost/bank</url>
                    <username>teller</username>
                    <password>password</password>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>update</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Java Code:


package step_definitions.hooks;

//import cucumber.runtime.java.guice.ScenarioScoped;
//import io.cucumber.guice.ScenarioScoped;
import io.cucumber.java.Before;
import nicebank.Account;
import nicebank.TransactionQueue;
import org.javalite.activejdbc.Base;

//@ScenarioScoped
public class HooksReset {
    @Before(order = 1)
    public void reset() {
        if (!Base.hasConnection()) {
            Base.open(
                    "com.mysql.cj.jdbc.Driver",
                    "jdbc:mysql://localhost/bank",
                    "teller", "password");
        }
        System.out.println("[HooksReset] > @Before > reset() > Has Connection: " + Base.hasConnection() );
        Account.deleteAll();
        TransactionQueue.clear();
    }
}

Just updating to remove the images.

Maven verify - Compile message:

In my run window for the project ATM_DI[verify] -

  • resources
  • update
  • compile
  • resources
  • update
  • compile
  • instrument
  • testResources
  • testCompile
  • test
  • jar (NB: these all have a green tick next to them.)

compile:

[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ ATM_DI ---
[INFO] Nothing to compile - all classes are up to date

instrument:

(it appears to have done this twice - not sure if that is correct. Could be me messing about trying to getting the instrumentation to run at every possible moment!)

[INFO] 
[INFO] --- activejdbc-instrumentation:1.4.1:instrument (default) @ ATM_DI ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.javalite.instrumentation.ActiveJdbcInstrumentationPlugin (file:/C:/Users/user/.m2/repository/org/javalite/activejdbc-instrumentation/1.4.1/activejdbc-instrumentation-1.4.1.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of org.javalite.instrumentation.ActiveJdbcInstrumentationPlugin
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
**************************** START INSTRUMENTATION ****************************
Directory: C:\Workspace\Rob Java Stuff\Cucumber For Java\ATM_DI\target\classes
Found model: nicebank.Account
Instrumented class: nicebank.Account in directory: /C:/Workspace/Rob%20Java%20Stuff/Cucumber%20For%20Java/ATM_DI/target/classes/
**************************** END INSTRUMENTATION ****************************
**************************** START INSTRUMENTATION ****************************
Directory: C:\Workspace\Rob Java Stuff\Cucumber For Java\ATM_DI\target\test-classes
Found model: support.TestAccount
Instrumented class: support.TestAccount in directory: /C:/Workspace/Rob%20Java%20Stuff/Cucumber%20For%20Java/ATM_DI/target/test-classes/
**************************** END INSTRUMENTATION ****************************

testCompile:

[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ ATM_DI ---
[INFO] Nothing to compile - all classes are up to date

test:

[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ ATM_DI ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestRunner
Scenario Outline: Successful withdrawal from an account in credit # src/test/resources/features/cash-withdrawal-outline-test.feature:11
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
1613635294139   geckodriver INFO    Listening on 127.0.0.1:48824
1613635295410   mozrunner::runner   INFO    Running command: "C:\\Program Files (x86)\\[HooksReset] > @Before > reset() > Has Connection: true
  org.javalite.activejdbc.DBException: failed to determine Model class name, are you sure models have been instrumented?
    at org.javalite.activejdbc.Model$ClassGetter.getClassName(Model.java:2214)
    at org.javalite.activejdbc.Model.getClassName(Model.java:2187)
    at org.javalite.activejdbc.Model.getDaClass(Model.java:2179)
    at org.javalite.activejdbc.Model.getMetaModel(Model.java:58)
    at org.javalite.activejdbc.Model.deleteAll(Model.java:548)
    at step_definitions.hooks.HooksReset.reset(HooksReset.java:42)
Caused by: org.javalite.activejdbc.InitException: failed to determine Model class name, are you sure models have been instrumented?
    at org.javalite.activejdbc.Model$ClassGetter.getClassName(Model.java:2214)
    at org.javalite.activejdbc.Model.getClassName(Model.java:2187)
    at org.javalite.activejdbc.Model.getDaClass(Model.java:2179)
    at org.javalite.activejdbc.Model.getMetaModel(Model.java:58)
    at org.javalite.activejdbc.Model.deleteAll(Model.java:548)
    at step_definitions.hooks.HooksReset.reset(HooksReset.java:42)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.cucumber.java.Invoker.doInvoke(Invoker.java:66)
    at io.cucumber.java.Invoker.invoke(Invoker.java:24)
    at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:44)
    at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:59)
    at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:44)
    at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
    at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
    at io.cucumber.core.runner.TestStep.run(TestStep.java:63)
    at io.cucumber.core.runner.TestCase.run(TestCase.java:94)
    at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
    at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
    at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:118)
    at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:24)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at io.cucumber.junit.Cucumber.runChild(Cucumber.java:192)
    at io.cucumber.junit.Cucumber.runChild(Cucumber.java:88)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:227)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:364)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:237)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:158)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
    at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
Mozilla Firefox\\firefox.exe" "--marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\user\\AppData\\Local\\Temp\\rust_mozprofilexDiqjt"
Can't find symbol 'eglSwapBuffersWithDamageEXT'.
Can't find symbol 'eglSetDamageRegionKHR'.
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)"))
1613635305871   Marionette  INFO    Listening on port 51762
1613635306694   Marionette  WARN    TLS certificate errors will be ignored for this session
Feb 18, 2021 8:01:47 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
1613635308204   Marionette  INFO    Stopped listening on port 51762
JavaScript error: resource://activity-stream/lib/ActivityStreamPrefs.jsm, line 27: NS_ERROR_ILLEGAL_VALUE: Component returned f at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
[HooksBackgroundProcess] > [@Before] > [startBackgroundThread()] >: 1. About to start Hook.
[HooksBackgroundProcess] > [@Before] > [startBackgroundThread()] > [run()] >: 1a. About to create new TransactionProcessor called (processor).
[HooksBackgroundProcess] > [@Before] > [startBackgroundThread()] > [run()] >: 1b. about to start - processor.process()
[Account] > Account() > 1. before setInteger()
1************** [TransactionProcessor] > process() -> 1b. Base.open - Account Table Count: 0
[Account] > Account() > 2. after setInteger() -> Account Count: 0, Account Table name : accounts, Account first record :null
========================= [AtmServer] > [constructor] > Servlet's added
========================= [AtmServer] > [start] > Listening on http://192.168.0.9:8887/
  Given my savings account has been credited 100.00   # step_definitions.AccountSteps.myAccountHasBeenCredited(java.lang.String,nicebank.Money)
  When I withdraw 20  # step_definitions.TellerSteps.iWithdraw(int)
  Then 20 should be dispensed # step_definitions.CashSlotSteps.shouldBeDispensed(int)
  And the balance of my savings account should be 80.00   # step_definitions.AccountSteps.theBalanceOfMyAccountShouldBe(java.lang.String,nicebank.Money)
*********** [WebDriverHooks] > [@After] > [finish]: Take screen shot
Embedding Out_WebDriverHooks [image/png 4990 bytes]
ailure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIPrefBranch.removeObserver]
JavaScript error: resource://gre/modules/UrlClassifierListManager.jsm, line 691: TypeError: this.tablesData[table] is undefined
[Parent 10364, Gecko_IOThread] WARNING: file /builds/worker/checkouts/gecko/ipc/chromium/src/base/process_util_win.cc:166
JavaScript error: resource://activity-stream/lib/PlacesFeed.jsm, line 200: NS_ERROR_XPC_GS_RETURNED_FAILURE: ServiceManager::GetService returned failure code:
JavaScript error: resource://gre/modules/ExtensionSettingsStore.jsm, line 123: Error: The ExtensionSettingsStore was accessed before the initialize promise resolved.
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: rs-experiment-loader-timer
console.log: "RemoteSettingsWorker error: Error: Can't import when we've started shutting down."
console.error: "Could not load engine google@search.mozilla.org: [Exception... \"AddonManager is not initialized\"  nsresult: \"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)\"  location: \"JS frame :: resource://gre/modules/AddonManager.jsm :: installBuiltinAddon :: line 2550\"  data: no]"
console.error: "Could not load engine amazon@search.mozilla.org: [Exception... \"AddonManager is not initialized\"  nsresult: \"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)\"  location: \"JS frame :: resource://gre/modules/AddonManager.jsm :: installBuiltinAddon :: line 2550\"  data: no]"
console.error: "Could not load engine ddg@search.mozilla.org: [Exception... \"AddonManager is not initialized\"  nsresult: \"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)\"  location: \"JS frame :: resource://gre/modules/AddonManager.jsm :: installBuiltinAddon :: line 2550\"  data: no]"
console.error: "Could not load engine bing@search.mozilla.org: [Exception... \"AddonManager is not initialized\"  nsresult: \"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)\"  location: \"JS frame :: resource://gre/modules/AddonManager.jsm :: installBuiltinAddon :: line 2550\"  data: no]"
console.error: "Could not load engine wikipedia@search.mozilla.org: [Exception... \"AddonManager is not initialized\"  nsresult: \"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)\"  location: \"JS frame :: resource://gre/modules/AddonManager.jsm :: installBuiltinAddon :: line 2550\"  data: no]"
console.error: "Could not load engine ebay@search.mozilla.org: [Exception... \"AddonManager is not initialized\"  nsresult: \"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)\"  location: \"JS frame :: resource://gre/modules/AddonManager.jsm :: installBuiltinAddon :: line 2550\"  data: no]"
console.error: "Could not load engine chambers-en-GB@search.mozilla.org: [Exception... \"AddonManager is not initialized\"  nsresult: \"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)\"  location: \"JS frame :: resource://gre/modules/AddonManager.jsm :: installBuiltinAddon :: line 2550\"  data: no]"
console.warn: SearchService: "_init: abandoning init due to shutting down"
JavaScript error: resource://gre/modules/AsyncShutdown.jsm, line 554: uncaught exception: 2147500036
JavaScript error: resource://gre/modules/AsyncShutdown.jsm, line 554: uncaught exception: 2147500036
JavaScript error: resource://gre/modules/AsyncShutdown.jsm, line 554: uncaught exception: 2147500036
JavaScript error: resource://gre/modules/AsyncShutdown.jsm, line 554: uncaught exception: 2147500036
JavaScript error: resource://gre/modules/AsyncShutdown.jsm, line 554: uncaught exception: 2147500036
console.log: "RemoteSettingsWorker error: Error: Can't import when we've started shutting down."
console.log: "RemoteSettingsWorker error: Error: Can't import when we've started shutting down."
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
JavaScript error: resource://gre/modules/osfile/osfile_async_front.jsm, line 426: Error: OS.File has been shut down. Rejecting post to stat
*********** [ServerHooks] > [@After] > [afterRunningScenario] >: Just finished running scenario: FAILED
========================= [AtmServer] > [stop] > Listening on null
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 96.36 s <<< FAILURE! - in TestRunner
[ERROR] Feature - Cash Withdrawal.Successful withdrawal from an account in credit  Time elapsed: 94.115 s  <<< ERROR!
org.javalite.activejdbc.DBException: failed to determine Model class name, are you sure models have been instrumented?
Caused by: org.javalite.activejdbc.InitException: failed to determine Model class name, are you sure models have been instrumented?
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   failed to determine Model class name, are you sure models have been instrumented?
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[ERROR] There are test failures.
Please refer to C:\Workspace\Rob Java Stuff\Cucumber For Java\ATM_DI\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

Many thanks

java
mysql
maven
asked on Stack Overflow Feb 15, 2021 by Wab • edited Feb 19, 2021 by Wab

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0