Book Image

Apache Geronimo 2.1: Quick Reference

Book Image

Apache Geronimo 2.1: Quick Reference

Overview of this book

Apache Geronimo is a robust, scalable, secure, and high-performing application server. But like all application servers, this power comes with a steep learning curve. This book can help you save your time and get working with Geronimo in matter of a few hours. This book is a quick-reference guide to Apache Geronimo that mitigates the starting pains that most developers have when they migrate to a new Application Server. It will help you to extend and amplify your existing development skills, empowering you to build new types of applications regardless of the platform or browser. The book will introduce you to the exciting features of Apache Geronimo Application Server. You will see how easily you can develop and deploy Java EE 5 applications on Geronimo. It covers everything from downloading the server to customizing it using custom GBeans. By following the practical examples in this book, you will be able to develop applications quickly using Geronimo Eclipse Plugin. The book covers Geronimo internals in detail, which helps you write custom services on Geronimo. Also, it helps you to gain a deep understanding of Geronimo plugin architecture and teaches you to extend your server functionality via plugins. By the end of the book, you will develop proficiency in Geronimo and Java EE 5 application development.
Table of Contents (21 chapters)
Apache Geronimo 2.1
Credits
About the Authors
About the Reviewer
Preface

Deployment errors


In this section, we will look at some common deployment errors and how these errors can be resolved.

MissingDependencyException

A MissingDependencyException is thrown when a configuration or repository artifact specified as a dependency in the application, or the configuration being deployed does not exist on the server. The following is a typical error message displayed during deployment:

Error: Unable to deploy mywebapp-1.0.war: Unable to createconfiguration for deployment
load of default/mywebapp-1.0/1.0/war failed
Error starting configuration gbean default/mywebapp-1.0/1.0/war
Missing dependency: default/non-existant/1.0/jar

The following is a typical message logged to Administration Console when deploying from Deploy New portlet:

org.apache.geronimo.common.DeploymentException: Unable to create configuration for deployment
at org.apache.geronimo.deployment.DeploymentContext. createTempConfiguration(DeploymentContext.java:150)
Caused by: org.apache.geronimo.kernel.repository.MissingDependencyException: Missing dependency: default/non-existant/1.0/jar
at org.apache.geronimo.kernel.config.ConfigurationResolver.resolve (ConfigurationResolver.java:113)
...

To resolve this error, make sure that the parent configurations declared in the dependencies exist on the server. You can use the Repository Viewer portlet to view a list of artifacts in the repository. Click on the artifact in the portlet to get help on how to use the artifact as a dependency.

XmlException— Invalid deployment descriptor

An XmlException can occur due to an erratic deployment plan, or if the deployer is unable to recognize an element. The following is an example of a deployment exception due to an element in the deployment plan not being recognized:

org.apache.geronimo.common.DeploymentException: xml problem for web app . Caused by: org.apache.xmlbeans.XmlException: Invalid deployment descriptor: errors:
error: cvc-complex-type.2.4a: Expected elements 'work-dir@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 clustering@http://geronimo.apache.org/xml/ns/j2ee/application-2.0 web-container@http://geronimo.apache.org/xml/ns/naming-1.2 host@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 cross-context@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 disable-cookies@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 valve-chain@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 listener-chain@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 tomcat-realm@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 manager@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 cluster@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 abstract-naming-entry@http://geronimo.apache.org/xml/ns/naming-1.2 ejb-ref@http://geronimo.apache.org/xml/ns/naming-1.2 ejb-local-ref@http://geronimo.apache.org/xml/ns/naming-1.2 service-ref@http://geronimo.apache.org/xml/ns/naming-1.2 resource-ref@http://geronimo.apache.org/xml/ns/naming-1.2 resource-env-ref@http://geronimo.apache.org/xml/ns/naming-1.2 message-destination@http://geronimo.apache.org/xml/ns/naming-1.2 security-realm-name@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 service@http://geronimo.apache.org/xml/ns/deployment-1.2 persistence@http://java.sun.com/xml/ns/persistence' instead of 'tomcat-clustering-wadi@http://geronimo.apache.org/xml/ns/tomcat-clustering-wadi-1.2' here
error: cvc-complex-type.2.4a: Expected elements 'work-dir@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 clustering@http://geronimo.apache.org/xml/ns/j2ee/application-2.0 web-container@http://geronimo.apache.org/xml/ns/naming-1.2 host@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 cross-context@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 disable-cookies@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 valve-chain@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 listener-chain@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 tomcat-realm@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 manager@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 cluster@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 abstract-naming-entry@http://geronimo.apache.org/xml/ns/naming-1.2 ejb-ref@http://geronimo.apache.org/xml/ns/naming-1.2 ejb-local-ref@http://geronimo.apache.org/xml/ns/naming-1.2 service-ref@http://geronimo.apache.org/xml/ns/naming-1.2 resource-ref@http://geronimo.apache.org/xml/ns/naming-1.2 resource-env-ref@http://geronimo.apache.org/xml/ns/naming-1.2 message-destination@http://geronimo.apache.org/xml/ns/naming-1.2 security-realm-name@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 service@http://geronimo.apache.org/xml/ns/deployment-1.2 persistence@http://java.sun.com/xml/ns/persistence' instead of 'tomcat-clustering-wadi@http://geronimo.apache.org/xml/ns/tomcat-clustering-wadi-1.2' here
Descriptor: <xml-fragment xmlns:tom="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1" xmlns:tom1="http://geronimo.apache.org/xml/ns/tomcat-clustering-wadi-1.2">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/ deployment-1.2">
deployment, errorsXmlException<dep:moduleId>
<dep:groupId>packt-samples</dep:groupId>
<dep:artifactId>helloworld-cluster</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies/>
</dep:environment>
<tom:context-root>/helloworld-cluster</tom:context-root>
<tom1:tomcat-clustering-wadi/>
<!--clustering-wadi/-->
</xml-fragment>
at org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil.validateDD(XmlBeansUtil.java:187)
...

In this example, the error is due to the <tomcat-clustering-wadi/> element not being recognized, as the org.apache.geronimo.configs/tomcat6-clustering-builder-wadi/2.1.4/car is not running when deployment was attempted. To resolve this kind of error, start the builder configuration and deploy the application again.

DuplicateDeploymentException

A DuplicateDeploymentException is thrown when an EJB module contains EJBs with the same names as the EJBs already running on the server. This is because the deployment-ids created for the EJBs are same as the running EJBs. A typical log message for this error is given below:

2009-07-17 01:03:17,421 ERROR [GBeanInstanceState] Error while starting; GBean is now in the FAILED state: abstractName="packt-samples/myejbapp/2.0/jar? J2EEApplication=null,j2eeType=EJBModule,name=packt-samples/myejbapp/2.0/jar"
org.apache.openejb.DuplicateDeploymentIdException: Application cannot be deployed as it contains deployment-ids which are in use: app: C:\book\geronimo-tomcat6-javaee5-2.1.4\var\temp\geronimo-deployer5436850122084871803.tmpdir\myejbapp.jar
myejbapp/MySessionBean
myejbapp/MyEjb3ServiceBean
myejbapp/MyEjb3ServiceBean2
myejbapp/MyEjb3ServiceBean3
at org.apache.openejb.assembler.classic.Assembler. createApplication(Assembler.java:438)
...

This error can be overcome by setting the openejb.deploymentId.format system variable, in order to override the default setting that is causing the conflict. See http://openejb.apache.org/3.0/system-properties.html and http://openejb.apache.org/3.0/jndi-names.html for more details.