File: faq.htm

package info (click to toggle)
libjibx1.2-java 1.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,260 kB
  • sloc: java: 75,013; xml: 14,068; makefile: 17
file content (173 lines) | stat: -rw-r--r-- 8,842 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>JiBX: Frequently asked questions</title>
</head>
<body class="composite">
      <div id="bodycol">
      <div class="app">
      <div class="h3">
      <h3><a name="questions">Questions</a></h3>

<p><a href="#bcel">What does it mean when I get
<code>java.lang.IncompatibleClassChangeError</code> thrown while trying to
compile a binding?</a></p>

<p><a href="#nobind">What does it mean when I get
<code>org.jibx.runtime.JiBXException: Unable to access binding information for
class ...</code> thrown while trying to run my
application with JiBX?</a></p>

<p><a href="#npe">Why do I get a <code>java.lang.NullPointerException</code>
when I try to marshal a document?</a></p>

<p><a href="#package">How can I control the package used for the classes
generated by JiBX (including the binding factory class or classes, and the
<code>JiBX_MungeAdapter.class</code>)?</a></p>

<p><a href="#jdo">Does JiBX work with other bytecode modification techniques,
such as JDO or Hibernate?</a></p>

<p><a href="#jdk">Which JDK versions are supported by JiBX?</a></p>

<p><a href="#schema">Is there a DTD or schema available for the binding definitions?</a></p>

<p><a href="#axis2">I want to use JiBX data binding with Axis2. How can I learn
more about this combination?</a></p>

<p><a href="#example">Where can I find more information or examples?</a></p>

	  </div>
      <div class="h3">
      <h3><a name="answers">Answers</a></h3>

<p><a name="bcel"></a><b>Q. What does it mean when I get
<code>java.lang.IncompatibleClassChangeError</code> thrown while trying to
compile a binding?</b><br/>
<b>A. </b>This is caused by having an older version of the Apache BCEL library somewhere
in your classpath ahead of the JiBX libraries. It usually occurs when using the
Ant binding task, because Ant often includes an XSLT library named
<i>xsltc.jar</i> in the classpath, and this library uses BCEL. It could also
occur outside of Ant if you have <i>xsltc.jar</i> in your Java installation's
<i>/lib/ext</i> directory. <i>xalan.jar</i> can also cause the same problem, and
for the same reason.</p>

<hr/>

<p><a name="nobind"></a><b>Q. What does it mean when I get
<code>org.jibx.runtime.JiBXException: Unable to access binding information for
class ...</code> thrown while trying to run my application with JiBX?</b><br/>
<b>A. </b>This means your class files (or at least the one for the class you asked the
<code>org.jibx.runtime.BindingDirectory</code> to look up) haven't been processed
by the JiBX binding compiler. Check your build process and make sure you're
doing the binding compiler step. This problem has been known to occur in some
IDEs when the IDE uses a different location for compiled class files from what
is used by an Ant build script or manual build process.</p>

<hr/>

<p><a name="npe"></a><b>Q. Why do I get a <code>java.lang.NullPointerException</code>
when I try to marshal a document?</b><br/>
<b>A. </b>The most likely cause is that you've got a <code>null</code> value
for an object that's not marked as optional in the binding definition. JiBX
trusts what you tell it, so if you don't say an object property is optional the
generated code won't check for a <code>null</code>. To isolate the cause of this
type of problem, look through the stack trace (starting at the top) for the
first class name from your code. This will normally be the class that contains
the null property. You can then verify the binding definition for that class. If
it's not obvious which property is causing the problem, add a <b>pre-get</b>
method to that class for debugging purposes which checks if any of the
non-optional object properties used by the binding are <code>null</code>
(throwing an exception when it finds a <code>null</code>, with any added
information you want to see). This will let you find out all the details of the
problem so that you can fix either the code or the binding, whichever is wrong.</p>

<hr/>

