65229

Realm NoClassDefFoundError: rx.Observable

I am experiencing an issue that is pointed out in Realm's documentation:

<strong>Jackson Databind</strong>

Jackson Databind is a library for binding JSON data to Java classes.

Jackson uses reflection to perform the data binding. This conflicts with Realm’s support for RxJava, as RxJava might not be available to the class loader. This can result in an exception that looks like this:

Copy to clipboardjava.lang.NoClassDefFoundError: rx.Observable at libcore.reflect.InternalNames.getClass(InternalNames.java:55) ...

Here is the proposed fix:

This can be fixed by either adding RxJava to your project or create two empty dummy files that looks like the following.

Copy to clipboard// File 1 package io.reactivex; public class Flowable { } // File 2 package io.reactivex; public class Observable { }

This issue has also been reported to the Jackson project here.

<strong>Question: Where do I create the files so they don't have my app's package name? (ex: com.myApp.myPackage)</strong>

Side note: I'm experiencing this from SimpleXml, not Jackson (maybe simplexml uses jackson?). I've seen 2 errors:

<ol> <li>Realm NoClassDefFoundError: rx.Observable Realm</li> <li>NoClassDefFoundError: io.reactivex.Observable</li> </ol>

Answer1:

You are using Realm older than v4.0.0, so you need to create package rx, and the dummy class called Observable. But you just need to create it in src/main/java/rx.

package rx; public class Observable { }

For Realm 4.0.0+, you need in src/main/java/io/reactivex.

package io.reactivex; public class Observable { }

and

package io.reactivex; public class Flowable { }

and

package io.reactivex; public enum BackpressureStrategy { MISSING, ERROR, BUFFER, DROP, LATEST }

Recommend

  • Changing factors to Integers without changing the order of the data
  • http request every x seconds in angular
  • non-conformable arrays when passing numpy array to R via rpy2
  • org/eclipse/e4/ui/model/application/ui/MUIElement Class Not Found , Java Eclipse Juno
  • Newbie Android Error: java.lang.NoClassDefFoundError: android.content.ClipboardManager
  • CRATE 0.28.0.1 and elasticsearch-cloud-aws plugin compatibility
  • RS-232 communication using an Arduino Duemilanove and the Cutedigi RS-232 interface
  • Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError
  • AJAX problem in Internet Explorer
  • Compile error while declaring close
  • HttpRequestMessage Content Disposition null when unit testing
  • C++ stl pop doesn't return [closed]
  • Angular5 Service Worker update(SWUpdate) not detecting on firefox. Working on chrome
  • concatenating select menus into a single form input
  • Is a .txt file created in VB different than one I'd randomly create?
  • richtextbox to string
  • Is it possible to send skype chat messages from a linux server without X?
  • NSMutableArray Access Issue
  • Ruby: FileUtils.cp truncates file; FileUtils.mv it does not?
  • Boost binary serialization doesn't work occasionally. The parsed data is corrupted sometimes
  • jhipster run embedded jar with prod profile - issue with liquibase
  • add a publickey to server for SCP [closed]
  • Simplify where clause with repeated associated type restrictions
  • Cassandra NoClassDefFoundError: com/google/common/util/concurrent/AsyncFunction
  • Guava how to copy all files from one directory to another
  • Sybase Error Implicit Conversion from datatype 'VARCHAR' to 'INT' not allowed
  • Add reference to ASP.NET 5 Class Library from Framework 4.5 Class Library Project
  • Most efficient way to move table rows from one table to another
  • std::remove_copy_if_ valgrind bytes in block are possibly lost in loss record
  • Problem deserializing objects from cache on MyBatis 3/Java
  • Functions in global context
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Display issues when we change from one jquery mobile page to another in firefox
  • Python - Map / Reduce - How do I read JSON specific field in using DISCO count words example
  • XCode can't find symbols for a specific iOS library/framework project
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • AngularJs get employee from factory
  • coudnt use logback because of log4j
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4