You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by js...@apache.org on 2006/05/01 13:48:42 UTC

svn commit: r398577 - in /geronimo/branches/1.1/modules: jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Author: jsisson
Date: Mon May  1 04:48:36 2006
New Revision: 398577

URL: http://svn.apache.org/viewcvs?rev=398577&view=rev
Log:
GERONIMO-1949 - Some Tomcat & Jetty web app deployment errors do not identify web app module name associated with the error

Modified:
    geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=398577&r1=398576&r2=398577&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Mon May  1 04:48:36 2006
@@ -206,7 +206,10 @@
             WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
             webApp = webAppDoc.getWebApp();
         } catch (XmlException xmle) {
-            throw new DeploymentException("Error parsing web.xml", xmle);
+            // Output the target path in the error to make it clearer to the user which webapp
+            // has the problem.  The targetPath is used, as moduleFile may have an unhelpful
+            // value such as C:\geronimo-1.1\var\temp\geronimo-deploymentUtil22826.tmpdir
+            throw new DeploymentException("Error parsing web.xml for "+ targetPath, xmle);
         }
         check(webApp);
 
@@ -277,7 +280,7 @@
                             try {
                                 rawPlan = XmlBeansUtil.parse(path);
                             } catch (FileNotFoundException e1) {
-                                log.warn("Web application does not contain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a problem, depending on whether you have things like resource references that need to be resolved.  You can also give the deployer a separate deployment plan file on the command line.");
+                                log.warn("Web application " +targetPath + " does not contain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a problem, depending on whether you have things like resource references that need to be resolved.  You can also give the deployer a separate deployment plan file on the command line.");
                             }
                         }
                     }
@@ -298,7 +301,7 @@
             }
             return jettyWebApp;
         } catch (XmlException e) {
-            throw new DeploymentException("xml problem", e);
+            throw new DeploymentException("xml problem for web app "+targetPath, e);
         }
     }
 
