JiBX Multiple bindings defined for class

December 13, 2010

We were getting the following error with JiBX at runtime:

Multiple bindings defined for class com.company.path.Class

In our case, this was caused because the wrong level class was passed into a manual JiBX marshall (Java->XML).

Rather than passing in a top level class, which we had compiled bindings for, we had inadvertently passed in an instance which was an attribute on the top level class. This instance hadn't had bindings compiled directly on it, and so wasn't suitable for use in the marshall call.

We fixed this by using the correct top level object in the binding call. Another alternative would perhaps have been to compile bindings for this other class, but we didn't try this.

Tags: jibx