Troubleshooting a Deployment - An Example


Not every one of your deployments will be successful. It is important for an administrator to know what to do when a deployment does not work. This example walks you through the steps in troubleshooting what went wrong when a module does not deploy.

To try out the example, look for the source code download at the book’s companion Web site. Look under the debugconsole directory, where you will find two elements:

  1. A deployable EAR called progeron.ear

  2. A deployment plan called deploy.xml

Now, deploy this application using either the command line or the Web console. Using the Web console, select the Deploy New link beneath the Applications heading. Enter the progeron.ear as Archive and the deploy.xml as plan.

Click on the Install button. You should get a blank page because of deployment problem. The deployment has obviously failed. You need more information to troubleshoot this deployment.

Checking Console Output

The first place to check when the Web console gives you a blank page is the operating system console window where Geronimo has started. In this case, there is a Java exception trace displayed in the console. A portion of this trace is shown here:

 Deployer operation failed: org.apache.xmlbeans.XmlException: Invalid deployment descriptor: [error: cvc-complex-type.2.4a: Expected elements 'module@http://gero nimo.apache.org/xml/ns/j2ee/application-1.1 ext-module@http://geronimo.apache.or g/xml/ns/j2ee/application-1.1 security@http://geronimo.apache.org/xml/ns/securit y-1.1 gbean@http://geronimo.apache.org/xml/ns/deployment-1. id@http://geronimo.apache.org/xml/ns/j2ee/application-1. Descriptor: <xml-fragment xmlns:dep="http://geronimo.apache.org/xml/ns/deploymen t-1.1" xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">   <dep:environment>     <dep:moduleId>       <dep:groupId>wrox</dep:groupId>       <dep:artifactId>progeron</dep:artifactId>       <dep:version>1.0</dep:version>       <dep:type>car</dep:type>     </dep:moduleId>   </dep:environment>   <app:notvalid/>   <app:module>     <app:ejb>progeron-ejbs.jar</app:ejb>     <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1">       <enterprise-beans>         <session>           <ejb-name>AuthorEJB</ejb-name>           <jndi-name>ejb/AuthorEJB</jndi-name>         </session>       </enterprise-beans>     </openejb-jar>   </app:module>   <app:module>     <app:web>progeron.war</app:web>     <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"></web -app>   </app:module> </xml-fragment> org.apache.geronimo.common.DeploymentException: org.apache.xmlbeans.XmlException : Invalid deployment descriptor: [error: cvc-complex-type.2.4a: Expected element s 'module@http://geronimo.apache.org/xml/ns/j2ee/application-1.1 ext-module@http ...         at org.apache.geronimo.schema.SchemaConversionUtils.validateDD(SchemaCon versionUtils.java:605)         at org.apache.geronimo.schema.SchemaConversionUtils.fixGeronimoSchema(Sc hemaConversionUtils.java:370)         at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.getEarPlan(EARCo nfigBuilder.java:327)         ... 21 more

In most cases (such as this one), the console trace output will put you on the right track to narrow down the problem. The boldfaced part of the preceding trace output says that there is a schema validation problem. Specifically, the schema is invalid because of an unexpected element called notvalid.

If the information on the console has scrolled away, or if you are running Geronimo as a service on the system, you may not be able to get this useful trace diagnostic. In this case, you must turn to the log for this information.

Examining the Geronimo Log File

All of the exceptions displayed on the command console are also captured in the Geronimo log file. You can find the log in the var/log directory, called geronimo.log. You can examine the log using a plain-old text editor. You will find the same exception information, shown in the following listing.

 05:43:02,296 DEBUG [Deployer] Deployment failed: plan=C:\gerbuild\geronimo- 1.1\var\temp\deploy.xml, module=C:\gerbuild\geronimo-1.1\var\temp\progeron.ear org.apache.geronimo.common.DeploymentException: org.apache.xmlbeans.XmlException: Invalid deployment descriptor: [error: cvc-complex-type.2.4a: Expected elements 'module@http://geronimo.apache.org/xml/ns/j2ee/application-1.1 ext- module@http://geronimo.apache.org/xml/ns/j2ee/application-1.1 security@http://geronimo.apache.org/xml/ns/security-1.1 gbean@http://geronimo.apache.org/xml/ns/deployment-1.1' instead of 'notvalid@http://geronimo.apache.org/xml/ns/j2ee/application-1.1' here] Descriptor: <xml-fragment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment- 1.1" xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">   <dep:environment>     <dep:moduleId>       <dep:groupId>wrox</dep:groupId>       <dep:artifactId>progeron</dep:artifactId>       <dep:version>1.0</dep:version>       <dep:type>car</dep:type>     </dep:moduleId>   </dep:environment>   <app:notvalid/>   <app:module>     <app:ejb>progeron-ejbs.jar</app:ejb>     <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1">       <enterprise-beans>         <session>           <ejb-name>AuthorEJB</ejb-name>           <jndi-name>ejb/AuthorEJB</jndi-name>         </session>       </enterprise-beans>     </openejb-jar>   </app:module>   <app:module>     <app:web>progeron.war</app:web>     <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"></web- app>   </app:module> </xml-fragment>      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.getEarPlan(EARConfigBuilder.ja va:345)      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.getDeploymentPlan(EARConfigBui lder.java:263)      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$$38e56ec6.in voke(<generated>)      at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)      at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:3 8)      at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:122)      at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:817)      at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)      at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.jav a:35)      at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterc eptor.java:96)      at org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$42a16177.getD eploymentPlan(<generated>)      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:232)      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:124)      at org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke(<generat ed>)      at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)      at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:3 8)      at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:122)      at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:852)      at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)      at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(Abstract DeployCommand.java:106)      at org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand .java:60)      at java.lang.Thread.run(Thread.java:595) Caused by: org.apache.xmlbeans.XmlException: Invalid deployment descriptor: [error: cvc-complex-type.2.4a: Expected elements 'module@http://geronimo.apache.org/xml/ns/j2ee/application-1.1 ext- module@http://geronimo.apache.org/xml/ns/j2ee/application-1.1 security@http://geronimo.apache.org/xml/ns/security-1.1 gbean@http://geronimo.apache.org/xml/ns/deployment-1.1' instead of 'notvalid@http://geronimo.apache.org/xml/ns/j2ee/application-1.1' here] Descriptor: <xml-fragment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment- 1.1" xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">   <dep:environment>     <dep:moduleId>       <dep:groupId>wrox</dep:groupId>       <dep:artifactId>progeron</dep:artifactId>       <dep:version>1.0</dep:version>       <dep:type>car</dep:type>     </dep:moduleId>   </dep:environment>   <app:notvalid/>   <app:module>     <app:ejb>progeron-ejbs.jar</app:ejb>     <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1">       <enterprise-beans>         <session>           <ejb-name>AuthorEJB</ejb-name>           <jndi-name>ejb/AuthorEJB</jndi-name>         </session>       </enterprise-beans>     </openejb-jar>   </app:module>   <app:module>     <app:web>progeron.war</app:web>     <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"> </web-app>   </app:module> </xml-fragment>      at org.apache.geronimo.schema.SchemaConversionUtils.validateDD(SchemaConversionUtils.j ava:605)      at org.apache.geronimo.schema.SchemaConversionUtils.fixGeronimoSchema(SchemaConversion Utils.java:370)      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.getEarPlan(EARConfigBuilder.ja va:327)      ... 21 more

