| <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>EJB Validation FAQ</title><link href="default.css" rel="stylesheet"></head><body marginwidth="0" marginheight="0" leftmargin="0" bottommargin="0" topmargin="0" vlink="#6763a9" link="#6763a9" bgcolor="#ffffff"><a name="top"></a><table height="400" width="712" cellspacing="0" cellpadding="0" border="0"><tr><td bgcolor="#7270c2" align="left" valign="top" width="20"><img border="0" height="1" width="1" src="images/dotTrans.gif"></td><td bgcolor="#7270c2" align="left" valign="top" width="95"><img border="0" height="1" width="1" src="images/dotTrans.gif"></td><td align="left" valign="top" width="7"><img height="1" width="1" border="0" src="images/dotTrans.gif"></td><td align="left" valign="top" width="40"><img border="0" height="6" width="40" src="images/dotTrans.gif"></td><td align="left" valign="top" width="440"><img border="0" height="6" width="440" src="images/top_2.gif"></td><td align="left" valign="top" width="240"><img src="images/top_3.gif" width="240" height="6" border="0"></td></tr><tr><td align="left" valign="top" bgcolor="#7270c2" width="20"><img height="1" width="1" border="0" src="images/dotTrans.gif"></td><td align="left" valign="top" bgcolor="#7270c2" width="95"><img height="1" width="1" border="0" src="images/dotTrans.gif"></td><td align="left" valign="top" bgcolor="#ffffff" width="7"></td><td align="left" valign="top" width="40"><img border="0" height="1" width="1" src="images/dotTrans.gif"></td><td align="left" valign="middle" width="440"><span class="bodyBlack"><a href="faq.html">FAQ</a></span><img border="0" height="13" width="20" src="images/grayDot.gif"><span class="bodyBlack"><a href="faq_validation.html">EJB Validation FAQ</a></span><br><img border="0" height="2" width="1" src="images/dotTrans.gif"></td><td align="left" valign="top" height="20" width="240"> </td></tr><tr><td align="left" valign="top" bgcolor="#7270c2" width="20"><img border="0" height="3" width="20" src="images/dotTrans.gif"></td><td align="left" valign="top" bgcolor="#7270c2" width="95"><img border="0" height="3" width="105" src="images/line_sm.gif"></td><td align="left" valign="top" bgcolor="#a9a5de" width="7"><img border="0" height="3" width="7" src="images/line_sm.gif"></td><td align="left" valign="top" width="40"><img border="0" height="3" width="40" src="images/line_light.gif"></td><td align="left" valign="top" width="440"><img border="0" height="3" width="440" src="images/line_light.gif"></td><td align="left" valign="top" width="240"><img height="1" width="1" border="0" src="images/dotTrans.gif"></td></tr><tr><td align="left" valign="top" bgcolor="#7270c2"><img border="0" height="10" width="20" src="images/dotTrans.gif"></td><td align="left" valign="top" bgcolor="#7270c2" width="95"><img border="0" height="2" width="1" src="images/dotTrans.gif"><br><table cellspacing="0" cellpadding="0" border="0"><tr><td align="left" valign="top"><span class="subMenuOn">Main</span></td></tr><tr><td align="left" valign="top"><a href="index.html"><span class="subMenuOff"> |
| Welcome!</span></a></td></tr><tr><td align="left" valign="top"><a href="download.html"><span class="subMenuOff"> |
| Download</span></a></td></tr><tr><td align="left" valign="top"><a href="lists.html"><span class="subMenuOff"> |
| Mailing Lists</span></a></td></tr><tr><td align="left" valign="top"><a href="cvs.html"><span class="subMenuOff"> |
| Source Code</span></a></td></tr><tr><td align="left" valign="top"><a href="contributors.html"><span class="subMenuOff"> |
| The Team</span></a></td></tr><tr><td align="left" valign="top"><a href="status.html"><span class="subMenuOff"> |
| Status</span></a></td></tr></table><table cellspacing="0" cellpadding="0" border="0"><tr><td align="left" valign="top"><span class="subMenuOn">Users</span></td></tr><tr><td align="left" valign="top"><a href="quickstart.html"><span class="subMenuOff"> |
| Quickstart</span></a></td></tr><tr><td align="left" valign="top"><a href="hello-world.html"><span class="subMenuOff"> |
| Hello World!</span></a></td></tr><tr><td align="left" valign="top"><a href="cmp_entity_postgresql.html"><span class="subMenuOff"> |
| CMP Example</span></a></td></tr><tr><td align="left" valign="top"><a href="cmp_guide.html"><span class="subMenuOff"> |
| CMP Guide</span></a></td></tr><tr><td align="left" valign="top"><a href="deploy.html"><span class="subMenuOff"> |
| Deploy</span></a></td></tr><tr><td align="left" valign="top"><a href="start-command.html"><span class="subMenuOff"> |
| Startup</span></a></td></tr><tr><td align="left" valign="top"><a href="validate.html"><span class="subMenuOff"> |
| Validation</span></a></td></tr><tr><td align="left" valign="top"><a href="config_containers.html"><span class="subMenuOff"> |
| Configuration</span></a></td></tr><tr><td align="left" valign="top"><a href="properties.html"><span class="subMenuOff"> |
| Properties</span></a></td></tr></table><table cellspacing="0" cellpadding="0" border="0"><tr><td align="left" valign="top"><span class="subMenuOn">Servers</span></td></tr><tr><td align="left" valign="top"><a href="embedded.html"><span class="subMenuOff"> |
| Local Server</span></a></td></tr><tr><td align="left" valign="top"><a href="remote-server.html"><span class="subMenuOff"> |
| Remote Server</span></a></td></tr><tr><td align="left" valign="top"><a href="tomcat.html"><span class="subMenuOff"> |
| Tomcat</span></a></td></tr><tr><td align="left" valign="top"><a href="geronimo.html"><span class="subMenuOff"> |
| Geronimo</span></a></td></tr></table><table cellspacing="0" cellpadding="0" border="0"><tr><td align="left" valign="top"><span class="subMenuOn">Integrators</span></td></tr><tr><td align="left" valign="top"><a href="whyopenejb.html"><span class="subMenuOff"> |
| Why OpenEJB</span></a></td></tr><tr><td align="left" valign="top"><a href="containersystem.html"><span class="subMenuOff"> |
| Overview</span></a></td></tr><tr><td align="left" valign="top"><a href="design_openejb.html"><span class="subMenuOff"> |
| Design</span></a></td></tr><tr><td align="left" valign="top"><a href="OpenEJB_presentaion.ppt"><span class="subMenuOff"> |
| Presentation</span></a></td></tr></table><img border="0" height="15" width="1" src="images/dotTrans.gif"><br><img border="0" height="3" width="105" src="images/line_sm.gif"><br><A href="http://codehaus.org"><IMG alt="The Codehaus" border="0" height="17" width="88" src="http://www.openejb.org/codehaus-smaller.png"></A></td><td align="left" valign="top" bgcolor="#a9a5de" width="7"> </td><td align="left" valign="top" width="40"> </td><td valign="top" width="440" rowspan="4"><p></p><table width="100%" cellspacing="2" cellpadding="4"><tr><td align="left" valign="top"><br><img width="200" vspace="0" src="./images/logo_ejb2.gif" hspace="0" height="55" border="0"><br><img src="images/dotTrans.gif" hspace="0" height="7" border="0"><br></td></tr><tr><td><span class="pageTitle"><name>EJB Validation FAQ</name></span></td></tr><tr><td><ul><li><span class="toc"><a href="#misslocated.class">Misslocated class or NoClassDefFoundError</a></span></li></ul></td></tr><tr><td><a name="misslocated.class"><h2>Misslocated class or NoClassDefFoundError</h2></a><answer id="misslocated.class"> |
| <p><span class="bodyBlack"> |
| The short explanation is that the parent doesn't have all the classes it needs as some of them |
| are only in the child classloader, where the parent can't see them. |
| </span></p> |
| <p><span class="bodyBlack"> |
| This would occur, for example, if a class was loaded by the parent classloader, but that |
| class' superclass wasn't visible to the parent classloader, perhaps because it is only in the |
| child classloader. |
| </span></p> |
| <p><span class="bodyBlack"> |
| Here is a more concrete example: |
| <span class="code-block"> |
| public interface Person extends EJBObject { |
| } |
| |
| public interface Employee extends Person { |
| } |
| </span> |
| </span></p> |
| <p><span class="bodyBlack"> |
| Ok, so when we build our ejb jar, we put both the Person and Employee interfaces in the jar, so |
| everything should be good (so we think). But now let's say that for some reason the Employee interface is |
| also in another jar and that jar was loaded into the system classpath. |
| </span></p> |
| <p><span class="bodyBlack"> |
| When a new classloader is create for my ejb-jar at runtime and the system attempts to load the |
| Employee interface, the call goes right through that classloader and down to the system classloader. |
| The Employee interface is found, because it was accidentally added to that extra jar in the system |
| classpath. So now the system classloader goes looking for Employee's superinterface, Person, |
| where it immediatly blows up and throws a NoClassDefFoundError: Person. |
| </span></p> |
| <p><span class="bodyBlack"> |
| Most people will look at their ejb-jar and think, "But all my classes are there!?", which is |
| true. It really doesn't matter though, because one of those classes is also in the parent |
| classloader. The first call to load that class will bypass your classloader completely and |
| go to the parent. Once there, it is the parent's job to find *all* the dependent classes. |
| If it can't ... NoClassDefFoundError. |
| </span></p> |
| </answer></td></tr></table></td><td align="left" valign="top" height="5" width="240"> |
| |
| </td></tr><tr height="5"><td align="left" valign="top" bgcolor="#7270c2" height="5" width="20"> </td><td valign="top" bgcolor="#7270c2" height="5" width="95"> </td><td align="left" valign="top" bgcolor="#a9a5de" height="5" width="7"> </td><td align="left" valign="top" height="5" width="40"> </td><td align="left" valign="top" height="5" width="240"> </td></tr><tr><td align="left" valign="top" bgcolor="#7270c2" height="5" width="20"> </td><td align="left" valign="top" bgcolor="#7270c2" width="95"> </td><td align="left" valign="top" bgcolor="#a9a5de" width="7"> </td><td align="left" valign="top" width="40"> </td><td align="left" valign="top" width="240"> </td></tr><tr height="5"><td align="left" valign="bottom" bgcolor="#7270c2" height="100%" rowspan="2" width="20"><img border="0" height="125" width="20" src="images/stripes1.gif"></td><td align="left" valign="bottom" bgcolor="#7270c2" height="100%" rowspan="2" width="95"><img border="0" height="125" width="105" src="images/stripe105.gif"></td><td align="left" valign="top" bgcolor="#a9a5de" height="100%" rowspan="2" width="7"> </td><td align="left" valign="top" height="100%" width="40"> </td><td align="left" valign="top" height="100%" width="240"> </td></tr><tr height="5"><td align="left" valign="top" height="25" width="40"> </td><td align="left" valign="bottom" height="25" width="440"><br><br><img height="3" width="440" border="0" src="images/line_light.gif"><br><p></p><span class="bodyGrey"><small><notice> |
| OpenEJB is a trademark of the OpenEJB Group. |
| Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered |
| trademarks of Sun Microsystems, Inc. in the United States and in other |
| countries. XML, XML Schema, XSLT and related standards are trademarks or registered |
| trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web |
| Consortium. All other product names mentioned herein are trademarks of their respective |
| owners. |
| </notice><br> <br></small></span><p></p> |
| |
| </td><td align="left" valign="top" height="25" width="240"> </td></tr></table></body></html> |