@@ -318,7 +321,7 @@
         ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(), messageDestinations, gerMessageDestinations);
         if ((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0) &&
                 !gerWebApp.isSetSecurityRealmName()) {
-            throw new DeploymentException("web.xml includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
+            throw new DeploymentException("web.xml for web app " + module.getName() + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
         }
         if (gerWebApp.isSetSecurity()) {
             if (!gerWebApp.isSetSecurityRealmName()) {
@@ -482,7 +485,7 @@
 
             JspConfigType[] jspConfigArray = webApp.getJspConfigArray();
             if (jspConfigArray.length > 1) {
-                throw new DeploymentException("At most one jsp-config element, not " + jspConfigArray.length);
+                throw new DeploymentException("Web app "+ module.getName() +" cannot have more than one jsp-config element.  Currently has " + jspConfigArray.length +" jsp-config elements.");
             }
             Map tagLibMap = new HashMap();
             for (int i = 0; i < jspConfigArray.length; i++) {
@@ -496,7 +499,7 @@
 
             LoginConfigType[] loginConfigArray = webApp.getLoginConfigArray();
             if (loginConfigArray.length > 1) {
-                throw new DeploymentException("At most one login-config element, not " + loginConfigArray.length);
+                throw new DeploymentException("Web app "+ module.getName() +" cannot have more than one login-config element.  Currently has " + loginConfigArray.length +" login-config elements.");
             }
             if (loginConfigArray.length == 1) {
                 LoginConfigType loginConfig = loginConfigArray[0];
@@ -544,7 +547,9 @@
                 ServletMappingType servletMappingType = servletMappingArray[i];
                 String servletName = servletMappingType.getServletName().getStringValue().trim();
                 if (!knownServlets.contains(servletName)) {
-                    throw new DeploymentException("Servlet mapping refers to servlet '" + servletName + "' but no such servlet was found!");
+                    throw new DeploymentException("Web app " + module.getName() +
+                            " contains a servlet mapping that refers to servlet '" + servletName + 
+                            "' but no such servlet was found!");
                 }
                 String urlPattern = servletMappingType.getUrlPattern().getStringValue().trim();
                 if (!knownServletMappings.contains(urlPattern)) {
@@ -748,7 +753,7 @@
         } catch (DeploymentException de) {
             throw de;
         } catch (Exception e) {
-            throw new DeploymentException("Unable to initialize webapp GBean", e);
+            throw new DeploymentException("Unable to initialize webapp GBean for "+module.getName(), e);
         }
     }
 
@@ -839,13 +844,13 @@
             try {
                 servletClass = webClassLoader.loadClass(servletClassName);
             } catch (ClassNotFoundException e) {
-                throw new DeploymentException("Could not load servlet class " + servletClassName, e);
+                throw new DeploymentException("Could not load servlet class " + servletClassName, e); // TODO identify web app in message
             }
             Class baseServletClass;
             try {
                 baseServletClass = webClassLoader.loadClass(Servlet.class.getName());
             } catch (ClassNotFoundException e) {
-                throw new DeploymentException("Could not load javax.servlet.Servlet in web classloader", e);
+                throw new DeploymentException("Could not load javax.servlet.Servlet in web classloader", e); // TODO identify web app in message
             }
             if (baseServletClass.isAssignableFrom(servletClass)) {
                 servletData = new GBeanData(servletAbstractName, JettyServletHolder.GBEAN_INFO);
@@ -856,7 +861,7 @@
                 //let the web service builder deal with configuring the gbean with the web service stack
                 Object portInfo = portMap.get(servletName);
                 if (portInfo == null) {
-                    throw new DeploymentException("No web service deployment info for servlet name " + servletName);
+                    throw new DeploymentException("No web service deployment info for servlet name " + servletName); // TODO identify web app in message
                 }
                 getWebServiceBuilder().configurePOJO(servletData, moduleFile, portInfo, servletClassName, webClassLoader);
             }
@@ -866,7 +871,7 @@
             //TODO MAKE THIS CONFIGURABLE!!! Jetty uses the servlet mapping set up from the default-web.xml
             servletData.setAttribute("servletClass", "org.apache.jasper.servlet.JspServlet");
         } else {
-            throw new DeploymentException("Neither servlet class nor jsp file is set for " + servletName);
+            throw new DeploymentException("Neither servlet class nor jsp file is set for " + servletName); // TODO identify web app in message
         }
 
         // link to previous servlet, if there is one, so that we
@@ -904,7 +909,7 @@
         try {
             earContext.addGBean(servletData);
         } catch (GBeanAlreadyExistsException e) {
-            throw new DeploymentException("Could not add servlet gbean to context", e);
+            throw new DeploymentException("Could not add servlet gbean to context", e); // TODO identify web app in message
         }
         return servletAbstractName;
     }

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=398577&r1=398576&r2=398577&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java Mon May  1 04:48:36 2006
@@ -151,7 +151,10 @@
             WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
             webApp = webAppDoc.getWebApp();
         } catch (XmlException xmle) {
-            throw new DeploymentException("Error parsing web.xml", xmle);
+            // Output the target path in the error to make it clearer to the user which webapp
+            // has the problem.  The targetPath is used, as moduleFile may have an unhelpful
+            // value such as C:\geronimo-1.1\var\temp\geronimo-deploymentUtil22826.tmpdir
+            throw new DeploymentException("Error parsing web.xml for "+targetPath, xmle);
         }
         check(webApp);
 
@@ -224,7 +227,7 @@
                             try {
                                 rawPlan = XmlBeansUtil.parse(path);
                             } catch (FileNotFoundException e1) {
-                                log.warn("Web application does not contain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a problem, depending on whether you have things like resource references that need to be resolved.  You can also give the deployer a separate deployment plan file on the command line.");
+                                log.warn("Web application "+ targetPath + " does not contain a WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a problem, depending on whether you have things like resource references that need to be resolved.  You can also give the deployer a separate deployment plan file on the command line.");
                             }
                         }
                     }
@@ -245,7 +248,7 @@
             }
             return tomcatWebApp;
         } catch (XmlException e) {
-            throw new DeploymentException("xml problem", e);
+            throw new DeploymentException("xml problem for web app "+targetPath, e);
         }
     }
 
@@ -266,7 +269,7 @@
         ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(), messageDestinations, gerMessageDestinations);
         if((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0) &&
                 !gerWebApp.isSetSecurityRealmName()) {
-            throw new DeploymentException("web.xml includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
+            throw new DeploymentException("web.xml for web app " + module.getName() + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
         }
         if (gerWebApp.isSetSecurity()) {
             if (!gerWebApp.isSetSecurityRealmName()) {
@@ -384,7 +387,7 @@
                         String servletClassName = servletType.getServletClass().getStringValue().trim();
                         Object portInfo = portMap.get(servletName);
                         if (portInfo == null) {
-                            throw new DeploymentException("No web service deployment info for servlet name " + servletName);
+                            throw new DeploymentException("No web service deployment info for servlet name " + servletName +" in web app "+module.getName());
                         }
 
                         WebServiceContainer wsContainer = configurePOJO(webModule.getModuleFile(), portInfo, servletClassName, moduleClassLoader);
@@ -443,7 +446,7 @@
         } catch (DeploymentException de) {
             throw de;
         } catch (Exception e) {
-            throw new DeploymentException("Unable to initialize webapp GBean", e);
+            throw new DeploymentException("Unable to initialize GBean for web app "+module.getName(), e);
         }
     }