From: Smith,Drew <Drew.Smith@Cerner.com> - 2009-02-11 21:02:13
|
Per my previous email, I've been trying to compile bindings from different archives using the 1.2 <include precompiled="true"/> feature. That part seemed to work, it imported the mappings and didn't try to compile them again, but it appears that this brought another error when compiling the parent object containing the included mappings: Error running binding compiler *** Error during code generation for file 'claims-binding.xml' - please enter a bug report for this error in Jira if the problem is not listed as fixed on the o nline status page *** org.jibx.runtime.JiBXException: Classloader conflict for binding 'common_message _binding' - factory does not implement required interface at org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:27 0) at org.jibx.binding.def.BindingBuilder.unmarshalInclude(BindingBuilder.j ava:2005) at org.jibx.binding.def.BindingBuilder.unmarshalBindingDefinition(Bindin gBuilder.java:2084) at org.jibx.binding.Utility.loadBinding(Utility.java:314) at org.jibx.binding.Utility.loadFileBinding(Utility.java:431) at org.jibx.binding.Compile.compile(Compile.java:212) at org.jibx.binding.Compile.main(Compile.java:374) common-message-binding is the name of the binding file obviously: public class JiBX_common_message_bindingFactory extends BindingFactoryBase implements IBindingFactory { private static IBindingFactory m_inst; } I ran the compiler command with the verbose command, and it definitely is pulling in the 1.2 BindingDirectory, BindingBuilder, etc. classes, and the including, previously compiled binding was run with the same. Looking at the BindingDirectory code, we see this snippet: if (result instanceof IBindingFactory) { That if statement will evaluate to false if result == null, and there is no null check, so the printed stack trace might not be the actual error. Also, is instanceof the best evaluator? Wouldn't it be better to use the reflections api with something like: Class clazz = Class.forName(className); List<Class> interfacesList = Arrays.asList(clazz.getInterfaces()); if(!interfacesList.contains(IBindingFactory.class)) { throw new Exception(clazz.getName() + " does not implement " + IBindingFactory.class.getName()); } Or if (result != null && result instanceof IBindingFactory) { Thanks, Drew ---------------------------------------------------------------------- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. |