<p><a name="package"></a><b>Q. How can I control the package used for the classes
generated by JiBX (including the binding factory class or classes, and the
<code>JiBX_MungeAdapter.class</code>)?</b><br/>
<b>A. </b>You can control the package used for the binding factory class for a
binding by using the <b>package</b> attribute of the <b>binding</b> element. The
<code>JiBX_MungeAdapter.class</code> is only generated if needed. When needed,
it's created in the package of the first <b>mapping</b> class which is both
modifiable (a class defined in its own file, rather than in a jar file) and not
an interface. If you need this to be in a particular package (as may happen when
you're binding classes that have package access), include a <b>mapping</b> for
one of the classes in this package before any other <b>mapping</b>s in the
binding definition, and if you're compiling more than one binding make the one
with this <b>mapping</b> the first one in the list. If necessary, you can
compile bindings in multiple sets to get more than one
<code>JiBX_MungeAdapter.class</code> in different packages. This only works if
you have bindings with no overlapping packages, though - otherwise running the
binding compiler twice with different sets of bindings will cause information
from the first set to be lost.</p>

<hr/>

<p><a name="jdo"></a><b>Q. Does JiBX work with other bytecode modification
techniques, such as JDO or Hibernate?</b><br/>
<b>A. </b>Yes, JiBX works well with other frameworks which build on bytecode
modification. In the case of JDO you'll generally need to run the JiBX binding
compiler before you run the JDO bytecode enhancement, since the latter may need
to intercept field accesses from the JiBX code. In the case of Hibernate this is
not an issue, since Hibernate only uses runtime bytecode enhancements; however,
you will generally need to have JiBX use get/set methods rather than directly
access fields with working with Hibernate.</p>

<hr/>

<p><a name="jdk"></a><b>Q. Which JDK versions are supported by JiBX?</b><br/>
<b>A. </b>The JiBX runtime and binding compiler have been tested on JDK versions
1.3-1.6. There are some minor differences on the <a href="%building%">build</a>
for JDK 1.3, but these differences do not effect the runtime operation. The new
JiBX tools introduced with the 1.2 release () require JDK 1.4.1 or higher.</p>

<hr/>

<p><a name="schema"></a><b>Q. Is there a DTD or schema available for the binding
definitions?</b><br/>
<b>A. </b>The <i>/docs</i> directory of the distribution includes both a DTD
(<i>binding.dtd</i>) and an XML schema (<i>binding.xsd</i>) for the binding
definitions. These will hopefully be kept up to date, but the definitive
reference for the binding definition format is the <a href="%defdetails%">HTML
documentation</a>.</p>

<hr/>

<p><a name="axis2"></a><b>Q. I want to use JiBX data binding with Axis2. How can
I learn more about this combination?</b><br/>
<b>A. </b>There's an <a href="%axis2%">Axis2</a> subproject page on this site which
provides some basic information and links, and that page will be expanded to
include more information for the upcoming JiBX 1.2 beta release. Beyond that, I offer an
<a href="http://www.sosnoski.com/companys/axis2class.html">Apache Axis2 training
class</a> that covers all three major data binding frameworks supported by Axis2,
including JiBX. Depending on your needs, the class can be customized to provide
more in-depth coverage of the JiBX framework, and can also include coverage of the
JiBX/WS web services support. This class can also be combined with my
<a href="http://www.sosnoski.com/companys/soaclass.html">SOA developers training
class</a> for organizations that are moving to a SOA structure and want to use
JiBX in this context.</p>

<hr/>

<p><a name="example"></a><b>Q. Where can I find more information or examples?</b><br/>
<b>A. </b>There are
searchable archives for the JiBX mailing lists, at the Mail Archive (<a
href="http://www.mail-archive.com/jibx-users%40lists.sourceforge.net/">jibx-users</a>
and <a href="http://www.mail-archive.com/jibx-devs%40lists.sourceforge.net/">jibx-devs</a>)
and MARC: Mailing List Archives at AIMS
(<a href="http://marc.theaimsgroup.com/?l=jibx-users&r=1&w=2">jibx-users</a>,
<a href="http://marc.theaimsgroup.com/?l=jibx-devs&r=1&w=2">jibx-devs</a>, and
<a href="http://marc.theaimsgroup.com/?l=jibx-cvs&r=1&w=2">jibx-cvs</a>). You're
welcome to ask questions on the mailing lists (especially the <b>jibx-users</b>
list), but it's always a good idea to check the archives first before asking a
usage question, just in case it's already been discussed. The archives are
public, but you must subscribe to each list before you can post to that list.</p>

      </div>
      </div>
      </div>
</body>
</html>