ObjectDB ObjectDB

Project runs in Eclipse but not when exported to runnable jar

#1

I have a simple project that performs some stability calculations and displays a scale drawing of a model glider. I decided to use objectdb as a way to persist the values for later retrieval. The project works perfectly well when run from eclipse but nothing opens when I export to a runnable jar and execute that. No windows open, there are no eror dialogs etc. Commenting out all the code related to object db resolves the issue and the project runs, so I'm fairly sure it is something I've done relating to objectdb.

javax.persistence_2.0.3.v201010191057.jar and objectdb.jar are included in the build path, and are present in the compiled file, as is the test GliderCalcs.odb file created by running the system through eclipse.

The full retrieval is not yet implemented, I concentrated on understanding the basics before working out how to effeciently commit and retrieve the main data. I'm very new to Java, this is the first project I've written, so any help would be very welcome, this is a hobby project, please excuse any travesties in my code.

Many thanks in advance,

Mark

edit
delete
#2

Please provide more information.

Try to isolate the problem and locate the exact command in your project that fails. If an exception is thrown - verify that you get the stack trace (e.g. avoid empty catch which results in quite failure).

If ObjectDB throws an exception - it should also be written to the log file.

ObjectDB Support
edit
delete
#3

This is the command prompt error when I run it from there:

java -jar GliderCalcs6.jar
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
        at com.objectdb.o.LFL.<init>(LFL.java:96)
        at com.objectdb.o.CFG.q(CFG.java:163)
        at com.objectdb.o.CFG.p(CFG.java:122)
        at com.objectdb.o.RCL.<clinit>(RCL.java:33)
        at com.objectdb.o.UNM$z.<init>(UNM.java:163)
        at com.objectdb.o.UNM.x(UNM.java:105)
        at com.objectdb.o.UNM.w(UNM.java:75)
        at com.objectdb.jpa.Provider.createEntityManagerFactory(Provider.java:56)
        at com.objectdb.jpa.Provider.createEntityManagerFactory(Provider.java:32)
        at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
        at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
        at DataAccess.Main.SchoolsList(Main.java:147)
        at gui.MainFrame.<init>(MainFrame.java:2038)
        at gui.MainFrame$1.run(MainFrame.java:194)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$000(Unknown Source)
        at java.awt.EventQueue$1.run(Unknown Source)
        at java.awt.EventQueue$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(UnknownSource)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NullPointerException
        at com.objectdb.o.SYH.w(SYH.java:164)
        at com.objectdb.o.SYH.<clinit>(SYH.java:134)
        ... 28 more

 

edit
delete
#4

The stack trace indicates a problem in locating ObjectDB home, maybe as the result of using this special form of wrapper jar that contains other jar files.

Unfortunately I cannot reproduce the exception (on Windows XP with JDK 1.6.0_26). The application starts and the main windows is displayed. Other exceptions are thrown later because the odb file is not found and a new empty one is created (accessing a database file that is embedded in a jar file is not supported by ObjectDB).

You can define ObjectDB Home explicitly, bypassing this exception.

ObjectDB Support
edit
delete
#5

Many thanks, I've run it using the command prompt switch and everything works happily in a Win XP virtual machine. Win 7 64bit is behaving oddly but that's normal (apparently java is not a recognized command, even though JRE is installed and configured).

edit
delete
#6

An attempt to bypass the NullPointerException is included in build 2.2.9_03.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.