Author: dblevins
Date: Wed Aug  5 02:44:26 2009
New Revision: 801050

URL: http://svn.apache.org/viewvc?rev=801050&view=rev
Log:
Make missing Main-Class entries of ClientModules only a warning unless there is 
a META-INF/application-client.xml file which proves the jar was really intended 
to be an application client.

Modified:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=801050&r1=801049&r2=801050&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 Wed Aug  5 02:44:26 2009
@@ -688,14 +688,24 @@
                 try {
                     clazz = classLoader.loadClass(className);
                     remoteClients.add(clazz);
-                } catch (ClassNotFoundException e) {
-                    throw new OpenEJBException("Unable to load Client 
main-class: " + className, e);
-                }
-
-                ClassFinder inheritedClassFinder = 
createInheritedClassFinder(clazz);
 
-                buildAnnotatedRefs(client, inheritedClassFinder, classLoader);
+                    ClassFinder inheritedClassFinder = 
createInheritedClassFinder(clazz);
 
+                    buildAnnotatedRefs(client, inheritedClassFinder, 
classLoader);
+                } catch (ClassNotFoundException e) {
+                    /**
+                     * Some ClientModule are discovered only because the jar 
uses a Main-Class
+                     * entry in the MANIFEST.MF file.  Lots of jars do this 
that are not used as
+                     * java ee application clients, so lets not make this a 
failure unless it
+                     * has a META-INF/application-client.xml which tells us it 
is in fact
+                     * expected to be a ClientModule and not just some random 
jar.
+                     */
+                    if (clientModule.getApplicationClient() == null) {
+                        getValidationContext().warn("client.missingMainClass", 
className);
+                    } else {
+                        getValidationContext().fail("client.missingMainClass", 
className);
+                    }
+                }
             }
 
             for (String className : clientModule.getRemoteClients()) {

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties?rev=801050&r1=801049&r2=801050&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
 Wed Aug  5 02:44:26 2009
@@ -255,6 +255,12 @@
 3.injectionTarget.nameContainsSet = The injection-target-name "{0}" for setter 
methods should not begin with "set".  The last portion of the name "{1}" has 
been automatically corrected to "{2}".  Update the descriptor with the correct 
injection-target-name of "{3}" to avoid receiving this warning.  Resource to be 
injected is "{4}".
 
 # AnnotationDeployer.java
+# warn("client.missingMainClass", className)
+# fail("client.missingMainClass", className)
+1.client.missingMainClass = Missing Main-Class
+2.client.missingMainClass = Missing Main-Class: {0}
+3.client.missingMainClass = The Main-Class {0} specified in the MANIFEST.MF 
file does not exist in the jar.
+
 # fail(ejbName, "xml.localRemote.conflict", interfce);
 1.xml.localRemote.conflict = Interface illegally declared as both 
<business-local> and <business-remote>.
 2.xml.localRemote.conflict = Interface illegally declared as both 
<business-local> and <business-remote>: {0}


Reply via email to