ccavanaugh / jgnash

jGnash Personal Finance
http://ccavanaugh.github.io/jgnash/
Other
142 stars 79 forks source link

Exception thrown: Creating a New DB after 'Finish' clicked on Wizard #56

Closed weedySeaDragon closed 6 years ago

weedySeaDragon commented 6 years ago

(I'm not sure if this is the right place to submit this issue or if I should create a login on SourceForge and submit a ticket there.)

Expected Behavior

After a brand new install (my first time installing it), create a new file to work with

Actual Behavior

Runtime exception was thrown:

Here's the text from my terminal:

/Applications/jGnash/bin/jgnash-fx ; exit;

[2018-09-21 03:46:08] [INFO   ] {jgnash.util.LogUtil configureLogging} Logging configured

[2018-09-21 03:46:09] [INFO   ] {jgnash.plugin.PluginFactory getDefaultPluginDirectory} Plugin path: /Applications/jGnash/plugins/
[2018-09-21 03:46:09] [INFO   ] {jgnash.plugin.PluginFactory getUserPluginDirectory} Plugin path: /Users/ashleyengelund/.jgnash/plugins/
[2018-09-21 03:46:09] [INFO   ] {jgnash.plugin.PluginFactory startPlugins} Starting plugin: MT940 Import
[2018-09-21 03:46:14] [INFO   ] {jgnash.uifx.views.main.MainView lambda$checkForLatestRelease$9} Version check performed
objc[15773]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fffadd98c90) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x1374cccd8). One of the two will be used. Which one is undefined.
[2018-09-21 03:47:03] [INFO   ] {jgnash.engine.jpa.SqlUtils waitForLockFileRelease} Searching for lock file: /Users/ashleyengelund/jGnash/ashleyengelund.lock.db
[2018-09-21 03:47:03] [INFO   ] {jgnash.engine.jpa.AbstractJpaDataStore initEmptyDatabase} Initialized an empty database for /Users/ashleyengelund/jGnash/ashleyengelund.h2.db
[2018-09-21 03:47:03] [INFO   ] {org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation} HHH000204: Processing PersistenceUnitInfo [
    name: jgnash
    ...]
[2018-09-21 03:47:03] [INFO   ] {org.hibernate.Version logVersion} HHH000412: Hibernate Core {5.3.5.Final}
[2018-09-21 03:47:03] [INFO   ] {org.hibernate.cfg.Environment <clinit>} HHH000206: hibernate.properties not found
[2018-09-21 03:47:03] [SEVERE ] {jgnash.uifx.StaticUIMethods$ExceptionHandler uncaughtException} java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1787)
    at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.controls/javafx.scene.control.MenuItem.fire(MenuItem.java:465)
    at javafx.controls/com.sun.javafx.scene.control.GlobalMenuAdapter.lambda$bindMenuItemProperties$2(GlobalMenuAdapter.java:153)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.controls/javafx.scene.control.MenuItem.fire(MenuItem.java:465)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassSystemMenu$1.action(GlassSystemMenu.java:234)
Caused by: java.lang.reflect.InvocationTargetException
    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:564)
    at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
    at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1784)
    ... 21 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43)
    at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:86)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:212)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:174)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:76)
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:171)
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:119)
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:61)
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:50)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
    at jgnash.engine.jpa.AbstractJpaDataStore.getLocalEngine(AbstractJpaDataStore.java:168)
    at jgnash.engine.jpa.JpaH2DataStore.getLocalEngine(JpaH2DataStore.java:34)
    at jgnash.engine.EngineFactory.bootLocalEngine(EngineFactory.java:277)
    at jgnash.util.NewFileUtility.buildNewFile(NewFileUtility.java:61)
    at jgnash.uifx.wizard.file.NewFileWizard.<init>(NewFileWizard.java:111)
    at jgnash.uifx.wizard.file.NewFileWizard.showAndWait(NewFileWizard.java:120)
    at jgnash.uifx.views.main.MenuBarController.handleNewAction(MenuBarController.java:253)
    ... 32 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
    ... 49 more

Steps to Reproduce the Problem

  1. File -> New
  2. Accept all of the defaults in the wizard (For me it was USD, no other currencies, use the "Common" accounts, accept the default db (H2)
  3. click the Finish button on the wizard

Specifications

weedySeaDragon commented 6 years ago

Looks like the problem is that jaxb is no longer included in JDK 9/10 (and beyond).

I haven't looked at your code, but according to this answer on SO, you need to explicitly add it to your build (conditionally, based on the detected JDK).

weedySeaDragon commented 6 years ago

I'm now looked at the code and poked around a bit...

Adding this to jgnash-core/build.gradle

    // required for JVM 1.9 and above:
    // https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api
    compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.4'

works for me when I run it with JVM 10 and also 8 (JVM 1.8). It does mean that the .jar file is added unnecessarily for anyone running < JVM 9 (a little bit of bloat), but the alternative is to add some conditional code to the .sh and .bat files generated to check the java version and then conditionally add the --add-modules... option. That can certainly be done, but it means working with the right gradle plugin(s) to do it.

I can do a PR for this if needed.

ccavanaugh commented 6 years ago

The readme supplied with jGnash documents the need to add '--add-modules java.xml.bind' to the command line when operating with Java 10. It's solved the issue when I tested on Windows and Linux. The module appears to be there, just not loaded by default. Its untested on OSX.

Adding the jaxb-api caused issues when running under Java 8 last time I tried. A PR against the 3.0-dev branch would be fine as it will be target to run under Java 11 and newer.

Oracle created a bit of a mess between dropping JavaFX, the jaxb api, etc and sprinkled it between versions.

weedySeaDragon commented 6 years ago

README

I didn't see the info in the README until later (after I had the problem and was investigating.) The README is not clear about the changes that you must do for Java 9 or 10. Yes, the information is in there, but it needs to be re-organized so that it's clear and easy to find. Ex:

IMO, you need the standard Requirements section in the README, and this is where you should note that if you're running Java 9 or 10, you must have the jaxb-api jar and you have to modify the command to run jGnash; it could specifically refer to the 'Install' section where the steps are spelled out (downloading the .jar, where to put it, what file (.bat or .sh) to modify, etc.

You could put a note about Java 11 in the Requirements section (e.g. that jGnash won't run under it yet, but work is in progress).

Again: I totally agree that all of the information is in there, but reorganizing into more standardized sections will make it clearer so that people will understand what they have to do for their specific Java version and OS.

I can do a PR for the README so that you can see my suggestions.

3.0-dev branch

I'll take a look at that branch in a few days.

ccavanaugh commented 6 years ago

Sorry, away for a few days.

A pull request with cleaned up documentation would be great.

weedySeaDragon commented 6 years ago

No worries about the timing. :-)

will do a PR for the README. probably Wednesday or Thurs, just FYI.

ccavanaugh commented 6 years ago

Closing