Hi Joshua,
I have made your changes and now get a different error message:
The binding file now looks like this:
<binding>
<mapping name="attribute-list"
class="com.wanadoo.uk.sdc.SDCAttributeList">
<collection field="attributes"
item-type="SDCAttribute"/>
</mapping>
<mapping name="attribute"
class="com.wanadoo.uk.sdc.SDCAttribute">
<value style="attribute" name="name"
field="attributeName"/>
<collection field="attributeValues"
item-type="SDCAttributeValue"/>
</mapping>
<mapping name="attr-value"
class="com.wanadoo.uk.sdc.SDCAttributeValue">
<value name="name" field="valName"/>
<value name="count" field="valCount"/>
<value name="url" field="valURL"/>
<value name="url2" field="valURL2"/>
<value name="befid" field="valBefid"/>
</mapping>
</binding>
And I changed the classpath set to "bin" so the task looks like this:
<target name="new-Attribute-Bind">
<bind verbose="true" load="true"
binding="bin/com/wanadoo/uk/sdc/attributebinding.xml">
<classpathset dir="bin" />
</bind>
</target>
Now I get this error:
Buildfile: C:\ProjectFiles\Workspace3.1\JibxTest\build.xml
new-Attribute-Bind:
[bind] Using the following paths:
[bind] C:\ProjectFiles\Workspace3.1\JibxTest\bin
[bind] Using the following binding paths:
[bind] bin/com/wanadoo/uk/sdc/attributebinding.xml
[bind] Running binding compiler version jibx-rc1
[bind] java.lang.IllegalStateException: Internal error: Unable to
access data for SDCAttribute or java.lang.Object:
[bind] Class SDCAttribute not found in any classpath
[bind] at
org.jibx.binding.classes.ClassFile.isAssignmentCompatible(ClassFile.java
:936)
[bind] at
org.jibx.binding.classes.ClassFile.getBestAccessibleMethod(ClassFile.jav
a:993)
[bind] at
org.jibx.binding.classes.ClassFile.getBestMethod(ClassFile.java:1051)
[bind] at
org.jibx.binding.model.ClassWrapper.getBestMethod(ClassWrapper.java:236)
[bind] at
org.jibx.binding.model.CollectionElement.prevalidate(CollectionElement.j
ava:370)
[bind] at
org.jibx.binding.model.ValidationContext$PrevalidationVisitor.visit(Vali
dationContext.java:249)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:70)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:82)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:94)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:131)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:158)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:235)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:235)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:125)
[bind] at
org.jibx.binding.model.ValidationContext.prevalidate(ValidationContext.j
ava:89)
[bind] at
org.jibx.binding.model.BindingElement.runValidation(BindingElement.java:
539)
[bind] at
org.jibx.binding.model.BindingElement.validateBinding(BindingElement.jav
a:589)
[bind] at
org.jibx.binding.Utility.validateBinding(Utility.java:227)
[bind] at org.jibx.binding.Utility.loadBinding(Utility.java:268)
[bind] at
org.jibx.binding.Utility.loadFileBinding(Utility.java:388)
[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(DefaultExecut
or.java:40)
[bind] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)
[bind] at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)
[bind] java.lang.IllegalStateException: Internal error: Unable to
access data for SDCAttributeValue or java.lang.Object:
[bind] Class SDCAttributeValue not found in any classpath
[bind] at
org.jibx.binding.classes.ClassFile.isAssignmentCompatible(ClassFile.java
:936)
[bind] at
org.jibx.binding.classes.ClassFile.getBestAccessibleMethod(ClassFile.jav
a:993)
[bind] at
org.jibx.binding.classes.ClassFile.getBestMethod(ClassFile.java:1051)
[bind] at
org.jibx.binding.model.ClassWrapper.getBestMethod(ClassWrapper.java:236)
[bind] at
org.jibx.binding.model.CollectionElement.prevalidate(CollectionElement.j
ava:370)
[bind] at
org.jibx.binding.model.ValidationContext$PrevalidationVisitor.visit(Vali
dationContext.java:249)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:70)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:82)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:94)
[bind] at
org.jibx.binding.model.ModelVisitor.visit(ModelVisitor.java:131)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:158)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:235)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:235)
[bind] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:125)
[bind] at
org.jibx.binding.model.ValidationContext.prevalidate(ValidationContext.j
ava:89)
[bind] at
org.jibx.binding.model.BindingElement.runValidation(BindingElement.java:
539)
[bind] at
org.jibx.binding.model.BindingElement.validateBinding(BindingElement.jav
a:589)
[bind] at
org.jibx.binding.Utility.validateBinding(Utility.java:227)
[bind] at org.jibx.binding.Utility.loadBinding(Utility.java:268)
[bind] at
org.jibx.binding.Utility.loadFileBinding(Utility.java:388)
[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(DefaultExecut
or.java:40)
[bind] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)
[bind] at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)
[bind] Error: Can't find class SDCAttribute for collection element
at (line 3, col 60, in bin/com/wanadoo/uk/sdc/attributebinding.xml)
[bind] Error: Error during validation: Internal error: Unable to
access data for SDCAttribute or java.lang.Object:
[bind] Class SDCAttribute not found in any classpath for collection
element at (line 3, col 60, in
bin/com/wanadoo/uk/sdc/attributebinding.xml)
[bind] Error: Can't find class SDCAttributeValue for collection
element at (line 7, col 70, in
bin/com/wanadoo/uk/sdc/attributebinding.xml)
[bind] Error: Error during validation: Internal error: Unable to
access data for SDCAttributeValue or java.lang.Object:
[bind] Class SDCAttributeValue not found in any classpath for
collection element at (line 7, col 70, in
bin/com/wanadoo/uk/sdc/attributebinding.xml)
[bind] Error: Cannot find information for class SDCAttributeValue
for mapping element at (line 9, col 55, in
bin/com/wanadoo/uk/sdc/attributebinding.xml)
[bind] Error running binding compiler
[bind] org.jibx.runtime.JiBXException: Binding
bin/com/wanadoo/uk/sdc/attributebinding.xml is unusable because of
validation errors
[bind] at org.jibx.binding.Utility.loadBinding(Utility.java:360)
[bind] at
org.jibx.binding.Utility.loadFileBinding(Utility.java:388)
[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(DefaultExecut
or.java:40)
[bind] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)
[bind] at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)
However if I remove the FQDN from the binding file and run the following
from the command line:
java -cp c:\jibx\lib\jibx-bind.jar org.jibx.binding.Compile -v
attributebinding.xml
Everything works first time. I think the ant task has issues.
Output from the successful run:
Using paths:
c:\jibx\lib\jibx-bind.jar
c:\jibx\lib\bcel.jar
c:\jibx\lib\jibx-run.jar
c:\jibx\lib\xpp3.jar
.
Using bindings:
attributebinding.xml
Running binding compiler version jibx-rc1
binding attributebinding:
context (mp#=3) (cv#=0) (fm#=0)
mapping class SDCAttributeList to element attribute-list (#0)
context (cv#=0) (fm#=0)
element wrapper attribute-list
object binding for SDCAttributeList
structure ordered
component property attributes (java.util.ArrayList)
object binding for java.util.ArrayList
collection ordered (SDCAttribute)
mapping reference to SDCAttribute using property from
collection (SDCA
tribute)
mapping class SDCAttribute to element attribute (#1)
context (cv#=0) (fm#=0)
element wrapper attribute
object binding for SDCAttribute
structure ordered
attribute name from property attributeName (java.lang.String)
component property attributeValues (java.util.ArrayList)
object binding for java.util.ArrayList
collection ordered (SDCAttributeValue)
mapping reference to SDCAttributeValue using property from
collection
SDCAttributeValue)
mapping class SDCAttributeValue to element attr-value (#2)
context (cv#=0) (fm#=0)
element wrapper attr-value
object binding for SDCAttributeValue
structure ordered
element name from property valName (java.lang.String)
element count from property valCount (int)
element url from property valURL (java.lang.String)
element url2 from property valURL2 (java.lang.String)
element befid from property valBefid (int)
Generating code for mapping SDCAttributeList
Generating code for mapping SDCAttribute
Generating code for mapping SDCAttributeValue
After linking view of binding attributebinding:
binding attributebinding:
context (mp#=3) (cv#=0) (fm#=0)
mapping class SDCAttributeList to element attribute-list (#0)
context (cv#=0) (fm#=0)
element wrapper attribute-list
object binding for SDCAttributeList
structure ordered
component property attributes (java.util.ArrayList)
object binding for java.util.ArrayList
collection ordered (SDCAttribute)
mapping reference to SDCAttribute using property from
collection (SDCA
tribute)
mapping class SDCAttribute to element attribute (#1)
context (cv#=0) (fm#=0)
element wrapper attribute
object binding for SDCAttribute
structure ordered
component property attributeValues (java.util.ArrayList)
object binding for java.util.ArrayList
collection ordered (SDCAttributeValue)
mapping reference to SDCAttributeValue using property from
collection
SDCAttributeValue)
attribute name from property attributeName (java.lang.String)
mapping class SDCAttributeValue to element attr-value (#2)
context (cv#=0) (fm#=0)
element wrapper attr-value
object binding for SDCAttributeValue
structure ordered
element name from property valName (java.lang.String)
element count from property valCount (int)
element url from property valURL (java.lang.String)
element url2 from property valURL2 (java.lang.String)
element befid from property valBefid (int)
Wrote 8 files
SDCAttributeList output file size is 2823 bytes
SDCAttribute output file size is 3712 bytes
SDCAttributeValue output file size is 4069 bytes
JiBX_attributebindingSDCAttributeList_access output file size is 1832
bytes
JiBX_attributebindingSDCAttribute_access output file size is 2057 bytes
JiBX_attributebindingSDCAttributeValue_access output file size is 1832
bytes
JiBX_attributebindingFactory output file size is 2485 bytes
JiBX_MungeAdapter output file size is 2828 bytes
Kept 0 files unchanged:
Deleted 0 files:
I will try to create an ant task that we can use as we need to integrate
this with our deployment.
Adam.
>
>
> You need to fully qualify the classnames in your binding file:
>
> <mapping name="attribute-list"
> class="com.wanadoo.uk.sdc.SDCAttributeList">
> <collection field="attributes" item-type="SDCAttribute"/>
>
> <mapping name="attribute" class="com.wanadoo.uk.sdc.SDCAttribute">
>
> Also, the <classpathset> in your ant task probably isn't
> doing what you think it's doing - the classpath elements in
> the <bind> task tell jibx where to resolve unknown classes.
> That should actually be:
>
> <classpathset dir="bin" />
This email and the files transmitted with it are meant solely for the use of
the individual addressee(s) named above. They may contain confidential and/or
legally privileged information. If you are not the addressee(s) or responsible
for delivery of the message to the addressee(s), please delete it from your
system and contact the sender right away. The opinions, conclusions and other
information in this message which do not relate to the official business of
Wanadoo UK plc are not necessarily endorsed by it. Wanadoo UK plc has taken
steps to ensure that this email and any attachments are virus-free, but it
remains your responsibility to confirm and ensure this.
Wanadoo UK plc is a subsidiary of France Telecom SA. Our registered office is
at: Verulam Point, Station Way, St. Albans, Herts, AL1 5HE, and we are
registered in England and Wales, as Company No. 3014367
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users