Other than using your favorite text editor, you can also use the log viewer in the Web console. Check under Server logs link under the Server heading. One benefit of using the Web console is that it allows you to search through the log, which can be advantageous when the log is very large.

Correcting the Deployment Plan

Both the console output and the log point to a bad element called <notvalid> in the deployment plan. If you examine the deployment plan, you will find this offending element, shown in the following listing.

 <?xml version="1.0" encoding="UTF-8"?> <application     xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">       <environment>       <moduleId>         <groupId>wrox</groupId>          <artifactId>progeron</artifactId>          <version>1.0</version>          <type>car</type>        </moduleId>        </environment> <notvalid/> <module>         <ejb>progeron-ejbs.jar</ejb>         <openejb-jar             xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"             >             <enterprise-beans>                 <session>                     <ejb-name>AuthorEJB</ejb-name>                     <jndi-name>ejb/AuthorEJB</jndi-name>                 </session>             </enterprise-beans>         </openejb-jar>     </module>...

Correct the deployment plan by removing the <notvalid/> element. Try deploying the EAR file with the plan again.

You can use the deployer or the Web console to deploy progeron.ear with the updated deploy.xml.

This time, the deployment should be successful.

Querying Components from a Deployed Application on the Debug Console

Point your browser to the debug console. In the Filter Output text box of the debug console, enter the following JSR-77 name pattern:

 *:J2EEApplication=progeron

This tells the debug console (and actually the JSR-77 MEJB) that you want all the objects in the J2EEApplciation called progeron, across any domain. This query selects all the deployed objects in the progeron application. Figure 7-12 shows the resulting set of managed objects.

image from book
Figure 7-12: Debug console query results for objects in the progeron application

In Figure 7-12, you can see the AuthorEJB stateless session bean as well as the Show authors servlet component. The JSR-77 object name describes each object precisely.

If you are using jconsole, select the geronimo.geronimo.AuthorEJB node, and also the geronimo.geronimo.ShowAuthors node to view the component details. Figure 7-13 shows these application objects in jconsole.

image from book
Figure 7-13: Objects in the progeron application in jconsole

Viewing the Attributes of a Geronimo Managed Object

Every JSR-77 name listed in the debug console is a hyperlink. If you click on any of the object links, the debug console will access the MBean and display the value of all the attributes on the MBean. It will be shown on the right-hand side of the debug console browser. You may have to scroll horizontally to see the list of MBean attributes. For example, if you click on the AuthorEJB stateless session bean, you will see all its properties (see Figure 7-14).

image from book
Figure 7-14: Debug console displaying the MBean attributes for the AuthorEJB session bean

You can see from Figure 7-14 that quite a bit of information concerning the deployed components is available via the MBean attributes. Many of the attributes (such as defaultPrincipal, ejbName, jndiNames, localJndiNames, and runAsSubject) are configurable in the application deployment plan. The ability to see the actual run-time value of these attributes will help you to troubleshoot problems - especially in the cases where the value set in the deployment plan may be incorrect.

To familiarize yourself with the attributes that are available for different components, click on other managed components, and notice the available attributes and their assigned value. You may want to refer to the component’s deployment plan to see how the attributes are set during deployment

If you are using jconsole, the AuthorEJB appears as a separate component at the top of the geronimo.geronimo subtree displayed by the MBeans tab. Figure 7-15 shows the jconsole display of the properties of the AuthorEJB session bean.

image from book
Figure 7-15: jconsole displaying details for the AuthorEJB session bean




Professional Apache Geronimo
Professional Apache Geronimo (Wrox Professional Guides)
ISBN: 0471785431
EAN: 2147483647
Year: 2004
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net