[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-users
Subject:    Re: [jibx-users] Default attribute with <value> not working
From:       Peter Birchmeier <pbirchmeier () gmx ! ch>
Date:       2006-03-31 0:39:30
Message-ID: 442C7A42.8080205 () gmx ! ch
[Download RAW message or body]

Hi Ivens,

I just came accross this problem a few hours ago. The problem is that 
JiBX uses the serializer/deserializer class org.jibx.runtime.Utility 
which belongs to the jibx-run.jar library. If you use the ant task to 
bind your classes, by default only the jibx-bind.jar library is included 
in the classpath of the ant task definition:

snippet from http://jibx.sourceforge.net/bindcomp.html:

  <!-- JiBX binding compiler task definition -->
  <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask"
    classpath="${jibx-lib}/jibx-bind.jar"/>

I manually tried to include the other library as well:

	<!-- JiBX binding compiler task definition -->
	<taskdef name="jibx-bind" classname="org.jibx.binding.ant.CompileTask">
		<classpath>
			<pathelement path="${jibx.lib}/jibx-bind.jar"/>
			<pathelement path="${jibx.lib}/jibx-run.jar"/>
		</classpath>
	</taskdef>

Unfortunately this approach hasn't worked. 
see why: http://www.mail-archive.com/jibx-users@lists.sourceforge.net/msg01565.html



SOLUTION:

If you bind the classes by executing the JiBX compilation directly, everything works \
perfectly.

In Eclipse you can configure the JiBX binding as an external tool:


Location: C:\bin\dev\java\jdk1.5.0\bin\java.exe
Working Directory: ${workspace_loc:/commons/build/classes-core}

Arguments:
-cp .;../../lib/jibx/jibx-bind.jar;../../lib/jibx/jibx-run.jar
org.jibx.binding.Compile resources/xml-binding/*.xml


Of course there are other ways, but for me that works fine.

Kind regards, Peter





Ivens Porto wrote:
> Hello,
> 
> I´m using Jibx in a project of mine and I need to use the 'default'
> attribute with a <value> in my binding.
> 
> The problem is that after I put the 'default' attribute to the <value>
> of my binding the bind compiler cannot compile my binding anymore.
> 
> The binding definition is like this:
> 
> <value name="totalVotes"
> get-method="getTotalVotes"
> set-method="setTotalVotes"
> usage="optional"
> default="-9999"
> test-method="hasTotalVotes"/>
> 
> The binding compiler give me this error:
> 
> ---------------------------------------------------------------------------------------------------------------
>  [bind] Error running binding compiler
> [bind] *** Error during code generation - 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:629)
>  [bind] at org.jibx.binding.def.BindingBuilder.unmarshalStructureChildren(BindingBuilder.java:812)
>  [bind] at org.jibx.binding.def.BindingBuilder.unmarshalMapping(BindingBuilder.java:1536)
>  [bind] at org.jibx.binding.def.BindingBuilder.unmarshalMappings(BindingBuilder.java:944)
>  [bind] at org.jibx.binding.def.BindingBuilder.unmarshalInclude(BindingBuilder.java:1652)
>  [bind] at org.jibx.binding.def.BindingBuilder.unmarshalBindingDefinition(BindingBuilder.java:1717)
>  [bind] at org.jibx.binding.Utility.loadBinding(Utility.java:308)
> [bind] at org.jibx.binding.Utility.loadFileBinding(Utility.java:389)
> [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:275)
> [bind] at org.apache.tools.ant.Task.perform(Task.java:364)
> [bind] at org.apache.tools.ant.Target.execute(Target.java:341)
> [bind] at org.apache.tools.ant.Target.performTasks(Target.java:369)
> [bind] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
> [bind] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
> [bind] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
>  [bind] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
>  [bind] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
> [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)
>                 
> ---------------------------------------------------------------------------------------------------------------
>  
> If I take out the 'default' attribute the binding compiler compiles my binding.
> 
> Any help?
> 
> 
> Regards,
> Ivens
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
> 
> 
> 


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic