Details
-
Type:
Improvement
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: JiBX 1.1.6
-
Fix Version/s: None
-
Component/s: core
-
Labels:None
-
Environment:Ubuntu 9.04, running Ant build from Eclipse as a project builder.
-
Number of attachments :
Description
I have an optional boolean property where I want the default value to be true rather than false, so I put in a binding like this:
<value name="stationary" field="stationary" style="attribute" usage="optional" default="true" />
This gave the following compiler error:
[bind] *** Error during code generation for file 'binding.xml' - please enter a bug report for this error in Jira if the problem is not listed as fixed on the online status page ***
[bind] org.jibx.runtime.JiBXException: Deserializer class org.jibx.runtime.Utility not found for converting default value
[bind] at org.jibx.binding.def.PrimitiveStringConversion.convertDefault(PrimitiveStringConversion.java:412)
[bind] at org.jibx.binding.def.PrimitiveStringConversion.derive(PrimitiveStringConversion.java:508)
[bind] at org.jibx.binding.def.BindingBuilder.unmarshalValue(BindingBuilder.java:650)
[bind] at org.jibx.binding.def.BindingBuilder.unmarshalStructureChildren(BindingBuilder.java:848)
[bind] at org.jibx.binding.def.BindingBuilder.unmarshalMapping(BindingBuilder.java:1651)
[bind] at org.jibx.binding.def.BindingBuilder.unmarshalMappings(BindingBuilder.java:983)
[bind] at org.jibx.binding.def.BindingBuilder.unmarshalBindingDefinition(BindingBuilder.java:1799)
[bind] at org.jibx.binding.Utility.loadBinding(Utility.java:293)
[bind] at org.jibx.binding.Utility.loadFileBinding(Utility.java:413)
[bind] at org.jibx.binding.Compile.compile(Compile.java:296)
[bind] at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
[bind] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[bind] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[bind] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[bind] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[bind] at java.lang.reflect.Method.invoke(Method.java:597)
[bind] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[bind] at org.apache.tools.ant.Task.perform(Task.java:348)
[bind] at org.apache.tools.ant.Target.execute(Target.java:357)
[bind] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[bind] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[bind] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[bind] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[bind] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[bind] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[bind] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[bind] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
I then put in the type as follows, and got:
<value name="stationary" field="stationary" style="attribute" usage="optional" default="true" type="boolean.default" />
[bind] Error: Unable to load class boolean.default; on value element at (line 95, col 124, in binding.xml)
It sounds like something is up with the classpath, but both the bind and the runtime jars are definitely on the ant task's classpath.
I'm guessing you're missing jibx-run.jar from the classpath passed to the bind task. See the following from http://jibx.sourceforge.net/bindcomp.html:
One issue to note with the Ant task is that if you're using default values you'll need to include the jibx-run.jar from the distribution in the classpath passed when you invoke the task:
<!-- Run JiBX binding compiler -->
{jibx-lib}<bind verbose="true" load="true" binding="binding.xml">
<classpath>
<pathelement path="classes"/>
<pathelement location="$
/jibx-run.jar"/>
</classpath>
</bind>