Jsondb / jsondb-core

JsonDB a pure java database that stores its data as Json Files

Home Page:http://www.jsondb.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Runtime error on Java(TM) SE Embedded Runtime Environment

PanzerHabba opened this issue · comments

Hi,

I wrote a simple test applicaiton with your jsondb. The application was running fine on windows/ubuntu and raspberry pi. But when i tried running it on a different embedded system (Arnv5tejl) I got an java.lang.NoClassDefFoundError: java/beans/PropertyDescriptor exception.

Before the exception I got a warning: "Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added". Any idea of what is going on here ?

java -version:
Java(TM) SE Embedded Runtime Environment (build 1.8.0_65-b17, profile compact2, headless)
Java HotSpot(TM) Embedded Minimal VM (build 25.65-b01, mixed mode)

uname -a:
Linux gw-446D 4.4.24 #1 Thu Jan 26 09:10:47 CET 2017 armv5tejl GNU/Linux

Output:
# java -jar simplejsondb.jar
Hello World!
[main] INFO io.jsondb.JsonDBConfig - Encryption is not enabled for JSON DB
Jan 30, 2017 6:00:17 AM com.fasterxml.jackson.databind.ext.Java7Support
WARNING: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 s upport added
[main] INFO org.reflections.Reflections - Reflections took 6262 ms to scan 1 url s, producing 1 keys and 2 values
Added a new jsonDBTemplate
Exception in thread "main" java.lang.NoClassDefFoundError: java/beans/PropertyDe scriptor
at org.apache.commons.jxpath.ri.model.beans.CollectionPointerFactory.cre ateNodePointer(CollectionPointerFactory.java:42)
at org.apache.commons.jxpath.ri.model.NodePointer.newNodePointer(NodePoi nter.java:81)
at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.(JXPath ContextReferenceImpl.java:193)
at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.(JXPath ContextReferenceImpl.java:167)
at org.apache.commons.jxpath.ri.JXPathContextFactoryReferenceImpl.newCon text(JXPathContextFactoryReferenceImpl.java:39)
at org.apache.commons.jxpath.JXPathContext.newContext(JXPathContext.java :416)
at io.jsondb.JsonDBTemplate.createCollection(JsonDBTemplate.java:309)
at io.jsondb.JsonDBTemplate.createCollection(JsonDBTemplate.java:270)
at martinharbo.kyrkjeveien.App.main(App.java:33)
Caused by: java.lang.ClassNotFoundException: java.beans.PropertyDescriptor
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 9 more

Just by looking at your Exception Stacktrace i think Java(TM) SE Embedded Runtime Environment does not have the "java.nio.file." package. I can fix this and create a version of JsonDB that does not uses classes from this package "java.nio.file." at all.

The other issue of "annotations" support not present in the Java(TM) SE Embedded Runtime Environment " is a bit of trouble, I will study this in a day or 2 when i get some time and try to see if i can find a decent workaround.

Thank you for you fast reply @FarooqKhan.

It would be really nice if we could make use of your package. It`s more straightforward and "cleaner" than the old "mapdb" option.

Hi PanzerHabba,

The initial warnings you see about "annotations, java.nio.file.Path" are a issue but it will not be a problem unless you try to Add a EventListener to the watch for direct changes to the db files using other filesystem utilities. This is a usecase that very few people would want to use.

However the issue of the class "ClassNotFoundException: java.beans.PropertyDescriptor" is a more troubles some. JsonDB uses Apache JxPath library very heavily for all the XPATH support. This JxPath library depends on the "java.beans" package. This is a problem that Android users face often becuase Dalvik does not have the "java.beans" package

I am surprised that Java SE Embedded does not have this package. If it is indeed true that Java SE Embedded does not have this package then you can try a workaround to your problem you will need to obtain the JxPath source code replace all usage of java.beans.* with "com.googlecode.openbeans" recompile and use this custom JxPath library

This is certainly a lot of work you probably wont want to do this.

I will keep looking for ways to solve this, and keep this open.

For now unfortunately i dont have a better solution.

Thanks
Farooq

Hi FarooqKhan,

I didn't have any problem running a JsonDB simple code on this environment:

  • Java(TM) SE Embedded Runtime Environment (build 1.8.0_131-b11, headless)
  • Linux 4.9.39-2-ARCH #1 SMP Wed Jul 26 01:23:45 UTC 2017 armv7l GNU/Linux

I did a simple project saving data and making an XPath query.

Hope this info could help you.

Regards.

Thanks @ivanmarban this will help others who might be also trying on embedded platform