You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@visi.com> on 2009/09/10 08:43:29 UTC

Re: TR: [jira] Created: (OPENEJB-1063) Main-Class containing "/" instead of "." fails java.lang.NoClassDefFoundError: IllegalName:

On Aug 26, 2009, at 1:17 AM, Monteiro Jean-Louis wrote:

> The JAR specification isn't clear and AFAIK does not define if the  
> main class must use "." instead of "/".
>
> But, since jdk 5, Classloader seems to explicitly check if the name  
> contains a "/". Here is an interesting link http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4986512
>
> Even if it's definitely an error from the jar provider, you are  
> sometimes required to use old jars (< jdk 5) with this kind of format.
> Since last release (3.1.1) David has changed app client deployment  
> rules and OpenEJB doesn't fail anymore if a NoClassDefFoundError  
> occurs without an application-client.xml descriptor.
>
> May be we can provide a warn if an app client module contains a bad  
> Main-Class format and try to replace "/" by "."

We should definitely do a "/" to "." conversion before trying the  
class name if it this is the case -- we probably can do that the first  
time around as slashes aren't legal class names anyway.

I forget how the warning logic goes for bad app client classes.  I  
think the logic is that an error or validation failure is issued for a  
bad Main-Class if you have a META-INF/application-client.xml file as  
then we know for sure your jar is an app client.  If it doesn't have a  
META-INF/application-client.xml then we log on debug if we can't load  
the Main-Class.  Should be that if it isn't -- seems like a nice  
middle ground anyway.


-David