JavaEE Platform Spec EDR
JavaEE Platform Spec EDR
ii
Early Draft
iii
Specification: JSR-342 Java Platform, Enterprise Edition 7 Specification ("Specification")
Version: 7.0
Status: Early Draft Review
Release: 16 April 2012
Copyright 2012 Oracle America, Inc.
500 Oracle Parkway, Redwood City, California 94065, U.S.A
All rights reserved.
LIMITED LICENSE GRANTS
NOTICE
The Specification is protected by copyright and the information described therein may be protected by one or
more U.S. patents, foreign patents, or pending applications. Except as provided under the following license,
no part of the Specification may be reproduced in any form by any means without the prior written authorization of Oracle America, Inc. ("Oracle") and its licensors, if any. Any use of the Specification and the information described therein will be governed by the terms and conditions of this Agreement.
Subject to the terms and conditions of this license, including your compliance with Paragraphs 1 and 2
below, Oracle hereby grants you a fully-paid, non-exclusive, non-transferable, limited license (without the
right to sublicense) under Oracle's intellectual property rights to:
1.Review the Specification for the purposes of evaluation. This includes: (i) developing implementations of
the Specification for your internal, non-commercial use; (ii) discussing the Specification with any third party;
and (iii) excerpting brief portions of the Specification in oral or written communications which discuss the
Specification provided that such excerpts do not in the aggregate constitute a significant portion of the Technology.
2.Distribute implementations of the Specification to third parties for their testing and evaluation use, provided that any such implementation:
(i) does not modify, subset, superset or otherwise extend the Licensor Name Space, or include any public or
protected packages, classes, Java interfaces, fields or methods within the Licensor Name Space other than
those required/authorized by the Specification or Specifications being implemented;
(ii) is clearly and prominently marked with the word "UNTESTED" or "EARLY ACCESS" or "INCOMPATIBLE" or "UNSTABLE" or "BETA" in any list of available builds and in proximity to every link initiating its download, where the list or link is under Licensee's control; and
(iii) includes the following notice:
"This is an implementation of an early-draft specification developed under the Java Community Process
(JCP) and is made available for testing and evaluation purposes only. The code is not compatible with any
specification of the JCP."
The grant set forth above concerning your distribution of implementations of the specification is contingent
upon your agreement to terminate development and distribution of your "early draft" implementation as soon
as feasible following final completion of the specification. If you fail to do so, the foregoing grant shall be
considered null and void.
No provision of this Agreement shall be understood to restrict your ability to make and distribute to third parties applications written to the Specification.
Other than this limited license, you acquire no right, title or interest in or to the Specification or any other
iv
Oracle intellectual property, and the Specification may only be used in accordance with the license terms set
forth herein. This license will expire on the earlier of: (a) two (2) years from the date of Release listed above;
(b) the date on which the final version of the Specification is publicly released; or (c) the date on which the
Java Specification Request (JSR) to which the Specification corresponds is withdrawn. In addition, this
license will terminate immediately without notice from Oracle if you fail to comply with any provision of
this license. Upon termination, you must cease use of or destroy the Specification.
"Licensor Name Space" means the public class or interface declarations whose names begin with "java",
"javax", "com.oracle" or their equivalents in any subsequent naming convention adopted by Oracle through
the Java Community Process, or any recognized successors or replacements thereof
TRADEMARKS
No right, title, or interest in or to any trademarks, service marks, or trade names of Oracle or Oracle's licensors is granted hereunder. Oracle, the Oracle logo, Java are trademarks or registered trademarks of Oracle
USA, Inc. in the U.S. and other countries.
DISCLAIMER OF WARRANTIES
THE SPECIFICATION IS PROVIDED "AS IS" AND IS EXPERIMENTAL AND MAY CONTAIN
DEFECTS OR DEFICIENCIES WHICH CANNOT OR WILL NOT BE CORRECTED BY ORACLE.
ORACLE MAKES NO REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, OR NON-INFRINGEMENT THAT THE CONTENTS OF THE SPECIFICATION ARE
SUITABLE FOR ANY PURPOSE OR THAT ANY PRACTICE OR IMPLEMENTATION OF SUCH
CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADE
SECRETS OR OTHER RIGHTS. This document does not represent any commitment to release or implement any portion of the Specification in any product.
THE SPECIFICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL
ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION THEREIN; THESE
CHANGES WILL BE INCORPORATED INTO NEW VERSIONS OF THE SPECIFICATION, IF ANY.
ORACLE MAY MAKE IMPROVEMENTS AND/OR CHANGES TO THE PRODUCT(S) AND/OR THE
PROGRAM(S) DESCRIBED IN THE SPECIFICATION AT ANY TIME. Any use of such changes in the
Specification will be governed by the then-current license for the applicable version of the Specification.
LIMITATION OF LIABILITY
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ORACLE OR ITS LICENSORS
BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUE, PROFITS OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING
OUT OF OR RELATED TO ANY FURNISHING, PRACTICING, MODIFYING OR ANY USE OF THE
SPECIFICATION, EVEN IF ORACLE AND/OR ITS LICENSORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
You will hold Oracle (and its licensors) harmless from any claims based on your use of the Specification for
any purposes other than the limited right of evaluation as described above, and from any claims that later versions or releases of any Specification furnished to you are incompatible with the Specification provided to
you under this license.
RESTRICTED RIGHTS LEGEND
If this Software is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime
contractor or subcontractor (at any tier), then the Government's rights in the Software and accompanying
documentation shall be only as set forth in this license; this is in accordance with 48 C.F.R. 227.7201 through
Early Draft
v
227.7202-4 (for Department of Defense (DoD) acquisitions) and with 48 C.F.R. 2.101 and 12.212 (for nonDoD acquisitions).
REPORT
You may wish to report any ambiguities, inconsistencies or inaccuracies you may find in connection with
your evaluation of the Specification ("Feedback"). To the extent that you provide Oracle with any Feedback,
you hereby: (i) agree that such Feedback is provided on a non-proprietary and non-confidential basis, and (ii)
grant Oracle a perpetual, non-exclusive, worldwide, fully paid-up, irrevocable license, with the right to sublicense through multiple levels of sublicensees, to incorporate, disclose, and use without limitation the Feedback for any purpose related to the Specification and future versions, implementations, and test suites
thereof.
GENERAL TERMS
Any action related to this Agreement will be governed by California law and controlling U.S. federal law.
The U.N. Convention for the International Sale of Goods and the choice of law rules of any jurisdiction will
not apply.
The Specification is subject to U.S. export control laws and may be subject to export or import regulations in
other countries. Licensee agrees to comply strictly with all such laws and regulations and acknowledges that
it has the responsibility to obtain such licenses to export, re-export or import as may be required after delivery to Licensee.
This Agreement is the parties' entire agreement relating to its subject matter. It supersedes all prior or contemporaneous oral or written communications, proposals, conditions, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication
between the parties relating to its subject matter during the term of this Agreement. No modification to this
Agreement will be binding, unless in writing and signed by an authorized representative of each party.
vi
Early Draft
Contents
Java Platform, Enterprise Edition (Java EE) Specification,
v7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
EE.1
EE.1.1
EE.1.2
EE.1.3
EE.1.4
EE.1.5
EE.1.6
EE.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
Acknowledgements for the Initial Version. . . . . . . . . . . . . . . . . 2
Acknowledgements for Version 1.3 . . . . . . . . . . . . . . . . . . . . . . 2
Acknowledgements for Version 1.4 . . . . . . . . . . . . . . . . . . . . . . 3
Acknowledgements for Version 5 . . . . . . . . . . . . . . . . . . . . . . . 3
Acknowledgements for Version 6 . . . . . . . . . . . . . . . . . . . . . . . 4
Acknowledgements for Version 7 . . . . . . . . . . . . . . . . . . . . . . . 4
Platform Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
EE.2.1
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
EE.2.2
Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
EE.2.3
Application Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
EE.2.3.1
Java EE Server Support for Application Components 11
EE.2.4
Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
EE.2.4.1
Container Requirements . . . . . . . . . . . . . . . . . . . . . . . 12
EE.2.4.2
Java EE Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
EE.2.5
Resource Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
EE.2.6
Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
EE.2.7
Java EE Standard Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
EE.2.7.1
HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
EE.2.7.2
HTTPS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
EE.2.7.3
Java Transaction API (JTA) . . . . . . . . . . . . . . . . . . 13
EE.2.7.4
RMI-IIOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
EE.2.7.5
Java IDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
vii
viii
EE.2.7.6
JDBC API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
EE.2.7.7
Java Persistence API . . . . . . . . . . . . . . . . . . . . . . . . 15
EE.2.7.8
Java Message Service (JMS) . . . . . . . . . . . . . . . . . . 15
EE.2.7.9
Java Naming and Directory Interface (JNDI) . . . . . 15
EE.2.7.10
JavaMail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
EE.2.7.11
JavaBeans Activation Framework (JAF). . . . . . . . . 16
EE.2.7.12
XML Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
EE.2.7.13
Java EE Connector Architecture . . . . . . . . . . . . . . . 16
EE.2.7.14
Security Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
EE.2.7.15
Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
EE.2.7.16
Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
EE.2.7.17
Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
EE.2.8
Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
EE.2.9
Flexibility of Product Requirements . . . . . . . . . . . . . . . . . . . . 20
EE.2.10 Java EE Product Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
EE.2.11 Support for Java EE Products in Cloud Environments . . . . . . 21
EE.2.11.1
Multi-tenancy and Support for the SaaS Model . . . . . 22
EE.2.12 Platform Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
EE.2.12.1
Roles Common to All Environments . . . . . . . . . . . . . 23
EE.2.12.2
Roles Specific to Cloud Environments . . . . . . . . . . . . 25
EE.2.12.3
Example: Roles in Cloud Environments . . . . . . . . . . . 27
EE.2.13 Platform Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
EE.2.13.1
Java EE APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
EE.2.13.2
Java EE Service Provider Interfaces (SPIs) . . . . . . . . 28
EE.2.13.3
Network Protocols. . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
EE.2.13.4
Deployment Descriptors and Annotations . . . . . . . . . 28
EE.2.14 Changes in J2EE 1.3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
EE.2.15 Changes in J2EE 1.4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
EE.2.16 Changes in Java EE 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
EE.2.17 Changes in Java EE 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
EE.2.18 Changes in Java EE 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
EE.3
Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
EE.3.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
EE.3.2
A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
EE.3.3
Security Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
EE.3.3.1
Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
EE.3.3.2
Non Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
EE.3.3.3
Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Final Release
ix
EE.3.3.4
Container Based Security . . . . . . . . . . . . . . . . . . . . . . 40
EE.3.3.5
Distributed Security. . . . . . . . . . . . . . . . . . . . . . . . . . . 41
EE.3.3.6
Authorization Model . . . . . . . . . . . . . . . . . . . . . . . . . . 42
EE.3.3.7
HTTP Login Gateways . . . . . . . . . . . . . . . . . . . . . . . . 43
EE.3.3.8
User Authentication. . . . . . . . . . . . . . . . . . . . . . . . . . . 43
EE.3.3.9
Lazy Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . 46
EE.3.4
User Authentication Requirements. . . . . . . . . . . . . . . . . . . . . . 46
EE.3.4.1
Login Sessions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
EE.3.4.2
Required Login Mechanisms. . . . . . . . . . . . . . . . . . . . 47
EE.3.4.3
Unauthenticated Users. . . . . . . . . . . . . . . . . . . . . . . . . 48
EE.3.4.4
Application Client User Authentication . . . . . . . . . . . 49
EE.3.4.5
Resource Authentication Requirements . . . . . . . . . . . 50
EE.3.5
Authorization Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . 51
EE.3.5.1
Code Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
EE.3.5.2
Caller Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . 52
EE.3.5.3
Propagated Caller Identities. . . . . . . . . . . . . . . . . . . . . 52
EE.3.5.4
Run As Identities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
EE.3.6
Deployment Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
EE.3.7
Future Directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
EE.3.7.1
Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
EE.3.7.2
Instance-based Access Control . . . . . . . . . . . . . . . . . . 54
EE.3.7.3
User Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
EE.4
EE.4.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
EE.4.2
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
EE.4.2.1
Web Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
EE.4.2.2
Transactions in Web Component Life Cycles. . . . . . . 59
EE.4.2.3
Transactions and Threads . . . . . . . . . . . . . . . . . . . . . . 59
EE.4.2.4
Enterprise JavaBeans Components . . . . . . . . . . . . . 60
EE.4.2.5
Application Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
EE.4.2.6
Applet Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
EE.4.2.7
Transactional JDBC Technology Support. . . . . . . . 61
EE.4.2.8
Transactional JMS Support . . . . . . . . . . . . . . . . . . . . . 61
EE.4.2.9
Transactional Resource Adapter (Connector) Support 61
EE.4.3
Transaction Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
EE.4.3.1
Multiple Java EE Platform Interoperability . . . . . . . . 62
EE.4.3.2
Support for Transactional Resource Managers . . . . . . 62
EE.4.4
Local Transaction Optimization . . . . . . . . . . . . . . . . . . . . . . . . 63
EE.4.4.1
Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
EE.4.4.2
A Possible Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
EE.4.5
Connection Sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
EE.4.6
JDBC and JMS Deployment Issues . . . . . . . . . . . . . . . . . . . . . 65
EE.4.7
Two-Phase Commit Support . . . . . . . . . . . . . . . . . . . . . . . . . . 65
EE.4.8
System Administration Tools . . . . . . . . . . . . . . . . . . . . . . . . . . 66
EE.5
EE.5.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
EE.5.1.1
Chapter Organization . . . . . . . . . . . . . . . . . . . . . . . . . 68
EE.5.1.2
Required Access to the JNDI Naming Environment. . 70
EE.5.2
JNDI Naming Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
EE.5.2.1
The Application Components Environment . . . . . . . 71
EE.5.2.2
Application Component Environment Namespaces . . 72
EE.5.2.3
Accessibility of Environment Entry Types . . . . . . . . . 74
EE.5.2.4
Sharing of Environment Entries . . . . . . . . . . . . . . . . . 74
EE.5.2.5
Annotations and Injection . . . . . . . . . . . . . . . . . . . . . . 75
EE.5.2.6
Annotations and Deployment Descriptors . . . . . . . . . 78
EE.5.2.7
Other Naming Context Entries . . . . . . . . . . . . . . . . . . 80
EE.5.3
Responsibilities by Java EE Role . . . . . . . . . . . . . . . . . . . . . . . 80
EE.5.3.1
Application Component Providers Responsibilities . 80
EE.5.3.2
Application Assemblers Responsibilities. . . . . . . . . . 81
EE.5.3.3
Deployers Responsibilities. . . . . . . . . . . . . . . . . . . . . 81
EE.5.3.4
Java EE Product Providers Responsibilities . . . . . . . 81
EE.5.4
Simple Environment Entries. . . . . . . . . . . . . . . . . . . . . . . . . . . 82
EE.5.4.1
Application Component Providers Responsibilities . 83
EE.5.5
Enterprise JavaBeans (EJB) References. . . . . . . . . . . . . . . . 89
EE.5.5.1
Application Component Providers Responsibilities . 89
EE.5.5.2
Application Assemblers Responsibilities. . . . . . . . . . 94
EE.5.5.3
Deployers Responsibilities. . . . . . . . . . . . . . . . . . . . . 97
EE.5.5.4
Java EE Product Providers Responsibilities . . . . . . . 98
EE.5.6
Web Service References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
EE.5.7
Resource Manager Connection Factory References. . . . . . . . . 98
EE.5.7.1
Application Component Providers Responsibilities . 99
EE.5.7.2
Deployers Responsibilities. . . . . . . . . . . . . . . . . . . . 105
EE.5.7.3
Java EE Product Providers Responsibilities . . . . . . 106
EE.5.7.4
System Administrators Responsibilities . . . . . . . . . 107
EE.5.8
Resource Environment References. . . . . . . . . . . . . . . . . . . . . 108
EE.5.8.1
Application Component Providers Responsibilities 108
EE.5.8.2
Deployers Responsibilities. . . . . . . . . . . . . . . . . . . . 110
Final Release
xi
EE.5.8.3
Java EE Product Providers Responsibilities . . . . . . 110
EE.5.9
Message Destination References . . . . . . . . . . . . . . . . . . . . . . 110
EE.5.9.1
Application Component Providers Responsibilities 111
EE.5.9.2
Application Assemblers Responsibilities. . . . . . . . . 114
EE.5.9.3
Deployers Responsibilities. . . . . . . . . . . . . . . . . . . . 115
EE.5.9.4
Java EE Product Providers Responsibilities . . . . . . 116
EE.5.10 UserTransaction References . . . . . . . . . . . . . . . . . . . . . . . . . . 116
EE.5.10.1
Application Component Providers Responsibilities 117
EE.5.10.2
Java EE Product Providers Responsibilities . . . . . . 118
EE.5.11 TransactionSynchronizationRegistry References. . . . . . . . . . 118
EE.5.11.1
Application Component Providers Responsibilities 118
EE.5.11.2
Java EE Product Providers Responsibilities . . . . . . 119
EE.5.12 ORB References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
EE.5.12.1
Application Component Providers Responsibilities 120
EE.5.12.2
Java EE Product Providers Responsibilities . . . . . . 120
EE.5.13 Persistence Unit References . . . . . . . . . . . . . . . . . . . . . . . . . . 121
EE.5.13.1
Application Component Providers Responsibilities 121
EE.5.13.2
. . . . . . . . . Application Assemblers Responsibilities124
EE.5.13.3
Deployers Responsibility . . . . . . . . . . . . . . . . . . . . . 125
EE.5.13.4
Java EE Product Providers Responsibility . . . . . . . . 125
EE.5.13.5
System Administrators Responsibility . . . . . . . . . . . 126
EE.5.14 Persistence Context References . . . . . . . . . . . . . . . . . . . . . . . 126
EE.5.14.1
Application Component Providers Responsibilities 126
EE.5.14.2
. . . . . . . . . Application Assemblers Responsibilities129
EE.5.14.3
Deployers Responsibility . . . . . . . . . . . . . . . . . . . . . 131
EE.5.14.4
Java EE Product Providers Responsibility . . . . . . . . 131
EE.5.14.5
System Administrators Responsibility . . . . . . . . . . . 131
EE.5.15 Application Name and Module Name References . . . . . . . . . 132
EE.5.15.1
Application Component Providers Responsibilities 132
EE.5.15.2
Java EE Product Providers Responsibilities . . . . . . 132
EE.5.16 Validator and Validator Factory References . . . . . . . . . . . . . 132
EE.5.16.1
Application Component Providers Responsibilities 133
EE.5.16.2
Java EE Product Providers Responsibilities . . . . . . 134
EE.5.17 Resource Definition and Configuration . . . . . . . . . . . . . . . . . 134
EE.5.17.1
Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
EE.5.17.2
Requirements Common to All Resource Definition
Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
EE.5.17.3
DataSource Resource Definition . . . . . . . . . . . . . . . . 137
EE.5.17.4
JMS Connection Factory Resource Definition . . . . . 140
xii
EE.5.17.5
JMS Destination Definition. . . . . . . . . . . . . . . . . . . . 143
EE.5.17.6
Mail Session Definition. . . . . . . . . . . . . . . . . . . . . . . 144
EE.5.17.7
Connector or Custom Resource Definition . . . . . . . . 147
EE.5.17.8
Connector Administered Object Definition . . . . . . . 148
EE.5.18 Default Data Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
EE.5.18.1
Java EE Product Provider's Responsibilities . . . . . . . 151
EE.5.19 Default JMS Connection Factory . . . . . . . . . . . . . . . . . . . . . . 151
EE.5.19.1
Java EE Product Provider's Responsibilities . . . . . . . 152
EE.5.20 Tenant Identifier References . . . . . . . . . . . . . . . . . . . . . . . . . 152
EE.5.20.1
Application Component Provider's Responsibilities. 153
EE.5.20.2
Java EE Product Provider's Responsibilities . . . . . . . 153
EE.5.21 Managed Bean References . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
EE.5.21.1
Application Component Providers Responsibilities 154
EE.5.21.2
Java EE Product Providers Responsibilities . . . . . . 155
EE.5.22 Bean Manager References . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
EE.5.22.1
Application Component Providers Responsibilities 155
EE.5.22.2
Java EE Product Providers Responsibilities . . . . . . 156
EE.5.23 Support for Dependency Injection . . . . . . . . . . . . . . . . . . . . . 156
EE.6
EE.6.1
Required APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
EE.6.1.1
Java Compatible APIs . . . . . . . . . . . . . . . . . . . . . . . . 160
EE.6.1.2
Required Java Technologies . . . . . . . . . . . . . . . . . . . 161
EE.6.1.3
Pruned Java Technologies . . . . . . . . . . . . . . . . . . . . . 162
EE.6.2
Java Platform, Standard Edition (Java SE) Requirements . . . 163
EE.6.2.1
Programming Restrictions. . . . . . . . . . . . . . . . . . . . . 163
EE.6.2.2
The Java EE Security Permissions Set . . . . . . . . . . . 164
EE.6.2.3
Listing of the Java EE Security Permissions Set. . . . 165
EE.6.2.4
Additional Requirements. . . . . . . . . . . . . . . . . . . . . . 166
EE.6.3
Enterprise JavaBeans (EJB) 3.2 Requirements . . . . . . . . . 175
EE.6.4
Servlet 3.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
EE.6.5
JavaServer Pages (JSP) 2.2 Requirements . . . . . . . . . . . . . 177
EE.6.6
Expression Language (EL) 3.0 Requirements . . . . . . . . . . . . 177
EE.6.7
Java Message Service (JMS) 2.0 Requirements. . . . . . . . . 177
EE.6.8
Java Transaction API (JTA) 1.2 Requirements . . . . . . . . . 179
EE.6.9
JavaMail 1.4 Requirements . . . . . . . . . . . . . . . . . . . . . . . . 179
EE.6.10 Java EE Connector Architecture 1.6 Requirements . . . . . . 181
EE.6.11 Web Services for Java EE 1.3 Requirements . . . . . . . . . . . . . 181
Final Release
xiii
EE.6.12
EE.6.13
EE.6.14
EE.6.15
EE.6.16
EE.6.17
EE.6.18
EE.6.19
EE.6.20
EE.6.21
EE.6.22
EE.6.23
EE.6.24
EE.6.25
EE.6.26
EE.6.27
EE.6.28
EE.6.29
EE.6.30
EE.6.31
EE.7
EE.7.1
EE.7.2
Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191
Introduction to Interoperability . . . . . . . . . . . . . . . . . . . . . . . 191
Interoperability Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
xiv
EE.7.2.1
EE.7.2.2
EE.7.2.3
EE.7.2.4
EE.8
EE.8.1
Application Development Life Cycle. . . . . . . . . . . . . . . . . . . 198
EE.8.1.1
Component Creation . . . . . . . . . . . . . . . . . . . . . . . . . 199
EE.8.1.2
Application Assembly . . . . . . . . . . . . . . . . . . . . . . . . 201
EE.8.1.3
Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
EE.8.2
Library Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
EE.8.2.1
Bundled Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
EE.8.2.2
Installed Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
EE.8.2.3
Library Conflicts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
EE.8.2.4
Library Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
EE.8.2.5
Dynamic Class Loading . . . . . . . . . . . . . . . . . . . . . . 205
EE.8.2.6
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
EE.8.3
Class Loading Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 208
EE.8.3.1
Web Container Class Loading Requirements . . . . . . 209
EE.8.3.2
EJB Container Class Loading Requirements . . . . . . 210
EE.8.3.3
Application Client Container Class Loading Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
EE.8.3.4
Applet Container Class Loading Requirements . . . . 213
EE.8.4
Application Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
EE.8.4.1
Assembling a Java EE Application . . . . . . . . . . . . . . 213
EE.8.4.2
Adding and Removing Modules . . . . . . . . . . . . . . . . 216
EE.8.5
Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
EE.8.5.1
Deploying a Stand-Alone Java EE Module. . . . . . . . 219
EE.8.5.2
Deploying a Java EE Application . . . . . . . . . . . . . . . 220
EE.8.5.3
Deploying a Library . . . . . . . . . . . . . . . . . . . . . . . . . 222
EE.8.5.4
Module Initialization . . . . . . . . . . . . . . . . . . . . . . . . . 223
EE.8.6
Java EE Application XML Schema . . . . . . . . . . . . . . . . . . . . 224
EE.8.7
Common Java EE XML Schema Definitions. . . . . . . . . . . . . 224
EE.9
EE.9.1
EE.9.2
EE.9.3
EE.9.4
Final Release
Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Profile Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
General Rules for Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Expression of Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . 227
xv
EE.9.5
EE.9.6
EE.9.7
EE.10
EE.10.1
EE.10.2
EE.10.3
EE.10.4
EE.10.5
EE.10.6
EE.10.7
EE.11
EE.11.1
EE.11.2
EE.11.3
EE.11.4
EE.11.5
EE.11.6
EE.12
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Resources, Naming, and Injection . . . . . . . . . . . . . . . . . . . . . 233
Application Programming Interfaces . . . . . . . . . . . . . . . . . . . 233
Packaging and Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Java EE Application Client XML Schema . . . . . . . . . . . . . . . 235
Java EE Connector Architecture. . . . . . . . . . . . . . . . . . . . . 237
Java Authorization Service Provider Contract for Containers .
237
Java Transaction API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Java Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Java API for XML Web Services . . . . . . . . . . . . . . . . . . . . 238
JavaMail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
EE.12.1
Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
EE.12.1.1
JavaServer Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
EE.12.2
Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
EE.12.2.1
JavaServer Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
EE.12.2.2
Java Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
EE.12.2.3
JAX-WS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
EE.12.2.4
Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
EE.13
EE.13.1
EE.13.2
xvi
EE.A.4
EE.A.5
EE.A.6
EE.A.7
EE.A.8
EE.A.9
EE.A.10
EE.A.11
EE.A.12
EE.A.13
Final Release
C H A P T E R
EE.1
Introduction
Enterprises today need to extend their reach, reduce their costs, and lower the
EE.1.1
This specification is the work of many people. Vlada Matena wrote the first draft as
well as the Transaction Management and Naming chapters. Sekhar Vajjhala, Kevin
Osborn, and Ron Monzillo wrote the Security chapter. Hans Hrasna wrote the
Application Assembly and Deployment chapter. Seth White wrote the JDBC API
requirements. Jim Inscore, Eric Jendrock, and Beth Stearns provided editorial
assistance. Shel Finkelstein, Mark Hapner, Danny Coward, Tom Kincaid, and Tony
Ng provided feedback on many drafts. And of course this specification was formed
and molded based on conversations with and review feedback from our many
industry partners.
EE.1.2
Version 1.3 of this specification grew out of discussions with our partners during the
creation of version 1.2, as well as meetings with those partners subsequent to the
final release of version 1.2. Version 1.3 was created under the Java Community
Process as JSR-058. The JSR-058 Expert Group included representatives from the
following companies and organizations: Allaire, BEA Systems, Bluestone Software,
Borland, Bull S.A., Exoffice, Fujitsu Limited, GemStone Systems, Inc., IBM, Inline
Software, IONA Technologies, iPlanet, jGuru.com, Orion Application Server,
Persistence, POET Software, SilverStream, Sun, and Sybase. In addition, most of
the people who helped with the previous version continued to help with this version,
along with Jon Ellis and Ram Jeyaraman. Alfred Towell provided significant
editorial assistance with this version.
Early Draft
EE.1.3
Version 1.4 of this specification was created under the Java Community Process as
JSR-151. The JSR-151 Expert Group included the following members: Larry W.
Allen (SilverStream Software), Karl Avedal (Individual), Charlton Barreto
(Borland Software Corporation), Edward Cobb (BEA), Alan Davies (SeeBeyond
Technology Corporation), Sreeram Duvvuru (iPlanet), B.J. Fesq (Individual),
Mark Field (Macromedia), Mark Hapner (Sun Microsystems, Inc.), Pierce Hickey
(IONA), Hemant Khandelwal (Pramati Technologies), Jim Knutson (IBM), Elika
S. Kohen (Individual), Ramesh Loganathan (Pramati Technologies), Jasen Minton
(Oracle Corporation), Jeff Mischkinsky (Oracle Corporation), Richard MonsonHaefel (Individual), Sean Neville (Macromedia), Bill Shannon (Sun Microsystems,
Inc.), Simon Tuffs (Lutris Technologies), Jeffrey Wang (Persistence Software,
Inc.), and Ingo Zenz (SAP AG). My colleagues at Sun provided invaluable
assistance: Umit Yalcinalp converted the deployment descriptors to XML Schema;
Tony Ng and Sanjeev Krishnan helped with transaction requirements; Jonathan
Bruce helped with JDBC requirements; Suzette Pelouch, Eric Jendrock, and Ian
Evans provided editorial assistance. Thanks also to all the external reviewers,
including Jeff Estefan (Adecco Technical Services).
EE.1.4
Version 5 (originally known as version 1.5) of this specification was created under
the Java Community Process as JSR-244. The JSR-244 Expert Group included the
following members: Kilinc Alkan (Individual), Rama Murthy Amar Pratap
(Individual), Charlton Barreto (Individual), Michael Bechauf (SAP AG), Florent
Benoit (INRIA), Bill Burke (JBoss, Inc.), Muralidharan Chandrasekaran
(Individual), Yongmin Chen (Novell, Inc.), Jun Ho Cho (TmaxSoft), Ed Cobb
(BEA), Ugo Corda (SeeBeyond Technology Corporation), Scott Crawford
(Individual), Arulazi Dhesiaseelan (Hewlett-Packard Company), Bill Dudney
(Individual), Francois Exertier (INRIA), Jeff Genender (The Apache Software
Foundation), Evan Ireland (Sybase, Inc.), Vishy Kasar (Borland Software
Corporation), Michael Keith (Oracle Corporation), Wonseok Kim (TmaxSoft, Inc.),
Jim Knutson (IBM), Elika Kohen (Individual), Felipe Leme (Individual), Geir
Magnusson Jr. (The Apache Software Foundation), Scott Marlow (Novell, Inc.),
Jasen Minton (Oracle Corporation), Jishnu Mitra (Borland Software Corp), David
Morandi (E.piphany), Nathan Pahucki (Novell, Inc.), David Morandi (E.piphany,
Inc.), Ricardo Morin (Intel Corporation), Nathan Pahucki (Novell, Inc.), Matt
Raible (Individual), Dirk Reinshagen (Individual), Narinder Sahota (Cap Gemini),
Suneet Shah (Individual), Bill Shannon (Sun Microsystems, Inc.), Rajiv Shivane
(Pramati Technologies), Scott Stark (Jboss, Inc), Hani Suleiman (Ironflare AB),
Kresten Krab Thorup (Trifork), Ashish Kumar Tiwari (Individual), Sivasundaram
Umapathy (Individual), Steve Weston (Cap Gemini), Seth White (BEA Systems),
and Umit Yalcinalp (SAP AG). Once again, my colleagues at Sun provided
invaluable assistance: Roberto Chinnici provided draft proposals for many issues
related to dependency injection.
EE.1.5
Version 6 of this specification was created under the Java Community Process as
JSR-316. The spec leads for the JSR-316 Expert Group were Bill Shannon (Sun
Microsystems, Inc.) and Roberto Chinnici (Sun Microsystems, Inc.). The expert
group included the following members: Florent Benoit (Inria), Adam Bien
(Individual), David Blevins (Individual), Bill Burke (Red Hat Middleware LLC),
Larry Cable (BEA Systems), Bongjae Chang (Tmax Soft, Inc.), Rejeev Divakaran
(Individual), Francois Exertier (Inria), Jeff Genender (Individual), Antonio
Goncalves (Individual), Jason Greene (Red Hat Middleware LLC), Gang Huang
(Peking University), Rod Johnson (SpringSource), Werner Keil (Individual),
Michael Keith (Oracle), Wonseok Kim (Tmax Soft, Inc.), Jim Knutson (IBM), Elika
S. Kohen (Individual), Peter Kristiansson (Ericsson AB), Changshin Lee (NCsoft
Corporation), Felipe Leme (Individual), Ming Li (TongTech Ltd.), Vladimir Pavlov
(SAP AG), Dhanji R. Prasanna (Google), Reza Rahman (Individual), Rajiv Shivane
(Pramati Technologies), Hani Suleiman (Individual).
EE.1.6
Version 7 of this specification was created under the Java Community Process as
JSR-342. The Expert Group work for this specification was conducted by means of
the http://javaee-spec.java.net project in order to provide transparency to the
Java community. The specification leads for the JSR-342 Expert Group were Bill
Shannon (Oracle) and Linda DeMichiel (Oracle). The expert group included the
following members: Deepak Anupalli (Pramati Technologies), Florent Benoit
(OW2), Adam Bien (Individual), David Blevins (IBM), Markus Eisele (Individual),
Early Draft
Jeff Genender (Individual), Antonio Goncalves (Individual), Jason Greene (Red Hat
Middleware LLC), Alex Heneveld (Individual), Minehiko Iida (Fujitsu), Jevgeni
Kabanov (Individual), Ingyu Kang (Tmax Soft, Inc.), Werner Keil (Individual), Jim
Knutson (IBM), Ming Li (TongTech Ltd.), Pete Muir (Red Hat Middleware LLC),
Minoru Nitta (Fujitsu), Reza Rahman (Caucho Technology, Inc), Kristoffer Sjogren
(Ericsson AB), Spike Washburn (Individual).
Early Draft
C H A P T E R
EE.2
Platform Overview
This chapter provides an overview of the Java Platform, Enterprise Edition
(Java EE).
EE.2.1
Architecture
EJB Container
Web Container
Applet Container
HTTP
Applet
JSP
SSL
JavaMail
Java Persistence
JTA
Connectors
JMS
Management
WS Metadata
SAAJ
Java SE
Application Client
Web Services
CDI & DI
JACC
JASPIC
JAXR
JAX-RS
JAX-WS
SAAJ
JAX-RPC
JavaMail
JSTL
JSF
Java Persistence
JTA
Connectors
JMS
Management
WS Metadata
JACC
SSL
Web Services
CDI & DI
HTTP
JASPIC
JAXR
JAX-RS
JAX-WS
JAX-RPC
Java SE
EJB
Servlet
Java SE
Container
Application
Client
Java Persistence
Management
WS Metadata
Web Services
CDI & DI
JMS
JAXR
JAX-WS
JAX-RPC
Database
SAAJ
Java SE
Figure EE.2-1
New in Java EE 6
The following sections describe the Java EE Platform requirements for each
kind of Java EE platform element.
EE.2.2
Profiles
The Java EE 6 specification introduced the notion of profiles (see Chapter EE.9,
Profiles).
A profile is a configuration of the Java EE platform targeted at a specific class
of applications.
Profiles are not a new concept, nor are they unique to the Java EE platform.
The Java Community Process Document (version 2.8) gives the following
definition of a profile: A Specification that references one of the Platform
Edition Specifications and zero or more other JCP Specifications (that are not
already a part of a Platform Edition Specification). APIs from the referenced
Platform Edition must be included according to the referencing rules set out in
Early Draft
PROFILES
10
EE.2.3
Application Components
The Java EE runtime environment defines four application component types that a
Java EE product must support:
Application clients are Java programming language programs that are typically
GUI programs that execute on a desktop computer. Application clients offer a
user experience similar to that of native applications and have access to all of
the facilities of the Java EE middle tier.
Applets are GUI components that typically execute in a web browser, but can
execute in a variety of other applications or devices that support the applet
programming model. Applets can be used to provide a powerful user interface
for Java EE applications. (Simple HTML pages can also be used to provide a
more limited user interface for Java EE applications.)
Servlets, JSP pages, JSF applications, filters, and web event listeners typically
execute in a web container and may respond to HTTP requests from web clients. Servlets, JSP pages, JSF applications, and filters may be used to generate
HTML pages that are an applications user interface. They may also be used
to generate XML or other format data that is consumed by other application
components. A special kind of servlet provides support for web services using
the SOAP/HTTP protocol. Servlets, pages created with the JavaServer Pages technology or JavaServer Faces technology, web filters, and web
event listeners are referred to collectively in this specification as web components. Web applications are composed of web components and other data
such as HTML pages. Web components execute in a web container. A web
server includes a web container and other protocol support, security support,
and so on, as required by Java EE specifications.
Early Draft
CONTAINERS
The Java EE servers provide deployment, management, and execution support for
conforming application components. Application components can be divided into
three categories according to their dependence on a Java EE server:
Components that are deployed, managed, and executed on a Java EE server.
These components include web components and Enterprise JavaBeans components. See the separate specifications for these components.
Components that are deployed and managed on a Java EE server, but are loaded to and executed on a client machine. These components include web resources such as HTML pages and applets embedded in HTML pages.
Components whose deployment and management is not completely defined by
this specification. Application Clients fall into this category. Future versions of
this specification may more fully define deployment and management of Application Clients. See Chapter EE.10, Application Clients, for a description
of Application Clients.
EE.2.4
Containers
11
12
EE.2.4.1
Container Requirements
Java EE Servers
EE.2.5
Resource Adapters
Early Draft
DATABASE
adapter that uses the Java EE SPIs to attach to the Java EE platform will be able to
work with all Java EE products.
EE.2.6
Database
The Java EE platform requires a database, accessible through the JDBC API, for the
storage of business data. The database is accessible from web components,
enterprise beans, and application client components. The database need not be
accessible from applets. The Java EE Product Provider must also provide a
preconfigured, default data source for use by the application in accessing this
database. See Section EE.5.18, Default Data Source.
EE.2.7
The Java EE standard services include the following (specified in more detail later
in this document). Some of these standard services are actually provided by Java SE.
EE.2.7.1
HTTP
The HTTP client-side API is defined by the java.net package. The HTTP serverside API is defined by the servlet, JSP, and JSF interfaces and by the web services
support that is a part of the Java EE platform.
EE.2.7.2
HTTPS
Use of the HTTP protocol over the SSL protocol is supported by the same client and
server APIs as HTTP.
EE.2.7.3
13
14
EE.2.7.4
RMI-IIOP
The RMI-IIOP subsystem is composed of APIs that allow for the use of RMI-style
programming that is independent of the underlying protocol, as well as an
implementation of those APIs that supports both the Java SE native RMI protocol
(JRMP) and the CORBA IIOP protocol. Java EE applications can use RMI-IIOP,
with IIOP protocol support, to access CORBA services that are compatible with the
RMI programming restrictions (see the RMI-IIOP specification for details). Such
CORBA services would typically be defined by components that live outside of a
Java EE product, usually in a legacy system. Only Java EE application clients are
required to be able to define their own CORBA services directly, using the RMIIIOP APIs. Typically such CORBA objects would be used for callbacks when
accessing other CORBA objects.
Java EE products must be capable of exporting Enterprise JavaBeans
components using the IIOP protocol and accessing enterprise beans using the
IIOP protocol, as specified in the EJB specification. The ability to use the IIOP
protocol is required to enable interoperability between Java EE products, however
a Java EE product may also use other protocols. Requirements for use of the RMIIIOP APIs when accessing Enterprise JavaBeans components have been relaxed
as of EJB 3.0. See the Enterprise JavaBeans specification for details.
EE.2.7.5
Java IDL
JDBC API
The JDBC API is the API for connectivity with relational database systems. The
JDBC API has two parts: an application-level interface used by the application
components to access a database, and a service provider interface to attach a JDBC
driver to the Java EE platform. Support for the service provider interface is not
required in Java EE products. Instead, JDBC drivers should be packaged as resource
adapters that use the facilities of the Connector API to interface with a Java EE
Early Draft
product. The JDBC API is included in Java SE, but this specification includes
additional requirements on JDBC device drivers.
EE.2.7.7
The Java Persistence API is the standard API for the management of persistence and
object/relational mapping. It provides an object/relational mapping facility for
application developers using a Java domain model to manage a relational database.
The Java Persistence API is required to be supported in Java EE. It can also be used
in Java SE environments.
EE.2.7.8
The Java Message Service is a standard API for messaging that supports reliable
point-to-point messaging as well as the publish-subscribe model. This specification
requires a JMS provider that implements both point-to-point messaging as well as
publish-subscribe messaging. The Java EE Product Provider must also provide a
preconfigured, default JMS connection factory for use by the application in
accessing this JMS provider. See Section EE.5.19, Default JMS Connection
Factory.
EE.2.7.9
The JNDI API is the standard API for naming and directory access. The JNDI API
has two parts: an application-level interface used by the application components to
access naming and directory services and a service provider interface to attach a
provider of a naming and directory service. The JNDI API is included in Java SE,
but this specification defines additional requirements.
EE.2.7.10
JavaMail
Many Internet applications require the ability to send email notifications, so the Java
EE platform includes the JavaMail API along with a JavaMail service provider that
allows an application component to send Internet mail. The JavaMail API has two
parts: an application-level interface used by the application components to send
mail, and a service provider interface used at the Java EE SPI level.
15
16
EE.2.7.11
The JAF API provides a framework for handling data in different MIME types,
originating in different formats and locations. The JavaMail API makes use of the
JAF API. The JAF API is included in Java SE and so is available to Java EE
applications.
EE.2.7.12
XML Processing
The Java API for XML Processing (JAXP) provides support for the industry
standard SAX and DOM APIs for parsing XML documents, as well as support for
XSLT transform engines. The Streaming API for XML (StAX) provides a pullparsing API for XML. The JAXP and StAX APIs are included in Java SE and so are
available to Java EE applications.
EE.2.7.13
The Connector architecture is a Java EE SPI that allows resource adapters that
support access to Enterprise Information Systems to be plugged in to any Java EE
product. The Connector architecture defines a standard set of system-level contracts
between a Java EE server and a resource adapter. The standard contracts include:
A connection management contract that lets a Java EE server pool connections
to an underlying EIS, and lets application components connect to an EIS. This
leads to a scalable application environment that can support a large number of
clients requiring access to EIS systems.
A transaction management contract between the transaction manager and an
EIS that supports transactional access to EIS resource managers. This contract
lets a Java EE server use a transaction manager to manage transactions across
multiple resource managers. This contract also supports transactions that are
managed internal to an EIS resource manager without the necessity of involving an external transaction manager.
A security contract that enables secure access to an EIS. This contract provides support for a secure application environment, which reduces security
threats to the EIS and protects valuable information resources managed by the
EIS.
A thread management contract that allows a resource adapter to delegate work
to other threads and allows the application server to manage a pool of threads.
Early Draft
The resource adapter can control the security context and transaction context
used by the worker thread.
A contract that allows a resource adapter to deliver messages to message driven beans independent of the specific messaging style, messaging semantics,
and messaging infrastructure used to deliver messages. This contract also
serves as the standard message provider pluggability contract that allows a
message provider to be plugged into any Java EE server via a resource adapter.
A contract that allows a resource adapter to propagate an imported transaction
context to the Java EE server such that its interactions with the server and any
application components are part of the imported transaction. This contract
preserves the ACID (atomicity, consistency, isolation, durability) properties
of the imported transaction.
An optional contract providing a generic command interface between an application program and a resource adapter.
EE.2.7.14
Security Services
Web Services
Java EE provides full support for both clients of web services as well as web service
endpoints. Several Java technologies work together to provide support for web
services. The Java API for XML Web Services (JAX-WS) and the Java API for
XML-based RPC (JAX-RPC) both provide support for web service calls using the
SOAP/HTTP protocol. JAX-WS is the primary API for web services and is a
17
18
Management
The Java 2 Platform, Enterprise Edition Management Specification defines APIs for
managing Java EE servers using a special management enterprise bean. The Java
Management Extensions (JMX) API is also used to provide some management
support.
EE.2.7.17
Deployment
Early Draft
INTEROPERABILITY
IIOP
JRMP
HTTP
SSL
IIOP
HTTP
SSL
JRMP
SOAP
HTTP
IIOP
HTTP
SSL
JRMP
SOAP
HTTP
Applet
Container
Web
Container
EJB
Container
Database
Application
Client
Container
Java EE Platform
JRMP
IIOP
SOAP HTTP
HTTP SSL
Figure EE.2-2
EE.2.8
Java EE Interoperability
Interoperability
Many of the APIs described above provide interoperability with components that
are not a part of the Java EE platform, such as external web or CORBA services.
Figure EE.2-2 illustrates the interoperability facilities of the Java EE platform.
(The directions of the arrows indicate the client/server relationships of the
components.)
19
20
EE.2.9
EE.2.10
Early Draft
EE.2.11
The Java EE 7 Platform extends the use of Java EE products into cloud
environments.
The National Institute of Standards and Technology (NIST) defines cloud
computing as follows:
Cloud computing is a model for enabling convenient, on-demand
network access to a shared pool of configurable computing resources
(e.g., networks, servers, storage, applications, and services) that can
be rapidly provisioned and released with minimal management effort
or service provider interaction.
It offers the following definition of Platform as a Service (PaaS) computing:
The capability provided to the consumer is to deploy onto the cloud
infrastructure consumer-created or acquired applications created
using programming languages and tools supported by the provider.
The consumer does not manage or control the underlying cloud
infrastructure including network, servers, operating systems, or
storage, but has control over the deployed applications and possibly
application hosting environment configurations.
Additionally, it offers the following definition of the Software as a Service
(SaaS) model:
21
22
EE.2.12
Platform Roles
This section describes typical Java Platform, Enterprise Edition roles. In an actual
instance, an organization may divide role functionality differently to match that
organizations application development and deployment workflow.
The roles are described in greater detail in later sections of this specification.
Some of the roles, where noted, refer specifically to Java EE product use in cloud
environments.
Early Draft
PLATFORMROLES
EE.2.12.1
EE.2.12.1.1
There are multiple roles for Application Component Providers, including, for
example, HTML document designers, document programmers, and enterprise bean
developers. These roles use tools to produce Java EE applications and components.
EE.2.12.1.3
Application Assembler
23
24
EE.2.12.1.4
Deployer
The Deployer is responsible for deploying application clients, web applications, and
Enterprise JavaBeans components into a specific operational environment. The
Deployer uses tools supplied by the Java EE Product Provider to carry out
deployment tasks. Deployment is typically a three-stage process:
1. During Installation the Deployer moves application media to the server, generates the additional container-specific classes and interfaces that enable the
container to manage the application components at runtime, and installs application components, and additional classes and interfaces, into the appropriate
Java EE containers.
2. During Configuration, external dependencies declared by the Application
Component Provider are resolved and application assembly instructions defined by the Application Assembler are followed. For example, the Deployer
is responsible for mapping security roles defined by the Application Assembler
onto user groups and accounts that exist in the target operational environment.
3. Finally, the Deployer starts up Execution of the newly installed and configured application.
In some cases, a specially qualified Deployer may customize the business
logic of the applications components at deployment time. For example, using
tools provided with a Java EE product, the Deployer may provide simple
application code that wraps an enterprise beans business methods, or customizes
the appearance of a JSP or JSF page.
The Deployers output is web applications, enterprise beans, applets, and
application clients that have been customized for the target operational
environment and are deployed in a specific Java EE container.
In cloud environments, the Deployer is responsible for configuring the
application to run in the cloud environment. The Deployer installs the application
into the cloud environment, configures its external dependencies, and may handle
aspects of provisioning its required resources.
In the case of an application designed for use by multiple tenants (SaaS), the
Deployer is responsible for configuring the application to address the
requirements of the tenant on whose behalf the application is being deployed.
Early Draft
PLATFORMROLES
EE.2.12.1.5
System Administrator
Tool Provider
A Tool Provider provides tools used for the development and packaging of
application components. A variety of tools are anticipated, corresponding to the
types of application components supported by the Java EE platform. Platform
independent tools can be used for all phases of development through the
deployment of an application and the management and monitoring of an application
server.
EE.2.12.1.7
EE.2.12.2.1
Cloud Provider
25
26
EE.2.12.2.2
Each Cloud Customer wishing to deploy applications to the cloud environment must
first establish an account that gives them permission to deploy to and access cloud
resources. The Cloud Account Manager works for the Cloud Provider and is
charged with the maintenance of all of the Cloud Customer accounts. The Cloud
Account Manager may adjust permissions of a given Customer account according to
the service-level agreement with the Customer.
EE.2.12.2.3
Application Submitter
Application Administrator
The Application Administrator monitors and manages applications for the Cloud
Customer. Unlike the System Administrator, who is employed by the Cloud Provider, the Application Administrator works for the Cloud Customer and is only
responsible for the applications and resources immediately available to that Customer.
Early Draft
PLATFORMCONTRACTS
EE.2.12.2.6
End User
EE.2.13
Platform Contracts
This section describes the Java Platform, Enterprise Edition contracts that must be
fulfilled by a Java EE Product Provider implementing the full Java EE platform.
Java EE profiles may include some or all of these facilities, as described in
Chapter EE.9, Profiles.
EE.2.13.1
Java EE APIs
The Java EE APIs define the contract between the Java EE application components
and the Java EE platform. The contract specifies both the runtime and deployment
interfaces.
The Java EE Product Provider must implement the Java EE APIs in a way that
supports the semantics and policies described in this specification. The
Application Component Provider provides components that conform to these
APIs and policies.
27
28
EE.2.13.2
The Java EE Service Provider Interfaces (SPIs) define the contract between the Java
EE platform and service providers that may be plugged into a Java EE product. The
Connector APIs define service provider interfaces for integrating resource adapters
with a Java EE application server. Resource adapter components implementing the
Connector APIs are called Connectors. The Java EE Authorization APIs define
service provider interfaces for integrating security authorization mechanisms with a
Java EE application server.
The Java EE Product Provider must implement the Java EE SPIs in a way that
supports the semantics and policies described in this specification. A provider of
Service Provider components (for example, a Connector Provider) should provide
components that conform to these SPIs and policies.
EE.2.13.3
Network Protocols
This specification defines the mapping of application components to industrystandard network protocols. The mapping allows client access to the application
components from systems that have not installed Java EE product technology. See
Chapter EE.7, Interoperability, for details on the network protocol support
required for interoperability.
The Java EE Product Provider is required to publish the installed application
components on the industry-standard protocols. This specification defines the
mapping of servlets and JSP pages to the HTTP and HTTPS protocols, and the
mapping of EJB components to IIOP and SOAP protocols.
EE.2.13.4
Deployment descriptors and Java language annotations are used to communicate the
needs of application components to the Deployer. The deployment descriptor and
class file annotations are a contract between the Application Component Provider or
Assembler and the Deployer. The Application Component Provider or Assembler is
required to specify the application components external resource requirements,
security requirements, environment parameters, and so forth in the components
deployment descriptor or through class file annotations. The Java EE Product
Provider is required to provide a deployment tool that interprets the Java EE
deployment descriptors and class file annotations and allows the Deployer to map
Early Draft
EE.2.14
The J2EE 1.3 specification extends the J2EE platform with additional enterprise
integration facilities. The Connector API supports integration with external
enterprise information systems. A JMS provider is now required. The JAXP API
provides support for processing XML documents. The JAAS API provides security
support for the Connector API. The EJB specification now requires support for
interoperability using the IIOP protocol.
Significant changes have been made to the EJB specification. The EJB
specification has a new container-managed persistence model, support for
message driven beans, and support for local enterprise beans.
Other existing J2EE APIs have been updated as well. See the individual API
specifications for details. Finally, J2EE 1.3 requires support for J2SE 1.3.
EE.2.15
The primary focus of J2EE 1.4 is support for web services. The JAX-RPC and
SAAJ APIs provide the basic web services interoperability support. The Web
Services for J2EE specification describes the packaging and deployment
requirements for J2EE applications that provide and use web services. The EJB
specification was also extended to support implementing web services using
stateless session beans. The JAXR API supports access to registries and
repositories.
Several other APIs have been added to J2EE 1.4. The J2EE Management and
J2EE Deployment APIs enable enhanced tool support for J2EE products. The
JMX API supports the J2EE Management API. The J2EE Authorization Contract
for Containers provides an SPI for security providers.
Many of the existing J2EE APIs have been enhanced in J2EE 1.4. J2EE 1.4
builds on J2SE 1.4. The JSP specification has been enhanced to simplify the
development of web applications. The Connector API now supports integration
with asynchronous messaging systems, including the ability to plug in JMS
providers.
29
30
EE.2.16
Changes in Java EE 5
With this release, the platform has a new name Java Platform, Enterprise Edition,
or Java EE for short. This new name gets rid of the confusing 2 while
emphasizing even in the short name that this is a Java platform. Previous versions
are still referred to using the old name J2EE.
The focus of Java EE 5 is ease of development. To simplify the development
process for programmers just starting with Java EE, or developing small to
medium applications, Java EE 5 makes extensive use of Java language
annotations, which were introduced by J2SE 5.0. Annotations reduce or eliminate
the need to deal with Java EE deployment descriptors in many cases. Even large
applications can benefit from the simplifications provided by annotations.
One of the major uses of annotations is to specify injection of resources and
other dependencies into Java EE components. Injection augments the existing
JNDI lookup capability to provide a new simplified model for applications to gain
access to the resources needed from the operational environment. Injection also
works with deployment descriptors to allow the deployer to customize or override
resource settings specified in the applications source code.
The use of annotations is made even more effective by providing better
defaults. Better default behavior and better default configuration allows most
applications to get the behavior they want most of the time, without the use of
either annotations or deployment descriptors in many cases. When the default is
not what the application wants, a simple annotation can be used to specify the
required behavior or configuration.
The combination of annotations and better defaults has greatly simplified the
development of applications using Enterprise JavaBeans technology and
applications defining or using web services. Enterprise beans are now
dramatically simpler to develop. Web services are much easier to develop using
the annotations defined by the Web Services Metadata specification.
The area of web services continues to evolve at a rapid pace. To provide the
latest web services support, the JAX-RPC technology has evolved into the JAX-
Early Draft
CHANGES IN JAVA EE 6
WS technology, which makes heavy use of the JAXB technology to bind Java
objects to XML data. Both JAX-WS and JAXB are new to this version of the
platform.
Major additions to Java EE 5 include the JSTL and JSF technologies that
simplify development of web applications, and the Java Persistence API
developed by the EJB 3.0 expert group, which greatly simplifies mapping Java
objects to databases.
Minor additions include the StAX API for XML parsing. Most APIs from
previous versions have been updated with small to medium improvements.
EE.2.17
Changes in Java EE 6
EE.2.18
Changes in Java EE 7
Note This section will be filled in ahead of the final release of this specification.
31
32
Early Draft
C H A P T E R
EE.3
Security
This chapter describes the security requirements for the Java Platform,
EE.3.1
Introduction
Almost every enterprise has security requirements and specific mechanisms and
infrastructure to meet them. Sensitive resources that can be accessed by many users
or that often traverse unprotected open networks (such as the Internet) need to be
protected.
Although the quality assurances and implementation details may vary, they all
share some of the following characteristics:
Authentication: The means by which communicating entities (for example,
client and server) prove to one another that they are acting on behalf of specific
identities that are authorized for access.
Access control for resources: The means by which interactions with resources are limited to collections of users or programs for the purpose of enforcing
integrity, confidentiality, or availability constraints.
Data integrity: The means used to prove that information has not been modified by a third party (some entity other than the source of the information).
For example, a recipient of data sent over an open network must be able to detect and discard messages that were modified after they were sent.
33
34
EE.3.2
A Simple Example
The web client requests the main application URL, shown in Figure EE.3-1.
Web Server
Web Client
Request access to
protected resource
Figure EE.3-1
Initial Request
Since the client has not yet authenticated itself to the application environment,
the server responsible for delivering the web portion of the application (hereafter referred to as web server) detects this and invokes the appropriate
authentication mechanism for this resource.
Step 2: Initial Authentication
Early Draft
A SIMPLE EXAMPLE
The web server returns a form that the web client uses to collect authentication data (for example, username and password) from the user. The web client
forwards the authentication data to the web server, where it is validated by the
web server, as shown in Figure EE.3-2.
Web Server
Web Client
Form
credential
Authentication data
Figure EE.3-2
Initial Authentication
The validation mechanism may be local to the server, or it may leverage the
underlying security services. On the basis of the validation, the web server
sets a credential for the user.
Step 3: URL Authorization
The credential is used for future determinations of whether the user is authorized to access restricted resources it may request. The web server consults the
security policy (derived from the deployment descriptor) associated with the
web resource to determine the security roles that are permitted access to the
resource. The web container then tests the users credential against each role
to determine if it can map the user to the role. Figure EE.3-3 shows this process.
Web Server
Web Client
credential
Authorization
Request access to
protected resource
JSP/servlet
Object
Session
Context
Figure EE.3-3
URL Authorization
The web servers evaluation stops with an is authorized outcome when the
web server is able to map the user to a role. A not authorized outcome is
reached if the web server is unable to map the user to any of the permitted
roles.
35
36
Step 4: Fulfilling the Original Request
If the user is authorized, the web server returns the result of the original URLrequest, as shown in Figure EE.3-4.
Web Server
Web Client
Result of request
credential
JSP/Servlet
Object
Figure EE.3-4
In our example, the response URL of a JSP page is returned, enabling the user
to post form data that needs to be handled by the business logic component of
the application.
Step 5: Invoking Enterprise Bean Business Methods
The JSP page performs the remote method call to the enterprise bean, using
the users credential to establish a secure association between the JSP page
and the enterprise bean (as shown in Figure EE.3-5). The association is
implemented as two related security contexts, one in the web server and one
in the EJB container.
Credential used to
establish security association
Web Server
EJB Container
Web Client
Session
Context
Figure EE.3-5
JSP/servlet
Object
remote call
Authorization
credential
Security
Context
EJB
Security
Context
Early Draft
SECURITYARCHITECTURE
container uses the security context associated with the call to determine if it can
map the caller to the role.
The containers evaluation stops with an is authorized outcome when the
container is able to map the callers credential to a role. A not authorized
outcome is reached if the container is unable to map the caller to any of the
permitted roles. A not authorized result causes an exception to be thrown by the
container, and propagated back to the calling JSP page.
If the call is authorized, the container dispatches control to the enterprise
bean method. The result of the beans execution of the call is returned to the JSP,
and ultimately to the user by the web server and the web client.
EE.3.3
Security Architecture
This section describes the Java EE security architecture on which the security
requirements defined by this specification are based.
EE.3.3.1
Goals
37
38
Non Goals
The following are not goals for the Java EE security architecture:
1. This specification does not dictate a specific security policy. Security policies
for applications and for enterprise information systems vary for many reasons
unconnected with this specification. Product Providers can provide the technology needed to implement and administer desired security policies while adhering to the requirements of this specification.
2. This specification does not mandate a specific security technology, such as
Kerberos, PK, NIS+, or NTLM.
3. This specification does not require that the Java EE security behaviors be universally implementable using any or all security technologies.
4. This specification does not provide any warranty or assurance of the effective
security of a Java EE product.
Early Draft
SECURITYARCHITECTURE
EE.3.3.3
Terminology
This section introduces the terminology that is used to describe the security
requirements of the Java EE platform.
Principal
A principal is an entity that can be authenticated by an authentication protocol
in a security service that is deployed in an enterprise. A principal is identified
using a principal name and authenticated using authentication data. The content and format of the principal name and the authentication data can vary
depending upon the authentication protocol.
Security Policy Domain
A security policy domain, also referred to as a security domain, is a scope
over which a common security policy is defined and enforced by the security
administrator of the security service.
A security policy domain is also sometimes referred to as a realm. This specification uses the security policy domain, or security domain, terminology.
Security Technology Domain
A security technology domain is the scope over which the same security
mechanism (for example Kerberos) is used to enforce a security policy.
A single security technology domain may include multiple security policy
domains, for example.
Security Attributes
A set of security attributes is associated with every principal. The security
attributes have many uses (for example, access to protected resources and
auditing of users). Security attributes can be associated with a principal by an
authentication protocol and/or by the Java EE Product Provider.
The Java EE platform does not specify what security attributes are associated
with a principal.
Credential
A credential contains or references information (security attributes) used to
authenticate a principal for Java EE product services. A principal acquires a
credential upon authentication, or from another principal that allows its cre-
39
40
Security for components is provided by their containers in order to achieve the goals
for security specified above in a Java EE environment. A container provides two
kinds of security (discussed in the following sections):
Declarative security
Programmatic security
EE.3.3.4.1
Declarative Security
Programmatic Security
Early Draft
SECURITYARCHITECTURE
isCallerInRole (EJBContext)
getCallerPrincipal (EJBContext)
isUserInRole (HttpServletRequest)
getUserPrincipal (HttpServletRequest)
Distributed Security
Some Product Providers may produce Java EE products in which the containers for
various component types are distributed. In a distributed environment,
communication between Java EE components can be subject to security attacks (for
example, data modification and replay attacks).
Such threats can be countered by using a secure association to secure
communications. A secure association is shared security state information that
establishes the basis of a secure communication between components.
Establishing a secure association could involve several steps, such as:
1. Authenticating the target principal to the client and/or authenticating the client
to the target principal.
2. Negotiating a quality of protection, such as confidentiality or integrity.
3. Setting up a security context for the association between the components.
Since a container provides security in Java EE, secure associations for a
component are typically established by a container. Secure associations for web
41
42
access are specified here. Secure associations for access to enterprise beans are
described in the EJB specification.
Product Providers may allow for control over the quality of protection or
other aspects of secure association at deployment time. Applications can specify
their requirements for access to web resources using annotations or elements in
their deployment descriptor.
This specification does not define mechanisms that an Application
Component Provider can use to communicate requirements for secure
associations with an enterprise bean.
EE.3.3.6
Authorization Model
Role Mapping
Early Draft
SECURITYARCHITECTURE
1. A Deployer may have mapped a security role to a user group in the operational
environment. In this case, the user group of the calling principal is retrieved
from its security attributes. The principal is in the security role if the principals
user group matches a user group to which the security role has been mapped.
2. A Deployer may have mapped a security role to a principal name in a security
policy domain. In this case, the principal name of the calling principal is retrieved from its security attributes. If this principal name is the same as a principal name to which the security role was mapped, the calling principal is in
the security role.
The source of security attributes may vary across implementations of the Java
EE platform. Security attributes may be transmitted in the calling principals
credential or in the security context. In other cases, security attributes may be
retrieved from a trusted third party, such as a directory service or a security
service.
EE.3.3.7
User Authentication
User authentication is the process by which a user proves his or her identity to the
system. This authenticated identity is then used to perform authorization decisions
for accessing Java EE application components. An end user can authenticate using
either of the two supported client types:
Web client
Application client
43
44
EE.3.3.8.1
It is required that a web client be able to authenticate a user to a web server using
any of the following mechanisms. The Deployer or System Administrator
determines which method to apply to an application or to a group of applications.
HTTP Basic Authentication
HTTP Basic Authentication is the authentication mechanism supported by the
HTTP protocol. This mechanism is based on a username and password. A
web server requests a web client to authenticate the user. As part of the
request, the web server passes the realm in which the user is to be authenticated. The web client obtains the username and the password from the user
and transmits them to the web server. The web server then authenticates the
user in the specified realm (referred to as HTTP Realm in this document).
HTTP Basic Authentication is not secure. Passwords are sent in simple
base64 encoding. The target server is not authenticated. Additional protection
can be applied to overcome these weaknesses. The password may be protected by applying security at the transport layer (for example HTTPS) or at
the network layer (for example, IPSEC or VPN).
Despite its limitations, the HTTP Basic Authentication mechanism is included
in this specification because it is widely used in form based applications.
HTTPS Client Authentication
End user authentication using HTTPS (HTTP over SSL) is a strong authentication mechanism. This mechanism requires the user to possess a Public Key
Certificate (PKC). Currently, a PKC is rarely used by end users on the Internet. However, it is useful for e-commerce applications and also for a singlesignon from within the browser. For these reasons, HTTPS client authentication is a required feature of the Java EE platform.
Form Based Authentication
The look and feel of a login screen cannot be varied using the web browsers
built-in authentication mechanisms. This specification introduces the ability
to package standard HTML or servlet/JSP/JSF based forms for logging in,
allowing customization of the user interface. The form based authentication
mechanism introduced by this specification is described in the Servlet specification.
Early Draft
SECURITYARCHITECTURE
HTTP is a stateless protocol. However, many web applications need support for
sessions that can maintain state across multiple requests from a client. Therefore, it
is desirable to:
1. Make login mechanisms and policies a property of the environment the web
application is deployed in.
2. Be able to use the same login session to represent a user to all the applications
that they access.
3. Require re-authentication of users only when a security policy domain boundary has been crossed.
Credentials that are acquired through a web login process are associated with
a session. The container uses the credentials to establish a security context for the
session. The container uses the security context to determine authorization for
access to web resources and for the establishment of secure associations with
other components (including enterprise beans).
EE.3.3.8.3
Login Session
In the Java EE platform, login session support is provided by a web container. When
a user successfully authenticates with a web server, the container establishes a login
session context for the user. The login session contains the credentials associated
with the user.1
EE.3.3.8.4
45
46
help of a web browser and without traversing a web server. Application clients may
also access web resources.
Application clients, like the other Java EE application component types,
execute in a managed environment that is provided by an appropriate container.
Application clients are expected to have access to a graphical display and input
device, and are expected to communicate with a human user.
Application clients are used to authenticate end users to the Java EE platform,
when the users access protected web resources or enterprise beans.
EE.3.3.9
Lazy Authentication
EE.3.4
The Java EE Product Provider must meet the following requirements concerning
user authentication.
EE.3.4.1
Login Sessions
All Java EE web servers must maintain a login session for each web user. It must be
possible for a login session to span more than one application, allowing a user to log
1.
While the client is stateless with respect to authentication, the client requires that the server act as its proxy and maintain its login context. A reference to the login session state is made available to the client through
cookies or URL re-writing. If SSL mutual authentication is used as the
authentication protocol, the client can manage its own authentication
context, and need not depend on references to the login session state.
Early Draft
in once and access multiple applications. The required login session support is
described in the Servlet specification. This requirement of a session for each web
user supports single signon.
Applications can remain independent of the details of implementing the
security and maintenance of login information. The Java EE Product Provider has
the flexibility to choose authentication mechanisms independent of the
applications secured by these mechanisms.
Lazy authentication must be supported by web servers for protected web
resources. When authentication is required, one of the three required login
mechanisms listed in the next section may be used.
EE.3.4.2
All Java EE products are required to support three login mechanisms: HTTP basic
authentication, SSL mutual authentication, and form-based login. An application is
not required to use any of these mechanisms, but they are required to be available
for any applications use.
EE.3.4.2.1
All Java EE products are required to support HTTP basic authentication (RFC2068).
Platform Providers are also required to support basic authentication over SSL.
EE.3.4.2.2
SSL 3.02 and the means to perform mutual (client and server) certificate based
authentication are required by this specification.
All Java EE products must support the following cipher suites to ensure
interoperable authentication with clients:
TLS_RSA_WITH_RC4_128_MD5
SSL_RSA_WITH_RC4_128_MD5
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
TLS_RSA_EXPORT_WITH_RC4_40_MD5
SSL_RSA_EXPORT_WITH_RC4_40_MD5
TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
2.
http://
47
48
SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
These cipher suites are supported by the major web browsers and meet the
U.S. government export restrictions.
EE.3.4.2.3
The web application deployment descriptor contains an element that causes a Java
EE product to associate an HTML form resource (perhaps dynamically generated)
with the web application. If the Deployer chooses this form of authentication (over
HTTP basic, or SSL certificate based authentication), this form must be used as the
user interface for login to the application.
The form based login mechanism and web application deployment descriptors
are described in the Servlet specification.
EE.3.4.3
Unauthenticated Users
Web containers are required to support access to web resources by clients that have
not authenticated themselves to the container. This is the common mode of access to
web resources on the Internet.
A web container reports that no user has been authenticated by returning null
from the HttpServletRequest method getUserPrincipal. This is different than
the corresponding result for EJB containers. The EJB specification requires that
the EJBContext method getCallerPrincipal always return a valid Principal
object. The method can never return null.
In Java EE products that contain both a web container and an EJB container,
components running in a web container must be able to call enterprise beans even
when no user has been authenticated in the web container. When a call is made in
such a case from a component in a web container to an enterprise bean, a Java EE
product must provide a principal for use in the call.
A Java EE product may provide a principal for use by unauthenticated callers
using many approaches, including, but not limited to:
Always use a single distinguished principal.
Use a different distinguished principal per server, or per session, or per application.
Allow the deployer or system administrator to choose which principal to use
through the Run As capability of the web and enterprise bean containers.
Early Draft
This specification does not specify how a Java EE product should choose a
principal to represent unauthenticated users, although future versions of this
specification may add requirements in this area. Note that the EJB specification
does include requirements in this area when using the EJB interoperability
protocol. Applications are encouraged to use the Run As capability in cases where
the web component may be unauthenticated and needs to call EJB components.
EE.3.4.4
49
50
Early Draft
AUTHORIZATIONREQUIREMENTS
The support for principal delegation is typically specific to a security mechanism. For example, Kerberos supports a mechanism for the delegation of
authentication. (Refer to the Kerberos v5 specification for more details.)
5. Credentials Mapping. This technique may be used when an application server
and an EIS support different authentication domains. For example:
a. The initiating principal may have been authenticated and have public key
certificate-based credentials.
b. The security environment for the resource manager may be configured with
the Kerberos authentication service.
The application server is configured to map the public key certificate-based
credentials associated with the initiating principal to the Kerberos credentials.
EE.3.5
Authorization Requirements
Code Authorization
A Java EE product may restrict the use of certain Java SE classes and methods to
secure and ensure proper operation of the system. The minimum set of permissions
that a Java EE product is required to grant to a Java EE application is defined in
Section EE.6.2, Java Platform, Standard Edition (Java SE) Requirements. All
Java EE products must be capable of deploying application components with
exactly these permissions.
A Java EE Product Provider may choose to enable selective access to
resources using the Java protection model. The mechanism used is Java EE
product dependent.
A future version of the Java EE deployment descriptor definition (see
Chapter EE.8, Application Assembly and Deployment) may make it possible to
express additional permissions that a component needs for access.
51
52
EE.3.5.2
Caller Authorization
A Java EE product must enforce the access control rules specified at deployment
time (see Section EE.3.6, Deployment Requirements) and more fully described in
the EJB and Servlet specifications.
EE.3.5.3
Run As Identities
Java EE products must also support the Run As capability that allows the
Application Component Provider and the Deployer to specify an identity under
which an enterprise bean or web component must run. In this case it is the Run As
identity that is propagated to subsequent EJB components, rather than the original
caller identity.
Note that this specification doesnt specify any relationship between the Run
As identity and any underlying operating system identity that may be used to
access system resources such as files. However, the Java Authorization Contract
for Containers specification does specify the relationship between the Run As
identity and the access control context used by the Java SE security manager.
Early Draft
DEPLOYMENTREQUIREMENTS
EE.3.6
Deployment Requirements
All Java EE products must implement the access control semantics described in all
included component specifications, such as the EJB, JSP, and Servlet specifications,
and provide a means of mapping the security roles specified in metadata annotations
or the deployment descriptor to the actual roles exposed by a Java EE product.
While most Java EE products will allow the Deployer to customize the role
mappings and change the assignment of roles to methods, all Java EE products
must support the ability to deploy applications and components using exactly the
mappings and assignments specified in their metadata annotations or deployment
descriptors.
As described in the EJB specification and the Servlet specification, a Java EE
product must provide a deployment tool or tools capable of assigning the security
roles in metadata annotations or deployment descriptors to the entities that are
used to determine role membership at authorization time.
Application developers will need to specify (in the applications metadata
annotations or deployment descriptors) the security requirements of an application
in which some components may be accessed by unauthenticated users as well as
authenticated users (as described above in Section EE.3.4.3, Unauthenticated
Users). Applications express their security requirements in terms of security
roles, which the Deployer maps to users (principals) in the operational
environment at deployment time. An application might define a role representing
all authenticated and unauthenticated users and configure some enterprise bean
methods to be accessible by this role.
To support such usage, this specification requires that it be possible to map an
application defined security role to the universal set of application principals
independent of authentication.
EE.3.7
Future Directions
EE.3.7.1
Auditing
This specification does not specify requirements for the auditing of security relevant
events, nor APIs for application components to generate audit records. A future
version of this specification may include such a specification for products that
choose to provide auditing.
53
54
EE.3.7.2
Some applications need to control access to their data based on the content of the
data, rather than simply the type of the data. We refer to this as instance-based
rather than class-based access control. We hope to address this in a future release.
EE.3.7.3
User Registration
Early Draft
C H A P T E R
EE.4
Transaction Management
This chapter describes the required Java Platform, Enterprise Edition (Java EE)
EE.4.1
Overview
A Java EE Product that includes both a servlet container and an EJB container must
support a transactional application comprised of combinations of web application
components accessing multiple enterprise beans within a single transaction. If the
Java EE product also includes support for the Connectors specification, each
component may also acquire one or more connections to access one or more
transactional resource managers.
55
56
connections
connection
EJBean
EJBean
:
connection
1a
EJBean
Client
JSP/
servlet
2b
connection
EJBean
EJBean
1b
2c
connection
:
connection
2a
connection
EJBean
2d
For example, in Figure EE.4-1, the call tree starts from a servlet or JSP page
accessing multiple enterprise beans, which in turn may access other enterprise
beans. The components access resource managers via connections.
Figure EE.4-1
Servlets/JSP Pages Accessing Enterprise Beans
The Application Component Provider specifies, using a combination of
programmatic and declarative transaction demarcation APIs, how the platform
must manage transactions on behalf of the application.
For example, the application may require that all the components in Figure
EE.4-1 access resources as part of a single transaction. The Platform Provider
must provide the transaction capabilities to support such a scenario.
This specification does not define how the components and the resources are
partitioned or distributed within a single Java EE product. In order to achieve the
transactional semantics required by the application, the Java EE Product Provider
is free to execute the application components sharing a transaction in the same
Java virtual machine, or distribute them across multiple virtual machines, in
accordance with the requirements of the component specifications.
Early Draft
REQUIREMENTS
The rest of this chapter describes the transactional requirements for a Java EE
product in more detail.
EE.4.2
Requirements
This section defines the transaction support requirements of Java EE Products that
must be supported by Product Providers.
EE.4.2.1
Web Components
Transaction Requirements
57
58
Transaction Non-Requirements
1.
Early Draft
REQUIREMENTS
EE.4.2.2
Transactions may not span web requests from a client on the network. A web
component starts a transaction in the service method of a servlet (or, for a JSP
page, the service method of the equivalent JSP page Implementation Class) and it
must be completed before the service method returns to the network client.
Returning from the service method to the network client with an active transaction
context is an error. The web container is required to detect this error and abort the
transaction.
As specified above in Section EE.4.2.1.2, Transaction Non-Requirements,
requests made within a web container using the RequestDispatcher must
propagate any transaction context to the called class. Unless the called class
commits or aborts the transaction, the transaction must remain active when the
called class returns.
If a servlet that is called via the RequestDispatcher starts a transaction, the
behavior of the container with regard to that transaction is unspecified when the
servlet returns from its service method. The web container may throw an
exception to the caller, abort the transaction and return to the caller without error,
or propagate the transaction context back to the caller. Portable servlets will
complete any transaction they start before returning from the service method.
EE.4.2.3
There are many subtle and complex interactions between the use of transactional
resources and threads. To ensure correct operation, web components should obey
the following guidelines, and the web container must support at least these usages.
JTA transactions should be started and completed in the thread in which the
service method is called. Additional threads that are created for any purpose
should not attempt to start JTA transactions.
Transactional resources may be acquired and released by a thread other than
the service method thread, but should not be shared between threads.
Transactional resource objects (for example, JDBC Connection objects)
should not be stored in static fields. Such objects can only be associated with
one transaction at a time. Storing them in static fields would make it easy to
erroneously share them between threads in different transactions.
Web components implementing SingleThreadModel may store top-level
transactional resource objects in class instance fields. A top-level object is one
59
60
acquired directly from a container managed connection factory object (for example, a JDBC Connection acquired from a JDBC ConnectionFactory), as
opposed to other objects acquired from these top-level objects (for example, a
JDBC Statement acquired from a JDBC Connection). The web container ensures that requests to a SingleThreadModel servlet are serialized and thus only
one thread and one transaction will be able to use the object at a time, and that
the top-level object will be enlisted in any new transaction started by the component.
In web components not implementing SingleThreadModel, transactional resource objects, as well as Java Persistence EntityManager objects, should not
be stored in class instance fields, and should be acquired and released within
the same invocation of the service method.
Web components that are called by other web components (using the forward
or include methods) should not store transactional resource objects in class
instance fields.
Enterprise beans may be invoked from any thread used by a web component.
Transaction context propagation requirements are described above and in the
EJB specification.
EE.4.2.4
The Java EE Product Provider must provide support for transactions as defined in
the EJB specification.
EE.4.2.5
Application Clients
Applet Clients
Early Draft
REQUIREMENTS
EE.4.2.7
A Java EE product must support resource adapters that use XATransaction mode as
transactional resource managers. The platform must enable transactional access to
the resource adapter from servlets, JSP pages, and enterprise beans.
It must be possible to access the resource adapter from multiple application
components within a single transaction. For example, a servlet may wish to start a
transaction, access the resource adapter, invoke an enterprise bean that also
61
62
accesses the resource adapter as part of the same transaction, and, finally, commit
the transaction.
EE.4.3
Transaction Interoperability
EE.4.3.1
This specification does not require the Product Provider to implement any particular
protocol for transaction interoperability across multiple Java EE products. Java EE
compatibility requires neither interoperability among identical Java EE products
from the same Product Provider, nor among heterogeneous Java EE products from
multiple Product Providers.
We recommend that Java EE Product Providers use the IIOP transaction
propagation protocol defined by OMG and described in the OTS specification
(and implemented by the Java Transaction Service), for transaction
interoperability when using the EJB interoperability protocol based on RMI-IIOP.
We plan to require the IIOP transaction propagation protocol as the EJB server
transaction interoperability protocol in a future release of this specification.
EE.4.3.2
Early Draft
EE.4.4
EE.4.4.1
Requirements
A Possible Design
63
64
If only a single resource manager had been accessed as part of the transaction,
the transaction is completed using the resource manager specific local transaction mechanism.
If a global transaction had been started, the transaction is completed treating
the resource manager local transaction as a last resource in the global 2-phase
commit protocol, that is using the last resource 2-phase commit optimization.
EE.4.5
Connection Sharing
When multiple connections acquired by a Java EE application use the same resource
manager, containers may choose to provide connection sharing within the same
transaction scope. Sharing connections typically results in efficient usage of
resources and better performance. Containers are required to provide connection
sharing in certain situations; see the Connector specification for details.
Connections to resource managers acquired by Java EE applications are
considered potentially shared or shareable. A Java EE application component that
intends to use a connection in an unshareable way must provide deployment
information to that effect, to prevent the connection from being shared by the
container. Examples of when this may be needed include situations with changed
security attributes, isolation levels, character settings, and localization
configuration. Containers must not attempt to share connections that are marked
unshareable. If a connection is not marked unshareable, it must be transparent to
the application whether the connection is actually shared or not.
Java EE application components may use the optional shareable element of
the Resource annotation or the optional deployment descriptor element ressharing-scope to indicate whether a connection to a resource manager is
shareable or unshareable. Containers must assume connections to be shareable if
no deployment hint is provided. Section EE.10.7, Java EE Application Client
XML Schema, the EJB specification, and the Servlet specification provide
descriptions of the deployment descriptor element.
Java EE application components may cache connection objects and reuse
them across multiple transactions. Containers that provide connection sharing
must transparently switch such cached connection objects (at dispatch time) to
point to an appropriate shared connection with the correct transaction scope. Refer
to the Connector specification for a detailed description of connection sharing.
Early Draft
EE.4.6
EE.4.7
A Java EE product must support the use of multiple XA-capable resource adapters
in a single transaction. To support such a scenario, full two-phase commit support is
65
66
EE.4.8
Early Draft
C H A P T E R
EE.5
resources and configuration parameters, and how those items are represented in the
Java EE naming system and can be injected into application components. These
requirements are based on annotations defined in the Java Metadata specification
and features defined in the Java Naming and Directory Interface (JNDI)
specification. The Resource annotation described here is defined in more detail in
the Common Annotations specification. The EJB annotation described here is
defined in more detail in the Enterprise JavaBeans specification. The
PersistenceUnit and PersistenceContext annotations described here are defined
in more detail in the Java Persistence specification. The Inject annotation
described here is defined in the Dependency Injection for Java specification, and its
usage in Java EE applications is defined in the Contexts and Dependency Injection
for the Java EE Platform specification.
EE.5.1
Overview
The requirements defined in this chapter address the following two issues:
The Application Assembler and Deployer should be able to customize the behavior of an applications business logic without accessing the applications
source code. Typically this will involve specification of parameter values, con-
67
68
Chapter Organization
The following sections contain the Java EE platform solutions to the above issues:
Section EE.5.2, JNDI Naming Context, defines general rules for the use of
the JNDI naming context and its interaction with Java language annotations
that reference entries in the naming context.
Section EE.5.3, Responsibilities by Java EE Role, defines the general responsibilities for each of the Java EE roles such as Application Component
Provider, Application Assembler, Deployer, and Java EE Product Provider.
Section EE.5.4, Simple Environment Entries, defines the basic interfaces
that specify and access the application components naming environment. The
section illustrates the use of the application components naming environment
for generic customization of the application components business logic.
Section EE.5.5, Enterprise JavaBeans (EJB) References, defines the interfaces for obtaining the business interface, no-interface view, or home interface of an enterprise bean using an EJB reference. An EJB reference is a
special entry in the application components environment.
Section EE.5.6, Web Service References, refers to the specification for web
service references.
Section EE.5.7, Resource Manager Connection Factory References, defines
the interfaces for obtaining a resource manager connection factory using a resource manager connection factory reference. A resource manager connection
factory reference is a special entry in the application components environment.
Section EE.5.8, Resource Environment References, defines the interfaces
for obtaining an administered object that is associated with a resource using a
resource environment reference. A resource environment reference is a special entry in the application components environment.
Early Draft
OVERVIEW
69
70
Java EE application clients, enterprise beans, and web components are required to
have access to a JNDI naming environment1. The containers for these application
component types are required to provide the naming environment support described
here.
Annotations and deployment descriptors are the main vehicles for conveying
access information to the Application Assembler and Deployer about application
components requirements for customization of business logic and access to
external information. The annotations described here are available for use by all
application component types. The deployment descriptor entries described here
are present in identical form in the deployment descriptor schemas for each of
these application component types. See the corresponding specification of each
application component type for the details.
1.
Note that Java EE Managed Beans are required to have access to the JNDI naming environment of their calling component.
Early Draft
EE.5.2
71
72
5. The container also makes the environment naming context available to the application component instances at runtime. The application components instances may use the JNDI interfaces or component context lookup methods to
obtain the values of the environment entries.
EE.5.2.2
java:comp Names in this namespace are per-component (for example, per en-
terprise bean). Except for components in a web module, each component gets
its own java:comp namespace, not shared with any other component. Components in a web module do not have their own private component namespace.
See note below.
java:module
java:app Names in this namespace are shared by all components in all mod-
ules in a single application, where single application means a single deployment unit, such as a single ear file, a single module deployed standalone, etc.
For example, a war file and an EJB jar file in the same ear file would both have
access to resources in the java:app namespace.
Names in this namespace are shared by all applications deployed in an application server instance. Note that an application server instance may represent a single server, a cluster of servers, an administrative
domain containing many servers, or even more. The scope of an application
server instance is product-dependent, but it must be possible to deploy multiple
applications to a single application server instance.
java:global
Early Draft
73
74
EE.5.2.3
Each application component defines its own set of dependencies that must appear as
entries in the application components environment. All instances of an application
component within the same application instance within the same container share the
same environment entries. Application component instances are not allowed to
modify the environment at runtime.
In general, lookups of objects in the JNDI java: namespace are required to
return a new instance of the requested object every time. Exceptions are allowed
for the following:
The container knows the object is immutable (for example, objects of type
java.lang.String), or knows that the application cant change the state of the
object.
The object is defined to be a singleton, such that only one instance of the object may exist in the JVM.
The name used for the lookup is defined to return an instance of the object that
might be shared. The names java:comp/ORB, java:comp/ValidatorFactory,
Early Draft
As described in the following sections, a field or method of certain containermanaged component classes may be annotated to request that an entry from the
application components environment be injected into the class. The specifications
for the different containers indicate which classes are considered container-managed
classes; not all classes of a given type are necessarily managed by the container.
Any of the types of resources described in this chapter may be injected.
Injection may also be requested using entries in the deployment descriptor
corresponding to each of these resource types. The field or method may have any
access qualifier (public, private, etc.). For all classes except application client
main classes, the fields or methods must not be static. Because application
clients use the same lifecycle as Java SE applications, no instance of the
application client main class is created by the application client container. Instead,
the static main method is invoked. To support injection for the application client
main class, the fields or methods annotated for injection must be static.
A field of a class may be the target of injection. The field must not be final.
By default, the name of the field is combined with the fully qualified name of the
class and used directly as the name in the application components naming
context. For example, a field named myDatabase in the class MyApp in the package
com.example would correspond to the JNDI name java:comp/env/
com.example.MyApp/myDatabase. The annotation also allows the JNDI name to be
specified explicitly. When a deployment descriptor entry is used to specify
injection, the JNDI name and the field name are both specified explicitly. Note
that, by default, the JNDI name is relative to the java:comp/env naming context.
Environment entries may also be injected into a class through methods that
follow the naming conventions for JavaBeans properties. The annotation is
75
76
applied to the set method for the property, which is the method that is called to
inject the environment entry into the class. The JavaBeans property name (not the
method name) is used as the default JNDI name. For example, a method named
setMyDatabase in the same MyApp class would correspond to the same JNDI name
java:comp/env/com.example.MyApp/myDatabase as the field myDatabase.
Each resource may only be injected into a single field or method of a given
name in a given class. Requesting injection of the java:comp/env/
com.example.MyApp/myDatabase resource into both the setMyDatabase method
and the myDatabase field is an error. Note, however, that either the field or the
method could request injection of a resource of a different (non-default) name. By
explicitly specifying the JNDI name of a resource, a single resource may be
injected into multiple fields or methods of multiple classes.
The specifications for the various application component types describe
which classes may be annotated for injection, as summarized in Table EE.5-1.
They also describe when injection occurs in the lifecycle of the component.
Typically injection will occur after an instance of the class is constructed, but
before any business methods are called. If the container fails to find a resource
needed for injection, initialization of the class must fail, and the class must not be
put into service.
Table EE.5-1
Classes supporting
injection
Supports
PostConstruct?
Supports
PreDestroy?
Servlet
servlets
servlet filters
event listeners
Yes
Yes
Yes
Yes
Yes
Yes
JSP
tag handlers
tag library event listeners
Yes
Yes
Yes
Yes
JSF
Yes
Yes
JAX-WS
service endpoints
handlers
Yes
Yes
Yes
Yes
EJB
beans
Yes
Yes
Interceptor
interceptors
Yes
Yes
Spec
Early Draft
Table EE.5-1
Classes supporting
injection
Supports
PostConstruct?
Supports
PreDestroy?
Managed
Beans
managed beans
Yes
Yes
CDIa
Yes
Yes
Yes
Yes
Java EE
platform
Yes
Yes
No
Yes
Spec
a.
See the CDI specification for requirements related to resource injection in
CDI managed beans.
b.
We use this term to refer to classes that become managed beans per the rules
in the CDI specification, thus excluding managed beans declared using the
ManagedBean annotation as well as EJB session beans, both of which would be managed beans even in the absence of CDI.
Annotations may also be applied to the class itself. These annotations declare
an entry in the application components environment but do not cause the resource
to be injected. Instead, the application component is expected to use JNDI or a
component context lookup method to lookup the entry. When the annotation is
applied to the class, the JNDI name and the environment entry type must be
specified explicitly.
Resource annotations may appear on any of the classes listed above, or on any
superclass of any class listed above. A resource annotation on any class in the
inheritance hierarchy defines a resource needed by the application component.
However, injection of resources follows the Java language overriding rules for
visibility of fields and methods. A method definition that overrides a method on a
superclass defines the resource, if any, to be injected into that method. An
overriding method may request injection even though the superclass method does
not request injection, it may request injection of a different resource than is
requested by the superclass, or it may request no injection even though the
superclass method requests injection.
In addition, fields or methods that are not visible in or are hidden (as opposed
to overridden) by a subclass may still request injection. This allows, for example,
a private field to be the target of injection and that field to be used in the
implementation of the superclass, even though the subclass has no visibility into
that field and doesnt know that the implementation of the superclass is using an
77
78
injected resource. Note a declaration of a field in a subclass with the same name as
a field in a superclass always causes the field in the superclass to be hidden.
In some cases a class may need to perform initialization of its own after all
resources have been injected. To support this case, one method of the class may be
annotated with the PostConstruct annotation (or, equivalently, specified using the
post-construct entry of a deployment descriptor). This method will be called
after all injections have occured and before the class is put into service. This
method will be called even if the class doesnt request any resources to be
injected. Similarly, for classes whose lifecycle is managed by the container, the
PreDestroy annotation (or, equivalently, the pre-destroy entry of a deployment
descriptor) may be applied to one method that will be called when the class is
taken out of service and will no longer be used by the container. Each class in a
class hierarchy may have PostConstruct and PreDestroy methods. The order in
which the methods are called matches the order of the class hierarchy with
methods on a superclass being called before methods on a subclass.
The PostConstruct and PreDestroy annotations are specified by the
Common Annotations specification. All classes that support injection also support
the PostConstruct annotation. All classes for which the container manages the
full lifecycle of the object also support the PreDestroy annotation.
Please note that CDI support must be enabled selectively at the module level,
or more precisely at the archive level (see Section 12.1 of the CDI specification).
Only archives for which CDI is enabled, e.g. by including a META-INF/beans.xml
descriptor, are bean archives. It follows that CDI-style managed beans or
decorators can only exist as such when they are part of a bean archive. Thus, it is
only within a bean archive that support for resource injection for those component
types can be contemplated. This is markedly different from support for managed
beans that use the ManagedBean annotation. Such beans are unconditionally
required to be supported in all types of modules, and so is resource injection on
them.
EE.5.2.6
Environment entries may be declared by use of annotations, without need for any
deployment descriptor entries. Environment entries may also be declared by
deployment descriptor entries. The same environment entry may be declared using
both an annotation and a deployment descriptor entry. In this case, the information
in the deployment descriptor entry may be used to override some of the information
provided in the annotation. This approach may be used by an Application
Early Draft
79
80
EE.5.2.7
EE.5.3
This section describes the responsibilities for each Java EE role that apply to all uses
of the Java EE naming context. The sections that follow describe the responsibilities
that are specific to the different types of objects that may be stored in the naming
context.
EE.5.3.1
The Application Component Provider may make use of three techniques for
accessing and managing the naming context. First, the Application Component
Provider may use Java language annotations to request injection of a resource from
the naming context, or to declare elements that are needed in the naming context.
Second, the component may use the JNDI APIs to access entries in the naming
context. Third, deployment descriptor entries may be used to declare entries needed
in the naming context, and to request injection of these entries into application
Early Draft
The Application Assembler is allowed to modify the entries in the naming context
set by the Application Component Provider, and is allowed to set the values of those
entries for which the Application Component Provider has not specified any values.
The Application Assembler may use the deployment descriptor to override settings
made by the Application Component Provider in the source code using annotations.
EE.5.3.3
Deployers Responsibilities
The Deployer must ensure that all the entries declared by an application component
are created and properly initialized.
The Deployer can modify the entries that have been previously set by the
Application Component Provider and/or Application Assembler, and must set the
values of those entries for which a required value has not been specified. If an
entry includes the lookup-name element, the Deployer should bind it to the entry
specified as the target of the lookup.
The description deployment descriptor elements and annotation elements
provided by the Application Component Provider or Application Assembler help
the Deployer with this task.
EE.5.3.4
81
82
Provide a deployment tool that allows the Deployer to set and modify the entries of the application components naming context.
Implement the java:comp, java:module, java:app and java:global environment naming contexts, and provide them to the application component instances at runtime. The naming context must include all the entries declared
by the Application Component Provider, with their values supplied in the deployment descriptor or set by the Deployer. The environment naming context
must allow the Deployer to create subcontexts if they are needed by an application component. Certain entries in the naming context may have to be initialized with the values of other entries, specifically when the lookup
facility is used. In this case, it is an error if there are any circular dependencies
between entries. Similarly, it is an error if looking up the specified JNDI name
results in a resource whose type is not compatible with the entry being created. The deployment tool may allow the deployer to correct either of these
classes of errors and continue the deployment.
Ensure that, in the absence of any properties specified by the application, the
javax.naming.InitialContext implementation meets the requirements described in this specification.
Inject entries from the naming environment into the application component,
as specified by the deployment descriptor or annotations on the application
component classes.
The container must ensure that the application component instances have only
read access to their naming context. The container must throw the
javax.naming.OperationNotSupportedException from all the methods of the
javax.naming.Context interface that modify the environment naming context
and its subcontexts.
EE.5.4
Early Draft
EE.5.4.1
83
84
// an entry that gets its value from an application-wide entry
@Resource(lookup="java:app/env/timeout") int timeout;
EE.5.4.1.2
Programming Interfaces for Accessing Simple Environment
Entries
In addition to the injection based approach described above, an application
component may access environment entries dynamically. An application component
instance locates the environment naming context using the JNDI interfaces. An
instance creates a javax.naming.InitialContext object by using the constructor
with no arguments, and looks up the naming environment via the InitialContext
under the name java:comp/env. The application components environment entries
are stored directly in the environment naming context, or in its direct or indirect
subcontexts.
Environment entries have the Java programming language type declared by
the Application Component Provider in the deployment descriptor.
The following code example illustrates how an application component
accesses its environment entries.
public void setTaxInfo(int numberOfExemptions,...)
throws InvalidNumberOfExemptionsException {
...
// Obtain the application components
// environment naming context.
Context initCtx = new InitialContext();
Context myEnv = (Context)initCtx.lookup("java:comp/env");
// Obtain the maximum number of tax exemptions
// configured by the Deployer.
Integer max = (Integer)myEnv.lookup("maxExemptions");
// Obtain the minimum number of tax exemptions
// configured by the Deployer.
Integer min = (Integer)myEnv.lookup("minExemptions");
// Use the environment entries to
// customize business logic.
if (numberOfExemptions > max.intValue() ||
numberOfExemptions < min.intValue())
Early Draft
EE.5.4.1.3
The Application Component Provider must declare all the environment entries
accessed from the application components code. The environment entries are
declared using either annotations on the application components code, or using the
env-entry elements in the deployment descriptor. Each env-entry element
describes a single environment entry. The env-entry element consists of an optional
description of the environment entry, the environment entry name, which by default
is relative to the java:comp/env context, the expected Java programming language
type of the environment entry value (the type of the object returned from the JNDI
lookup method), and an optional environment entry value.
An environment entry is scoped to the application component whose
declaration contains the env-entry element. This means that the environment
entry is not accessible from other application components at runtime, and that
other application components may define env-entry elements with the same enventry-name without causing a name conflict.
If the Application Component Provider provides a value for an environment
entry using the env-entry-value element, the value can be changed later by the
Application Assembler or Deployer. The value must be a string that is valid for
the constructor of the specified type that takes a single String parameter, or in the
case of Character, a single character.
The following example is the declaration of environment entries used by the
application component whose code was illustrated in the previous subsection.
85
86
...
<env-entry>
<description>
The maximum number of tax exemptions
allowed to be set.
</description>
<env-entry-name>maxExemptions</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>15</env-entry-value>
</env-entry>
<env-entry>
<description>
The minimum number of tax exemptions
allowed to be set.
</description>
<env-entry-name>minExemptions</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>1</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>foo/name1</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>value1</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>foo/bar/name2</env-entry-name>
<env-entry-type>java.lang.Boolean</env-entry-type>
<env-entry-value>true</env-entry-value>
</env-entry>
<env-entry>
<description>Some description.</description>
<env-entry-name>name3</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
</env-entry>
<env-entry>
<env-entry-name>foo/name4</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>helperClass</env-entry-name>
<env-entry-type>java.lang.Class</env-entry-type>
<env-entry-value>com.acme.helper.Helper</env-entry-value>
Early Draft
</env-entry>
<env-entry>
<env-entry-name>timeUnit</env-entry-name>
<env-entry-type>java.util.concurrent.TimeUnit</env-entry-type>
<env-entry-value>NANOSECONDS</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>bar</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<lookup-name>java:app/env/appBar</lookup-name>
</env-entry>
...
87
88
allowed to be set.
</description>
<env-entry-name>
com.example.PayrollService/minExemptions
</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>1</env-entry-value>
<injection-target>
<injection-target-class>
com.example.PayrollService
</injection-target-class>
<injection-target-name>
minExemptions
</injection-target-name>
</injection-target>
</env-entry>
To support this case, the container must only inject a value for this resource if
the deployer has specified a value to override the default value. The env-entryvalue element in the deployment descriptor is optional when an injection target is
specified. If the element is not specified, no value will be injected. In addition, if
the element is not specified, the named resource is not initialized in the naming
context; explicit lookups of the named resource will fail.
The deployment descriptor equivalent of the lookup element of the
annotation is lookup-name. The following deployment descriptor
fragment is equivalent to the earlier example that used lookup.
@Resource
<env-entry>
<env-entry-name>somePackage.SomeClass/timeout</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<injection-target>
<injection-target-class>somePackage.SomeClass</injectiontarget-class>
<injection-target-name>timeout</injection-target-name>
</injection-target>
<lookup-name>java:app/env/timeout</lookup-name>
Early Draft
</env-entry>
EE.5.5
This section describes the programming and deployment descriptor interfaces that
allow the Application Component Provider to refer to the homes of enterprise beans
or to enterprise bean instances using logical names called EJB references. The
EJB references are special entries in the application components naming
environment. The Deployer binds the EJB reference to the enterprise beans
business interface, no-interface view, or home interface in the target operational
environment.
The deployment descriptor also allows the Application Assembler to link an
EJB reference declared in one application component to an enterprise bean
contained in an ejb-jar file in the same Java EE application. The link is an
instruction to the tools used by the Deployer describing the binding of the EJB
reference to the business interface, no-interface view, or home interface of the
specified target enterprise bean. The same linking can also be specified by the
Application Component Provider using annotations in the source code of the
component.
The requirements in this section only apply to Java EE products that include
an EJB container.
EE.5.5.1
89
90
EE.5.5.1.1
The following example illustrates use of almost all elements of the EJB
annotation.
@EJB(
name = "ejb/shopping-cart",
beanName = "cart1,
beanInterface = ShoppingCart.class,
description = "The shopping cart for this application"
)
private Cart myCart;
Early Draft
@EJB(
lookup="java:app/cartModule/ShoppingCart",
description = "The shopping cart for this application"
)
private Cart myOtherCart;
If the ShoppingCart bean were instead written to the EJB 2.1 client view, the
EJB reference would be to the beans home interface. For example:
@EJB(
name="ejb/shopping-cart",
beanInterface=ShoppingCartHome.class,
beanName="cart1",
description="The shopping cart for this application"
)
private ShoppingCartHome myCartHome;
If the ShoppingCart bean were instead written to the no-interface client view
and implemented by bean class ShoppingCartBean.class, the EJB reference
would have type ShoppingCartBean.class. For example:
@EJB(
name="ejb/shopping-cart",
beanInterface=ShoppingCartBean.class,
beanName="cart1",
description="The shopping cart for this application"
)
private ShoppingCartBean myCart;
EE.5.5.1.2
The Application Component Provider may use EJB references to locate the business
interface, no-interface view, or home interface of an enterprise bean as follows.
Assign an entry in the application components environment to the reference.
(See subsection 5.5.1.3 for information on how EJB references are declared in
the deployment descriptor.)
This specification recommends, but does not require, that references to enterprise beans be organized in the ejb subcontext of the application components
environment (that is, in the java:comp/env/ejb JNDI context). Note that en-
91
92
Early Draft
93
94
encapsulates access to employee records.
</description>
<ejb-ref-name>ejb/EmplRecord</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.wombat.empl.EmployeeRecordHome</home>
<remote>com.wombat.empl.EmployeeRecord</remote>
</ejb-ref>
<ejb-ref>
<ejb-ref-name>ejb/Payroll</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.aardvark.payroll.PayrollHome</home>
<remote>com.aardvark.payroll.Payroll</remote>
</ejb-ref>
<ejb-ref>
<ejb-ref-name>ejb/PensionPlan</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.wombat.empl.PensionPlanHome</home>
<remote>com.wombat.empl.PensionPlan</remote>
<lookup-name>java:global/personnel/retirement/PensionPlan</
lookup-name>
</ejb-ref>
...
EE.5.5.2
The Application Assembler can use the ejb-link element in the deployment
descriptor to link an EJB reference to a target enterprise bean.
The Application Assembler specifies the link to an enterprise bean as follows:
The Application Assembler uses the optional ejb-link element of the ejb-ref
or ejb-local-ref element of the referencing application component. The value of the ejb-link element is the name of the target enterprise bean. (It is the
name defined as defined by the metadata annotation (or default) on the bean
class or in the ejb-name element for the target enterprise bean.) The target enterprise bean can be in any ejb-jar file or war file in the same Java EE application as the referencing application component.
Alternatively, to avoid the need to rename enterprise beans to have unique
names within an entire Java EE application, the Application Assembler may
Early Draft
use either of the following two syntaxes in the ejb-link element of the referencing application component.
The Application Assembler specifies the module name of the ejb-jar file or
war file containing the referenced enterprise bean and appends the ejb-name
of the target bean separated by /. The module name is the base name of the
bundle with no filename extension, unless specified in the deployment descriptor.
The Application Assembler specifies the path name of the ejb-jar file containing the referenced enterprise bean and appends the ejb-name of the target bean
separated from the path name by #. The path name is relative to the referencing application component JAR file. In this manner, multiple beans with
the same ejb-name may be uniquely identified when the Application Assembler cannot change ejb-names.
Alternatively to the use of ejb-link, the Application Assembler may use the
lookup-name element to reference the target EJB component by means of one
of its JNDI names. It is an error for both ejb-link and lookup-name to appear
inside an ejb-ref element.
The Application Assembler must ensure that the target enterprise bean is typecompatible with the declared EJB reference. This means that the target enterprise bean must be of the type indicated in the ejb-ref-type element, if
present, and that the business interface, no-interface view, or home and remote
interfaces of the target enterprise bean must be Java type-compatible with the
type declared in the EJB reference.
The following example illustrates the use of the ejb-link element in the
deployment descriptor. The enterprise bean reference should be satisfied by the
bean named EmployeeRecord. The EmployeeRecord enterprise bean may be
packaged in the same module as the component making this reference, or it may
be packaged in another module within the same Java EE application as the
component making this reference.
...
<ejb-ref>
<description>
This is a reference to
encapsulates access to
has been linked to the
EmployeeRecord in this
95
96
</description>
<ejb-ref-name>ejb/EmplRecord</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.wombat.empl.EmployeeRecordHome</home>
<remote>com.wombat.empl.EmployeeRecord</remote>
<ejb-link>EmployeeRecord</ejb-link>
</ejb-ref>
...
Early Draft
The same effect can be obtained by using the lookup-name element instead,
using an appropriate JNDI name for the target bean.
...
<ejb-ref>
<ejb-ref-name>ShoppingService/myCart</ejb-ref-name>
<lookup-name>java:app/products/ShoppingCart</lookup-name>
</ejb-ref>
...
EE.5.5.3
Deployers Responsibilities
97
98
target enterprise bean has ejb-name ShoppingCart and is deployed in the standalone module products.jar.
...
<ejb-ref>
<ejb-ref-name>ShoppingService/myCart</ejb-ref-name>
<lookup-name>java:global/products/ShoppingCart</lookup-name>
</ejb-ref>
EE.5.5.4
The Java EE Product Provider must provide the deployment tools that allow the
Deployer to perform the tasks described in the previous subsection. The deployment
tools provided by the Java EE Product Provider must be able to process the
information supplied in class file annotations and in the ejb-ref and ejb-localref elements in the deployment descriptor.
At the minimum, the tools must be able to:
Preserve the application assembly information in annotations or in the ejblink elements by binding an EJB reference to the business interface, no-interface view, or home interface of the specified target enterprise bean.
Inform the Deployer of any unresolved EJB references, and allow him or her
to resolve an EJB reference by binding it to a specified compatible target enterprise bean.
EE.5.6
EE.5.7
Early Draft
99
100
// The employee database.
@Resource javax.sql.DataSource employeeAppDB;
public void changePhoneNumber(...) {
...
// Invoke factory to obtain a resource. The security
// principal for the resource is not given, and
// therefore it will be configured by the Deployer.
java.sql.Connection con = employeeAppDB.getConnection();
...
}
The data source object being looked up in the previous example may have
been declared as follows.
@Resource(name="java:app/env/customerDB",
type=javax.sql.DataSource.class)
public class AnApplicationClass {
...
}
Early Draft
EE.5.7.1.2
Programming Interfaces for Resource Manager Connection
Factory References
The Application Component Provider may use resource manager connection factory
references to obtain connections to resources as follows.
Assign an entry in the application components naming environment to the resource manager connection factory reference. (See subsection 5.7.1.3 for information on how resource manager connection factory references are declared in
the deployment descriptor.)
This specification recommends, but does not require, that all resource manager connection factory references be organized in the subcontexts of the application components environment, using a different subcontext for each
resource manager type. For example, all JDBC DataSource references
should be declared in the java:comp/env/jdbc subcontext, all JMS connection factories in the java:comp/env/jms subcontext, all JavaMail connection
factories in the java:comp/env/mail subcontext, and all URL connection factories in the java:comp/env/url subcontext. Note that resource manager connection factory references declared via annotations will not, by default,
appear in any subcontext.
Lookup the resource manager connection factory object in the application
components environment using the JNDI interface.
Invoke the appropriate method on the resource manager connection factory object to obtain a connection to the resource. The factory method is specific to the
resource type. It is possible to obtain multiple connections by calling the factory object multiple times.
The Application Component Provider can control the shareability of the
connections acquired from the resource manager connection factory. By default,
connections to a resource manager are shareable across other application
components in the application that use the same resource in the same transaction
context. The Application Component Provider can specify that connections
obtained from a resource manager connection factory reference are not shareable
by specifying the value of the shareable annotation element to false or the ressharing-scope deployment descriptor element to be Unshareable. The sharing of
connections to a resource manager allows the container to optimize the use of
connections and enables the containers use of local transaction optimizations.
101
102
The Application Component Provider has two choices with respect to dealing
with associating a principal with the resource manager access:
Allow the Deployer to set up principal mapping or resource manager sign on
information. In this case, the application component code invokes a resource
manager connection factory method that has no security-related parameters.
Sign on to the resource from the application component code. In this case, the
application component invokes the appropriate resource manager connection
factory method that takes the sign on information as method parameters.
The Application Component Provider uses the authenticationType
annotation element or the res-auth deployment descriptor element to indicate
which of the two resource authentication approaches is used.
We expect that the first form (that is letting the Deployer set up the resource
sign on information) will be the approach used by most application components.
The following code sample illustrates obtaining a JDBC connection.
public void changePhoneNumber(...) {
...
// obtain the initial JNDI context
Context initCtx = new InitialContext();
// perform JNDI lookup to obtain resource manager
// connection factory
javax.sql.DataSource ds = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/EmployeeAppDB");
// Invoke factory to obtain a resource. The security
// principal for the resource is not given, and
// therefore it will be configured by the Deployer.
java.sql.Connection con = ds.getConnection();
...
}
Early Draft
EE.5.7.1.3
Declaration of Resource Manager Connection Factory
References in Deployment Descriptor
Although a resource manager connection factory reference is an entry in the
application components environment, the Application Component Provider must
not use an env-entry element to declare it.
Instead, the Application Component Provider must declare all the resource
manager connection factory references using either annotations on the application
components code or in the deployment descriptor using the resource-ref
elements. This allows the consumer of the application components JAR file (the
Application Assembler or Deployer) to discover all the resource manager
connection factory references used by an application component. Deployment
descriptor entries may also be used to specify injection of a resource manager
connection factory reference into an application component.
Each resource-ref element describes a single resource manager connection
factory reference. The resource-ref element consists of the description
element, the mandatory res-ref-name element, and the optional res-sharingscope, res-type, and res-auth elements. The res-ref-name element contains the
name of the environment entry used in the application components code. The
name of the environment entry is relative to the java:comp/env context (for
example, the name should be jdbc/EmployeeAppDB rather than java:comp/env/
jdbc/EmployeeAppDB). The res-type element contains the Java programming
language type of the resource manager connection factory that the application
component code expects. The res-type element is optional if an injection target is
specified for this resource; in this case the res-type defaults to the type of the
injection target. The res-auth element indicates whether the application
component code performs resource sign on programmatically, or whether the
container signs on to the resource based on the principal mapping information
supplied by the Deployer. The Application Component Provider indicates the sign
on responsibility by setting the value of the res-auth element to Application or
Container. If not specified, the default is Container. The res-sharing-scope
element indicates whether connections to the resource manager obtained through
the given resource manager connection factory reference can be shared or whether
connections are unshareable. The value of the res-sharing-scope element is
Shareable or Unshareable. If the res-sharing-scope element is not specified,
connections are assumed to be shareable.
A resource manager connection factory reference is scoped to the application
component whose declaration contains the resource-ref element. This means
103
104
that the resource manager connection factory reference is not accessible from
other application components at runtime, and that other application components
may define resource-ref elements with the same res-ref-name without causing
a name conflict.
The type declaration allows the Deployer to identify the type of the resource
manager connection factory.
Note that the indicated type is the Java programming language type of the
resource manager connection factory, not the type of the connection.
The following example is the declaration of the resource reference used by the
application component illustrated in the previous subsection.
...
<resource-ref>
<description>
A data source for the database in which
the EmployeeService enterprise bean will
record a log of all transactions.
</description>
<res-ref-name>jdbc/EmployeeAppDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
The following example modifies the previous one by linking the resource
reference being defined to another one, using a well-known JNDI name for the
latter.
<resource-ref>
<res-ref-name>jdbc/EmployeeAppDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
<lookup-name>java:app/env/TheEmployeeDB</lookup-name>
</resource-ref>
Early Draft
EE.5.7.1.4
Deployers Responsibilities
The Deployer uses deployment tools to bind the resource manager connection
factory references to the actual resource factories configured in the target
operational environment.
The Deployer must perform the following tasks for each resource manager
connection factory reference declared in the deployment descriptor:
Bind the resource manager connection factory reference to a resource manager
connection factory that exists in the operational environment. The Deployer
may use, for example, the JNDI LinkRef mechanism to create a symbolic link
to the actual JNDI name of the resource manager connection factory. The resource manager connection factory type must be compatible with the type declared in the source code or in the res-type element. If the resource manager
connection factory references includes a lookup-name, the Deployer may
105
106
Early Draft
2.
107
108
EE.5.8
This section describes the programming and deployment descriptor interfaces that
allow the Application Component Provider to refer to administered objects that are
associated with a resource (for example, a Connector CCI InteractionSpec
instance) by using logical names called resource environment references. The
resource environment references are special entries in the application components
environment. The Deployer binds the resource environment references to
administered objects in the target operational environment.
EE.5.8.1
Early Draft
references declared via annotations will not, by default, appear in any subcontext.
Look up the administered object in the application components environment
using JNDI.
EE.5.8.1.3
Declaration of Resource Environment References in
Deployment Descriptor
Although the resource environment reference is an entry in the application
components environment, the Application Component Provider must not use a
env-entry element to declare it. Instead, the Application Component Provider must
declare all references to administered objects associated with resources using either
annotations on the application components code or the resource-env-ref elements
of the deployment descriptor. This allows the application components JAR file
consumer to discover all the resource environment references used by the
application component. Deployment descriptor entries may also be used to specify
injection of a resource environment reference into an application component.
Each resource-env-ref element describes the requirements that the
referencing application component has for the referenced administered object.
The resource-env-ref element contains optional description and resourceenv-ref-type elements and the mandatory resource-env-ref-name element. The
resource-env-ref-type element is optional if an injection target is specified for
this resource; in this case the resource-env-ref-type defaults to the type of the
injection target.
The resource-env-ref-name element specifies the resource environment
reference name. Its value is the environment entry name used in the application
component code. The name of the resource environment reference is relative to
the java:comp/env context. The resource-env-ref-type element specifies the
expected type of the referenced object.
A resource environment reference is scoped to the application component
whose declaration contains the resource-env-ref element. This means that the
resource environment reference is not accessible to other application components
at runtime, and that other application components may define resource-env-ref
elements with the same resource-env-ref-name without causing a name conflict.
A resource environment reference may specify a lookup-name to link the
reference being defined to another one via a JNDI name.
109
110
EE.5.8.2
Deployers Responsibilities
The Java EE Product Provider must provide the deployment tools that allow the
Deployer to perform the tasks described in the previous subsection. The deployment
tools provided by the Java EE Product Provider must be able to process the
information supplied in the class file annotations and the resource-env-ref
elements in the deployment descriptor.
At the minimum, the tools must be able to inform the Deployer of any
unresolved resource environment references, and allow him or her to resolve a
resource environment reference by binding it to a specified compatible target
object in the environment.
EE.5.9
This section describes the programming and deployment descriptor interfaces that
allow the Application Component Provider to refer to message destination objects
by using logical names called message destination references. Message
destination references are special entries in the application components
environment. The Deployer binds the message destination references to
administered message destinations in the target operational environment.
The requirements in this section only apply to Java EE products that include
support for JMS.
Early Draft
EE.5.9.1
111
112
EE.5.9.1.2
Early Draft
113
114
</message-destination-ref-name>
<message-destination-type>
javax.jms.Queue
</message-destination-type>
<message-destination-usage>
Produces
</message-destination-usage>
</message-destination-ref>
...
EE.5.9.2
Early Draft
the Application Assembler links a message-driven bean to its source destination, he or she should use the message-destination-type element of the
message-driven element to specify the expected destination type. Otherwise,
the Application Assembler uses the message-destination-link element of
the message-destination-ref element of the application component that
consumes messages to link to the common destination. In the latter case, the
Application Assembler uses the message-destination-usage element of the
message-destination-ref element to indicate that the application component
consumes messages from the referenced destination.
To avoid the need to rename message destinations to have unique names within an entire Java EE application, the Application Assembler may use the following syntax in the message-destination-link element of the referencing
application component. The Application Assembler specifies the path name
of the JAR file containing the referenced message destination and appends the
message-destination-name of the target destination separated from the path
name by #. The path name is relative to the referencing application component JAR file. In this manner, multiple destinations with the same messagedestination-name may be uniquely identified.
When linking message destinations, the Application Assembler must ensure
that the consumers and producers for the destination require a message destination of the same or compatible type, as determined by the messaging system.
EE.5.9.3
Deployers Responsibilities
115
116
plication Assembler.
EE.5.9.4
The Java EE Product Provider must provide the deployment tools that allow the
Deployer to perform the tasks described in the previous subsection. The deployment
tools provided by the Java EE Product Provider must be able to process the
information supplied in the message-destination-ref elements in the deployment
descriptor.
At the minimum, the tools must be able to inform the Deployer of any
unresolved message destination references, and allow him or her to resolve a
message destination reference by binding it to a specified compatible target object
in the environment.
EE.5.10
UserTransaction References
Certain Java EE application component types are allowed to use the JTA
UserTransaction interface to start, commit, and abort transactions. Such
application components can find an appropriate object implementing the
UserTransaction interface by looking up the JNDI name java:comp/
UserTransaction or by requesting injection of a UserTransaction object using the
Resource annotation. The authenticationType and shareable elements of the
Resource annotation must not be specified. The container is only required to
provide the java:comp/UserTransaction name, or inject a UserTransaction
object, for those components that can validly make use of it. Any such reference to a
UserTransaction object is only valid within the component instance that performed
the lookup. See the individual component definitions for further information.
The following example illustrates how an application component acquires and
uses a UserTransaction object via injection.
@Resource UserTransaction tx;
public void updateData(...) {
...
// Start a transaction.
tx.begin();
...
// Perform transactional operations on data.
Early Draft
USERTRANSACTIONREFERENCES
...
// Commit the transaction.
tx.commit();
...
}
117
118
EE.5.10.2
EE.5.11
TransactionSynchronizationRegistry References
Early Draft
ORBREFERENCES
EE.5.12
ORB References
Some Java EE applications will need to make use of the CORBA ORB to perform
certain operations. Such applications can find an appropriate object implementing
the ORB interface by looking up the JNDI name java:comp/ORB or by requesting
injection of an ORB object. The container is required to provide the java:comp/ORB
name for all components except applets. Any such reference to a ORB object is only
valid within the component instance that performed the lookup.
The following example illustrates how an application component acquires and
uses an ORB object via injection.
@Resource ORB orb;
public void method(...) {
...
// Get the POA to use when creating object references.
POA rootPOA = (POA)orb.resolve_initial_references("RootPOA");
...
}
119
120
Context initCtx = new InitialContext();
// Look up the ORB object.
ORB orb = (ORB)initCtx.lookup("java:comp/ORB");
// Get the POA to use when creating object references.
POA rootPOA = (POA)orb.resolve_initial_references("RootPOA");
...
}
The Java EE Product Provider is responsible for providing an appropriate ORB object
as required by this specification.
Early Draft
EE.5.13
This section describes the metadata annotations and deployment descriptor elements
that allow the application component code to refer to the entity manager factory for
a persistence unit using a logical name called a persistence unit reference.
Persistence unit references are special entries in the application components
environment. The Deployer binds the persistence unit references to entity manager
factories that are configured in accordance with the persistence.xml specification
for the persistence unit, as described in the Java Persistence specification.
The requirements in this section only apply to Java EE products that include
support for the Java Persistence API.
EE.5.13.1
121
122
EE.5.13.1.2
The Application Component Provider must use persistence unit references to obtain
references to entity manager factories as follows.
Assign an entry in the application components environment to the persistence
unit reference. (See subsection 5.13.1.3 for information on how persistence
unit references are declared in the deployment descriptor.) It is recommended
that the Application Component Provider organize all persistence unit references in the java:comp/env/persistence subcontext of the components environment.
Lookup the entity manager factory for the persistence unit in the application
components environment using JNDI.
Invoke the appropriate method on the entity manager factory to obtain an entity
manager instance.
The following code sample illustrates obtaining an entity manager factory.
@PersistenceUnit(name="persistence/InventoryAppDB")
@Stateless
public class InventoryManagerBean implements InventoryManager {
EJBContext ejbContext;
...
public void updateInventory(...) {
...
// obtain the initial JNDI context
Context initCtx = new InitialContext();
// perform JNDI lookup to obtain entity manager factory
EntityManagerFactory = (EntityManagerFactory)
initCtx.lookup(
"java:comp/env/persistence/InventoryAppDB");
// use factory to obtain application-managed entity manager
EntityManager em = emf.createEntityManager();
...
}
}
Early Draft
EE.5.13.1.3
Declaration of Persistence Unit References in Deployment
Descriptor
Although a persistence unit reference is an entry in the application components
environment, the Application Component Provider must not use an env-entry
element to declare it.
Instead, if metadata annotations are not used, the Application Component
Provider must declare all the persistence unit references in the deployment
descriptor using the persistence-unit-ref elements. This allows the Application
Assembler or Deployer to discover all the persistence unit references used by an
application component. Deployment descriptor entries may also be used to
specify injection of a persistence unit reference into an application component.
Each persistence-unit-ref element describes a single entity manager
factory reference for the persistence unit. The persistence-unit-ref element
consists of the optional description and persistence-unit-name elements, and
the mandatory persistence-unit-ref-name element.
The persistence-unit-ref-name element contains the name of the
environment entry used in the application components code. The name of the
environment entry is relative to the java:comp/env context (e.g., the name should
be persistence/InventoryAppDB rather than java:comp/env/persistence/
InventoryAppDB). The persistence-unit-name element is the name of the
persistence unit, as specified in the persistence.xml file for the persistence unit.
The following example is the declaration of a persistence unit reference used
by the InventoryManager enterprise bean illustrated in the previous subsection.
...
<persistence-unit-ref>
<description>
Persistence unit for the inventory management
application.
</description>
<persistence-unit-ref-name>
persistence/InventoryAppDB
</persistence-unit-ref-name>
<persistence-unit-name>
InventoryManagement
</persistence-unit-name>
</persistence-unit-ref>
...
123
124
EE.5.13.2
Early Draft
The relevant deployment descriptor entry is located based on the JNDI name
used with the annotation (either defaulted or provided explicitly).
The persistence-unit-name overrides the unitName element of the annotation. The Application Assembler or Deployer should exercise caution in
changing this value, if specified, as doing so is likely to break the application.
The injection target, if specified, must name exactly the annotated field or
property method.
EE.5.13.3
Deployers Responsibility
The Deployer uses deployment tools to bind a persistence unit reference to the
actual entity manager factory configured for the persistence in the target operational
environment.
The Deployer must perform the following tasks for each persistence unit
reference declared in the metadata annotations or deployment descriptor:
Bind the persistence unit reference to an entity manager factory configured for
the persistence unit that exists in the operational environment. The Deployer
may use, for example, the JNDI LinkRef mechanism to create a symbolic link
to the actual JNDI name of the entity manager factory.
If the persistence unit name is specified, the Deployer should bind the persistence unit reference to the entity manager factory for the persistence unit
specified as the target.
Provide any additional configuration information that the entity manager factory needs for managing the persistence unit, as described in the Java Persistence specification.
EE.5.13.4
125
126
EE.5.14
This section describes the metadata annotations and deployment descriptor elements
that allow the application component code to refer to a container-managed entity
manager of a specified persistence context type using a logical name called a
persistence context reference. Persistence context references are special entries in
the application components environment. The Deployer binds the persistence
context references to container-managed entity managers for persistence contexts of
the specified type and configured in accordance with their persistence unit, as
described in the Java Persistence specification.
The requirements in this section only apply to Java EE products that include
support for the Java Persistence API.
EE.5.14.1
Early Draft
name of the persistence unit as declared in the persistence.xml file that defines the
persistence unit. The optional type element specifies whether a transaction-scoped
or extended persistence context is to be used. If the type is not specified, a
transaction-scoped persistence context will be used. References to containermanaged entity managers with extended persistence contexts can only be injected
into stateful session beans. The optional synchronization element specifies
whether the persistence context is always automatically synchronized with the
current transaction or whether it must be explicitly joined to the transaction. If the
synchronization element is not specified, the persistence context will be
automatically synchronized. The optional properties element specifies
configuration properties to be passed to the persistence provider when the entity
manager is created.
The following code example illustrates how an application component uses
annotations to declare persistence context references.
@PersistenceContext(type=EXTENDED)
EntityManager em;
EE.5.14.1.2
127
128
EE.5.14.1.3
Declaration of Persistence Context References in Deployment
Descriptor
Although a persistence context reference is an entry in the application components
environment, the Application Component Provider must not use an env-entry
element to declare it.
Instead, if metadata annotations are not used, the Application Component
Provider must declare all the persistence context references in the deployment
descriptor using the persistence-context-ref elements. This allows the
Application Assembler or Deployer to discover all the persistence context
references used by an application component. Deployment descriptor entries may
also be used to specify injection of a persistence context reference into a bean.
Each persistence-context-ref element describes a single containermanaged entity manager reference. The persistence-context-ref element
consists of the optional description, persistence-unit-name, persistencecontext-type, persistence-context-synchronization, and persistenceproperty elements, and the mandatory persistence-context-ref-name element.
The persistence-context-ref-name element contains the name of the
environment entry used in the application components code. The name of the
environment entry is relative to the java:comp/env context (e.g., the name should
be persistence/InventoryAppMgr rather than java:comp/env/persistence/
InventoryAppMgr). The persistence-unit-name element is the name of the
persistence unit, as specified in the persistence.xml file for the persistence unit.
The persistence-context-type element specifies whether a transaction-scoped
or extended persistence context is to be used. Its value is either Transaction or
Early Draft
Extended.
EE.5.14.2
129
130
application.
</description>
<persistence-context-ref-name>
persistence/InventoryAppDB
</persistence-context-ref-name>
<persistence-unit-name>
../lib/inventory.jar#InventoryManagement
</persistence-unit-name>
</persistence-context-ref>
...
Early Draft
EE.5.14.3
Deployers Responsibility
The Deployer uses deployment tools to bind a persistence context reference to the
container-managed entity manager for the persistence context of the specified type
and configured for the persistence unit in the target operational environment.
The Deployer must perform the following tasks for each persistence context
reference declared in the metadata annotations or deployment descriptor:
Bind the persistence context reference to a container-managed entity manager
for a persistence context of the specified type and configured for the persistence unit as specified in the persistence.xml file for the persistence unit that
exists in the operational environment. The Deployer may use, for example, the
JNDI LinkRef mechanism to create a symbolic link to the actual JNDI name of
the entity manager.
If the persistence unit name is specified, the Deployer should bind the persistence context reference to an entity manager for the persistence unit specified
as the target.
Provide any additional configuration information that the entity manager factory needs for creating such an entity manager and for managing the persistence unit, as described in the Java Persistence specification.
EE.5.14.4
131
132
Add, remove, and configure entity manager factories in the server environment.
In some scenarios, these tasks can be performed by the Deployer.
EE.5.15
A component may access the name of the current application using the pre-defined
JNDI name java:app/AppName. A component may access the name of the current
module using the pre-defined JNDI name java:module/ModuleName. Both of these
names are represented by String objects.
EE.5.15.1
The Java EE Product Provider is responsible for providing the correct application
name and module name String objects as required by this specification.
EE.5.16
This section describes the metadata annotations and deployment descriptor entries
that allow an application to obtain instances of the Bean Validation Validator and
ValidatorFactory types.
Applications that need to use those interfaces can find appropriate objects by
looking up the name java:comp/Validator for Validator and java:comp/
ValidatorFactory for ValidatorFactory, or by requesting the injection of an
object of the appropriate type via the Resource annotation. The
authenticationType and shareable elements of the Resource annotation must not
be specified.
@Resource ValidatorFactory validatorFactory;
@Resource Validator validator;
Early Draft
For Validator objects, the default validation context is used. This means that
all such Validators will be equivalent to those obtained by first acquiring a ValidatorFactory and then invoking the getValidator method on it with no
arguments.
In other words, the following two code snippets are equivalent:
// obtaining a Validator directly
Context initCtx = new InitialContext();
Validator validator = (Validator)initCtx.lookup(
"java:comp/Validator");
// obtaining a Validator from a ValidatorFactory
Context initCtx = new InitialContext();
Validator validator =
((ValidatorFactory) initCtx.lookup(
"java:comp/ValidatorFactory"))
.getValidator();
EE.5.16.1
133
134
EE.5.16.2
EE.5.17
java:comp
Early Draft
135
136
integer-valued elements: -1
string-valued elements:
array-valued elements: {}
EE.5.17.1
Guidelines
JNDI Name
The Deployer and Java EE Product Provider must not alter the specified JNDI
name.
Early Draft
EE.5.17.2.2
Resource Address
Quality of service elements may be altered by the Deployer. The Java EE Product
Provider is permitted to impose restrictions upon quality of service elements in
accordance with its implementation limits and quality of service guarantees. If
quality of service values that have been specified do not meet these restrictions, the
Product Provider must not reject the deployment (but must instead use appropriate
values).
EE.5.17.2.4
Properties
All resource definition annotations and XML elements support the use of property
elements (elements named properties or property). A Java EE Product
Provider is permitted to reject a deployment if a property that it recognizes has a
value that it does not support. A Java EE Product Provider must not reject a
deployment on the basis of a property that it does not recognize.
EE.5.17.3
3.
Note that the Deployer is not prohibited from overriding the resource address.
137
138
Early Draft
serverName="myserver.com",
user="lance",
password="secret")
139
140
Deployers Responsibilities
Early Draft
141
142
Resource annotation. For example, the above JMS ConnectionFactory could be
referenced as follows:
@Stateless
public class MySessionBean {
@Resource(lookup = "java:app/MyJMSCF")
ConnectionFactory myCF;
...
}
Deployers Responsibilities
Early Draft
EE.5.17.5
@JMSDestinationDefinition(
name="java:app/MyJMSQueue",
className="javax.jms.Queue",
destinationName="myQueue1")
143
144
Deployers Responsibilities
Early Draft
The Mail Session resource may be defined in any of the JNDI namespaces
described in Section EE.5.2.2, Application Component Environment
Namespaces.
A Mail Session resource may be defined in a web module, EJB module,
application client module, or application deployment descriptor using the mailsession element.
For example:
<mail-session>
<description>Sample Mail Session definition</description>
<name>java:app/mail/MySession</name>
<store-protocol>IMAP</store-protocol>
<store-protocol-class>
com.example.mail.imap.IMAPStore
</store-protocol-class>
<transport-protocol>SMTP</transport-protocol>
<transport-protocol-class>
com.sun.mail.smtp.SMTPTransport
</transport-protocol-class>
<host>somewhere.myco.com</host>
<user>linda</user>
<password>secret</password>
<from>[email protected]</from>
<property>
<name>Property1</name>
<value>10</value>
</property>
<property>
<name>Property2</name>
<value>20</value>
</property>
</mail-session>
@MailSessionDefinition(
name="java:app/mail/MySession",
host="somewhere.myco.com",
145
146
from="[email protected]")
Deployers Responsibilities
Early Draft
EE.5.17.6.3
@ConnectorResourceDefinition(
name="java:app/myCustomConnector",
className="com.extraServices.CustomConnector")
147
148
EE.5.17.7.1
Deployers Responsibilities
Early Draft
element. Properties that are specified are used in the configuration of the
administered object, as described in the Connector specification.
For example:
<administered-object>
<description>Sample Admin Object definition</description>
<name>java:app/MyAdminObject</name>
<class-name>com.extraServices.AdminObject</class-name>
<resource-adapter-name>myESRA</resource-adapter-name>
<property>
<name>Property1</name>
<value>10</value>
</property>
<property>
<name>Property2</name>
<value>20</value>
</property>
</administered-object>
AdministeredObjectDefinition
@AdministeredObjectDefinition(
name="java:app/myAdminObject",
className="com.extraServices.AdminObject")
149
150
EE.5.17.8.1
Deployers Responsibilities
EE.5.18
The Java EE Platform requires that a Java EE Product Provider provide a database
in the operational environment (see Section EE.2.6, Database). The Java EE
Product Provider must also provide a preconfigured, default data source for use by
the application in accessing this database.
The Java EE Product Provider must make the default data source accessible to the
application under the JNDI name java:comp/defaultDataSource.
The Application Component Provider or Deployer may explicitly bind a
DataSource resource reference to the default data source using the lookup element
of the Resource annotation or the lookup-name element of the resource-ref
deployment descriptor element. For example,
@Resource(name="myDataSource",
lookup="java:comp/defaultDataSource")
DataSource myDS;
Early Draft
In the absence of such a binding for a data source resource reference, the reference
will map to a preconfigured data source for the product's default database.
For example, the following will map to a preconfigured data source for the product's
default database:
@Resource(name="myDataSource")
DataSource myDS;
EE.5.18.1
EE.5.19
The Java EE Platform requires that a Java EE Product Provider provide a JMS
provider in the operational environment (see Section EE.2.7.8, Java Message
Service (JMS)) . The Java EE Product Provider must also provide a preconfigured,
JMS ConnectionFactory for use by the application in accessing this JMS provider.
The Java EE Product Provider must make the default JMS connection factory
accessible to the application under the JNDI name java:comp/
defaultJMSConnectionFactory.
The Application Component Provider or Deployer may explicitly bind a JMS
ConnectionFactory resource reference to the default connection factory using the
lookup element of the Resource annotation or the lookup-name element of the
resource-ref deployment descriptor element. For example,
151
152
@Resource(name="myJMSCF",
lookup="java:comp/defaultJMSConnectionFactory")
ConnectionFactory myJMScf;
In the absence of such a binding for a JMS connection factory resource reference,
the reference will map to a JMS connection factory for the product's JMS provider.
For example, the following will map to a preconfigured connection factory for the
product's default JMS provider:
@Resource(name="myJMSCF")
ConnectionFactory myJMScf;
EE.5.19.1
The Java EE Product Provider must provide a JMS provider in the operational
environment. The Java EE Product Provider must also provide a preconfigured,
default JMS connection factory for use by the application in accessing this provider
under the JNDI name java:comp/defaultJMSConnectionFactory.
If a JMS ConnectionFactory resource reference is not mapped to a specific JMS
connection factory by the Application Component Provider or Deployer, it must be
mapped by the Java EE Product Provider to a preconfigured JMS connection factory
for the Java EE Product Provider's default JMS provider.
EE.5.20
In cloud environments, some Java EE applications that support multi-tenant use will
need to access the identifier of the Customer for which the current application
instance has been deployed.
Application components in cloud environments can access the tenant
identifier by looking up the JNDI name java:comp/tenantId. The tenant
identifier value is a String.
Open issue: does there need to be a way to designate an application as multitenant-enabled, and is the tenant identifier only available to applications that are
designated as such?
Early Draft
Open issue: what are the constraints on tenant identifiers? Max length (e.g.,
254 characters)? Character set (usable as filename, implementable as an email
address)?
EE.5.20.1
The Application Component provider is responsible for using the defined name to
look up the tenant identifier.
EE.5.20.2
The Java EE Product Provider is responsible for assigning tenant identifiers and
providing the appropriate String object that represents the current tenant as required
by this specification.
EE.5.21
This section describes the metadata annotations and deployment descriptor entries
that allow an application to obtain instances of a Managed Bean.
An instance of a named Managed Bean can be obtained by looking up its
name in JNDI using the same naming scheme used for EJB components:
java:app/<module-name>/<bean-name>
java:module/<bean-name>
The latter will only work within the module the Managed Bean is declared in.
Each such lookup must return a new instance.
Alternatively, the Resource annotation can be used to request the injection of
a Managed Bean given either its type or its name. If a name is specified using the
lookup element then the type of the resource can be any of the types that the
Managed Bean class implements, including any of its interfaces. If no name is
specified, the type must be the Managed Bean class itself. (Note that the name
element of the Resource annotation serves an entirely different purpose than the
lookup element, consistently with other uses of Resource in this specification.)
The authenticationType and shareable elements of the Resource annotation
must not be specified.
153
154
EE.5.21.1
Early Draft
EE.5.21.2
EE.5.22
This section describes the metadata annotations and deployment descriptor entries
that allow an application to obtain instances of the CDI BeanManager type.
Typically, only portable extensions using the CDI SPI need to access a
BeanManager. Application code may occasionally require access to that interface;
in that case, the application should either look up a BeanManager instance in JNDI
under the name java:comp/BeanManager, or request the injection of an object of
type javax.enterprise.inject.spi.BeanManager via the Resource annotation. If
the latter, the authenticationType and shareable elements of the Resource
annotation must not be specified.
@Resource BeanManager manager;
Per the CDI specification, a bean can also request the injection of a
using the Inject annotation.
BeanManager
155
156
EE.5.22.2
EE.5.23
Early Draft
BeanManager.getCreationalContext()
method.
5. Inject the resulting reference into the component that is the target of the injection.
Containers may optimize the steps above, e.g., by avoiding calls to the actual
CDI SPI and relying on container-specific interfaces instead, as long as the
outcome is the same.
157
158
Early Draft
C H A P T E R
EE.6
Application Programming
Interface
This chapter describes API requirements for the Java Platform, Enterprise
Edition (Java EE). Java EE requires the provision of a number of APIs for use by
Java EE applications, starting with the core Java APIs and including many
additional Java technologies.
EE.6.1
Required APIs
159
160
EE.6.1.1
The containers provide all application components with at least the Java Platform,
Standard Edition, v7 (Java SE) APIs. Containers may provide newer versions of the
Java SE platform, provided they meet all the Java EE platform requirements. The
Java SE platform includes the following enterprise technologies:
Java IDL
JDBC
RMI-IIOP
JNDI
JAXP
StAX
JAAS
JMX
JAX-WS
JAXB
JAF
SAAJ
Common Annotations
In particular, the applet execution environment must be Java SE 7 compatible.
Since typical browsers dont yet provide such support, Java EE products may
make use of the Java Plugin to provide the required applet execution environment.
Use of the Java Plugin is not required, but is one method of meeting the
requirement to provide a Java SE 7 compatible applet execution environment.
This specification adds no requirements to the applet container beyond those
specified by Java SE.
Some of the enterprise technologies that are included in Java SE 7 are also
available independently of the Java SE platform, and this specification requires
newer versions of some of these technologies, as described in the following
section.
The specifications for the Java SE APIs are available at http://
docs.oracle.com/javase/7/docs/.
Early Draft
REQUIREDAPIS
EE.6.1.2
The full Java EE platform also provides a number of Java technologies in each of
the containers defined by this specification. Table EE.6-1 indicates the technologies
with their required versions, which containers include the technologies, and whether
the technology is required (REQ), proposed optional (POPT), or optional (OPT).
Each Java EE profile specification will include a similar table describing which
technologies are required for the profile. Note that some technologies are marked
Optional, as described in the next section.
Table EE.6-1
Java EE Technologies
Java Technology
App Client
Web
EJB
Status
EJB 3.2
Ya
REQ, OPTb
Servlet 3.1
REQ
JSP 2.2
REQ
EL 3.0
REQ
JMS 2.0
REQ
JTA 1.2
REQ
JavaMail 1.4
REQ
Connector 1.6
REQ
REQ
JAX-RPC 1.1
OPT
JAX-WS 2.2
REQ
JAX-RS 2.0
REQ
JAXB 2.2
REQ
JAXR 1.0
OPT
REQ
OPT
JACC 1.4
REQ
JASPIC 1.0
REQ
161
162
Table EE.6-1
Java EE Technologies
Java Technology
App Client
Web
EJB
Status
REQ
JSTL 1.2
REQ
REQ
JSF 2.2
REQ
REQ
REQ
REQ
REQ
Interceptors 1.1
REQ
REQ
REQ
a.
b.
c.
All classes and interfaces required by the specifications for the APIs must be
provided by the Java EE containers indicated above. In some cases, a Java EE
product is not required to provide objects that implement interfaces intended to be
implemented by an application server, nevertheless, the definitions of such
interfaces must be included in the Java EE platform. If an implementation
includes support for a technology marked as Optional, that technology must be
supported in all containers.
EE.6.1.3
Early Draft
removing_features) to
1. The Umbrella Expert Group (UEG) for release N of the platform decides to
propose that a particular feature be removed. The specification for that release
documents the proposal.
2. The UEG for release N+1 decides whether to remove the feature from that
release, retain it as a required component, or leave it in the "proposed
removal" state for the next UEG to decide.
The result of successfully applying this policy to a feature is not the actual
deletion of the feature but rather the conversion of the feature from a required
component of the platform into an optional component. No actual removal from
the specification occurs, although the feature may be removed from products at
the choice of the product vendor.
Technologies that have been pruned as of Java EE 7 are marked Optional in
Table EE.6-1. Technologies that may be pruned in a future release are marked
Proposed Optional in Table EE.6-1.
EE.6.2
EE.6.2.1
Programming Restrictions
163
164
Since we do not want to subset the Java SE platform, and we want Java EE
Product Providers to be able to use Java SE products without modification in the
Java EE platform, we use the Java SE security permissions mechanism to express
the programming restrictions imposed on Application Component Providers.
In this section, we specify the Java SE security permissions that the Java EE
Product Provider must provide for each application component type. We call these
permissions the Java EE security permissions set. The Java EE security
permissions set is a required part of the Java EE API contract. Portable
applications will rely on only the set of permissions specified here.
EE.6.2.2
The Java EE security permissions set defines the minimum set of permissions that
application components can expect. All Java EE products must be capable of
deploying application components that require the set of permissions described
here. The Product Provider must ensure that the application components do not use
functions that conflict with the Java EE security permission set.
The exact set of security permissions for application components in use at a
particular installation is a matter of policy outside the scope of this specification.
A Java EE product may allow applications to run with no security manager at all,
or with a security manager that enforces any set of security permissions, as
required by the enterprise environment. All Java EE products must be capable of
running applications with at least the set of permissions described here. Some
Java EE products will allow the set of permissions available to a component to be
configurable, providing some components with more or fewer permissions than
those described here. A future version of this specification will allow these
security requirements to be specified in the deployment descriptor for application
components. At the present time, application components that need permissions
not in this minimal set should describe their requirements in their documentation.
Note that it may not be possible to deploy applications that require more than this
minimal set on some Java EE products.
The Java SE security permissions are fully described in http://
docs.oracle.com/javase/7/docs/technotes/guides/security/
permissions.html.
Early Draft
EE.6.2.3
Table EE.6-2 lists the Java EE security permissions set. This is the typical set of
permissions that components of each type should expect to have.
Table EE.6-2
Security Permissions
Target
Action
Application Clients
java.awt.AWTPermission
accessClipboard
java.awt.AWTPermission
accessEventQueue
java.awt.AWTPermission
showWindowWithout
WarningBanner
java.lang.RuntimePermission
exitVM
java.lang.RuntimePermission
loadLibrary
java.lang.RuntimePermission
queuePrintJob
java.net.SocketPermission
connect
java.net.SocketPermission
localhost:1024-
accept,listen
java.io.FilePermission
read,write
java.util.PropertyPermission
read
java.net.SocketPermission
codebase
connect
java.util.PropertyPermission
limited
read
Applet Clients
loadLibrary
java.lang.RuntimePermission
queuePrintJob
java.net.SocketPermission
connect
java.io.FilePermission
read,write
java.util.PropertyPermission
read
165
166
Note that an operating system that hosts a Java EE product may impose
additional security restrictions of its own that must be taken into account. For
instance, the user identity under which a component executes is not likely to have
permission to read and write all files.
EE.6.2.4
Additional Requirements
EE.6.2.4.1
Networking
The Java SE platform includes a pluggable mechanism for supporting multiple URL
protocols through the java.net.URLStreamHandler class and the
java.net.URLStreamHandlerFactory interface.
The following URL protocols must be supported:
file:
Only reading from a file URL need be supported. That is, the corresponding URLConnection objects getOutputStream method may fail with an
UnknownServiceException. File access is restricted according to the permissions described above.
http: Version 1.1 of the HTTP protocol must be supported. An http URL
must support both input and output.
https: SSL version 3.0 and TLS version 1.0 must be supported by https URL
MIME Type
Java Type
image/gif
java.awt.Image
Early Draft
Table EE.6-3
MIME Type
Java Type
image/jpeg
java.awt.Image
image/png
java.awt.Image
Many environments will use HTTP proxies rather than connecting directly to
HTTP servers. If HTTP proxies are being used in the local environment, the
HTTP support in the Java SE platform should be configured to use the proxy
appropriately. Application components must not be required to configure proxy
support in order to use an http URL.
Most enterprise environments will include a firewall that limits access from
the internal network (intranet) to the public Internet, and vice versa. It is typical
for access using the HTTP protocol to pass through such firewalls, perhaps by
using proxy servers. It is not typical that general TCP/IP traffic, including RMIJRMP, and RMI-IIOP, can pass through firewalls.
These considerations have implications on the use of various protocols to
communicate between application components. This specification requires that
HTTP access through firewalls be possible where local policy allows. Some Java
EE products may provide support for tunneling other communication through
firewalls, but this is neither specified nor required. Application developers should
consider the impact of these issues in the design of applications, particularly in
view of cloud environments, where a cloud platform provider might only allow
HTTP-based access.
EE.6.2.4.2
JDBC API
The JDBC API, which is part of the Java SE platform, allows for access to a wide
range of data storage systems. The Java SE platform, however, does not require that
a system meeting the Java Compatible quality standards provide a database that is
accessible through the JDBC API.
To allow for the development of portable applications, the Java EE
specification does require that such a database be available and accessible from a
Java EE product through the JDBC API. Such a database must be accessible from
web components, enterprise beans, and application clients, but need not be
accessible from applets. In addition, the driver for the database must meet the
JDBC Compatible requirements in the JDBC specification.
167
168
Early Draft
EE.6.2.4.3
Java IDL
The requirements in this section only apply to Java EE products that support
interoperability using CORBA.
Java IDL allows applications to access any CORBA object, written in any
language, using the standard IIOP protocol. The Java EE security restrictions
typically prevent all application component types except application clients from
creating and exporting a CORBA object, but all Java EE application component
types can be clients of CORBA objects.
A Java EE product must support Java IDL as defined by chapters 1 - 8, 13,
and 15 of the CORBA 2.3.1 specification, available at http://www.omg.org/cgibin/doc?formal/99-10-07, and the IDL To Java Language Mapping
Specification, available at http://www.omg.org/cgi-bin/doc?ptc/2000-01-08.
The IIOP protocol supports the ability to multiplex calls over a single
connection. All Java EE products must support requests from clients that
multiplex calls on a connection to either Java IDL server objects or RMI-IIOP
server objects (such as enterprise beans). The server must allow replies to be sent
in any order, to avoid deadlocks where one call would be blocked waiting for
another call to complete. Java EE clients are not required to multiplex calls,
although such support is highly recommended.
A Java EE product must provide support for a CORBA Portable Object
Adapter (POA) to support portable stub, skeleton, and tie classes. A Java EE
application that defines or uses CORBA objects other than enterprise beans must
include such portable stub, skeleton, and tie classes in the application package.
Java EE applications need to use an instance of org.omg.CORBA.ORB to
perform many Java IDL and RMI-IIOP operations. The default ORB returned by
a call to ORB.init(new String[0], null) must be usable for such purposes; an
application need not be aware of the implementation classes used for the ORB and
RMI-IIOP support.
In addition, for performance reasons it is often advantageous to share an ORB
instance among components in an application. To support such usage, all web,
enterprise bean, and application client containers are required to provide an ORB
instance in the JNDI namespace under the name java:comp/ORB. The container is
allowed, but not required, to share this instance between components. The
container may also use this ORB instance itself. To support isolation between
applications, an ORB instance should not be shared between components in
different applications. To allow this ORB instance to be safely shared between
169
170
components, portable components must restrict their usage of certain ORB APIs
and functionality:
Do not call the ORB shutdown method.
Do not call the org.omg.CORBA_2_3.ORB methods register_value_factory
and unregister_value_factory with an id used by the container.
A Java EE product must provide a COSNaming service to support the EJB
interoperability requirements. It must be possible to access this COSNaming
service using the Java IDL COSNaming APIs. Applications with appropriate
privileges must be able to lookup objects in the COSNaming service.
COSNaming is defined in the Interoperable Naming Service specification,
available at http://www.omg.org/cgi-bin/doc?formal/2000-06-19.
EE.6.2.4.4
RMI-JRMP
RMI-IIOP
The requirements in this section only apply to Java EE products that include an EJB
container and support interoperability using RMI-IIOP.
RMI-IIOP allows objects defined using RMI style interfaces to be accessed
using the IIOP protocol. It must be possible to make any remote enterprise bean
accessible via RMI-IIOP. Some Java EE products will simply make all remote
enterprise beans always (and only) accessible via RMI-IIOP; other products might
control this via an administrative or deployment action. These and other
approaches are allowed, provided that any remote enterprise bean (or by
extension, all remote enterprise beans) can be made accessible using RMI-IIOP.
Components accessing remote enterprise beans may need to use the narrow
method of the javax.rmi.PortableRemoteObject class, under circumstances
described in the EJB specification. Because remote enterprise beans may be
deployed using other RMI protocols, portable applications must not depend on the
characteristics of RMI-IIOP objects (for example, the use of the Stub and Tie base
classes) beyond what is specified in the EJB specification.
Early Draft
171
172
doc?formal/99-10-07, and by the Java Language To IDL Mapping
Specification, available at http://www.omg.org/cgi-bin/doc?ptc/2000-01-06.
EE.6.2.4.6
JNDI
A Java EE product that supports the following types of objects must be able to make
them available in the applications JNDI namespace: EJBHome objects,
EJBLocalHome objects, EJB business interface objects, JTA UserTransaction
objects, JDBC API DataSource objects, JMS ConnectionFactory and Destination
objects, JavaMail Session objects, URL objects, resource manager
ConnectionFactory objects (as specified in the Connector specification), ORB
objects, EntityManagerFactory objects, and other Java language objects as
described in Chapter EE.5, Resources, Naming, and Injection. The JNDI
implementation in a Java EE product must be capable of supporting all of these uses
in a single application component using a single JNDI InitialContext. Application
components will generally create a JNDI InitialContext using the default
constructor with no arguments. The application component may then perform
lookups on that InitialContext to find objects as specified above.
The names used to perform lookups for Java EE objects are application
dependent. The application components deployment descriptor is used to list the
names and types of objects expected. The Deployer configures the JNDI
namespace to make appropriate components available. The JNDI names used to
lookup such objects must be in the JNDI java: namespace. See Chapter EE.5,
Resources, Naming, and Injection for details.
Particular names are defined by this specification for the cases when the Java
EE product includes the corresponding technology. For all application
components that have access to the JTA UserTransaction interface, the
appropriate UserTransaction object can be found using the name java:comp/
UserTransaction. In all containers except the applet container, application
components may lookup a CORBA ORB instance using the name java:comp/ORB.
For all application components that have access to the CDI BeanManager interface,
the appropriate BeanManager object can be found using the name java:comp/
BeanManager. For all application components that have access to the Validation
APIs, the appropriate Validator and ValidatorFactory objects can be found
using the names java:comp/Validator and java:comp/Validator respectively.
The name used to lookup a particular Java EE object may be different in
different application components. In general, JNDI names can not be
meaningfully passed as arguments in remote calls from one application
Early Draft
This specification requires that Java EE containers provide a per thread context class
loader for the use of system or library classes in dynamically loading classes
provided by the application. The EJB specification requires that all EJB client
containers provide a per thread context class loader for dynamically loading system
value classes. The per thread context class loader is accessed using the Thread
method getContextClassLoader.
The classes used by an application will typically be loaded by a hierarchy of
class loaders. There may be a top level application class loader, an extension class
loader, and so on, down to a system class loader. The top level application class
loader delegates to the lower class loaders as needed. Classes loaded by lower
class loaders, such as portable EJB system value classes, need to be able to
173
174
discover the top level application class loader used to dynamically load
application classes.
This specification requires that containers provide a per thread context class
loader that can be used to load top level application classes as described above.
See Section EE.8.2.5, Dynamic Class Loading for recommendations for
libraries that dynamically load classes.
EE.6.2.4.8
Java Authentication and Authorization Service (JAAS)
Requirements
All EJB containers and all web containers must support the use of the JAAS APIs as
specified in the Connector specification. All application client containers must
support use of the JAAS APIs as specified in Chapter EE.10, Application Clients.
A reference guide to the JAAS APIs is available at http://docs.oracle.com/
javase/6/docs/technotes/guides/security/jaas/JAASRefGuide.html.
EE.6.2.4.9
Early Draft
EE.6.3
This specification requires that a Java EE product provide support for enterprise
beans as specified in the EJB specification. The EJB specification is available at
http://jcp.org/en/jsr/summary?id=345.
This specification does not impose any additional requirements at this time.
Note that the EJB specification includes the specification of the EJB
interoperability protocol based on RMI-IIOP. All containers that support EJB
clients must be capable of using the EJB interoperability protocol to invoke
enterprise beans. All EJB containers must support the invocation of enterprise
beans using the EJB interoperability protocol. A Java EE product may also
support other protocols for the invocation of enterprise beans.
A Java EE product may support multiple object systems (for example, RMIIIOP and RMI-JRMP). It may not always be possible to pass object references
from one object system to objects in another object system. However, when an
enterprise bean is using the RMI-IIOP protocol, it must be possible to pass object
references for RMI-IIOP or Java IDL objects as arguments to methods on such an
enterprise bean, and to return such object references as return values of a method
on such an enterprise bean. In addition, it must be possible to pass a reference to
an RMI-IIOP-based enterprise beans Home or Remote interface to a method on
an RMI-IIOP or Java IDL object, or to return such an enterprise bean object
reference as a return value from such an RMI-IIOP or Java IDL object.
In a Java EE product that includes both an EJB container and a web container,
both containers are required to support access to local enterprise beans. No
support is provided for access to local enterprise beans from the application client
container or the applet container.
EE.6.4
175
176
javax.ejb.EJBObject
javax.ejb.EJBHome
javax.ejb.EJBLocalObject
javax.ejb.EJBLocalHome
javax.transaction.UserTransaction
Early Draft
EE.6.5
The JSP specification depends on and builds on the servlet framework. A Java EE
product must support the entire JSP specification.
The JSP specification is available at http://jcp.org/en/jsr/
summary?id=245.
EE.6.6
The Expression Language specification was formerly a part of the JavaServer Pages
specification. It was split off into its own specification so that it could be used
independently of JavaServer Pages. A Java EE product must support the Expression
Language.
The Expression Language specification is available at http://jcp.org/en/
jsr/detail?id=341.
EE.6.7
javax.jms.ServerSessionPool
javax.jms.ConnectionConsumer
177
178
javax.jms.MessageConsumer
method getMessageListener
javax.jms.MessageConsumer
method setMessageListener
javax.jms.Connection
method setExceptionListener
javax.jms.Connection
method stop
javax.jms.Connection
method setClientID
javax.jms.MessagingContext
method stop
javax.jms.MessagingContext
method setClientID
javax.jms.MessagingContext
method setMessageListener
javax.jms.MessagingContext
method setBatchMessageListener
javax.jms.MessagingContext
method setExceptionListener
javax.jms.MessagingContext
method createMessagingContext
javax.jms.Session
method setMessageListener
javax.jms.Session
method getMessageListener
javax.jms.Session
method setBatchMessageListener
javax.jms.Session
method getBatchMessageListener
javax.jms.Session
method run
javax.jms.Connection
method createConnectionConsumer
javax.jms.Connection
method createDurableConnectionConsumer
Early Draft
In general, the behavior of a JMS provider should be the same in both the EJB
container and the web container. The EJB specification describes restrictions on
the use of JMS in an EJB container, as well as the interaction of JMS with
transactions in an EJB container. Applications running in the web container
should follow the same restrictions.
The JMS specification is available at http://jcp.org/en/jsr/
detail?id=343.
EE.6.8
JTA defines the UserTransaction interface that is used by applications to start, and
commit or abort transactions. Application components get a UserTransaction
object through a JNDI lookup using the name java:comp/UserTransaction or by
requesting injection of a UserTransaction object.
JTA also defines the TransactionSynchronizationRegistry interface that
can be used by system level components such as persistence managers to interact
with the transaction manager. These components get a
TransactionSynchronizationRegistry object through a JNDI lookup using the
name java:comp/TransactionSynchronizationRegistry or by requesting
injection of a TransactionSynchronizationRegistry object.
A number of interfaces defined by JTA are used by an application server to
communicate with a transaction manager, and for a transaction manager to
interact with a resource manager. These interfaces must be supported as described
in the Connector specification. In addition, support for other transaction facilities
may be provided transparently to the application by a Java EE product.
The JTA specification is available at http://jcp.org/en/jsr/
detail?id=907.
EE.6.9
The JavaMail API allows for access to email messages contained in message stores,
and for the creation and sending of email messages using a message transport.
Specific support is included for Internet standard MIME messages. Access to
message stores and transports is through protocol providers supporting specific store
and transport protocols. The JavaMail API specification does not require any
specific protocol providers, but the JavaMail reference implementation includes an
179
180
IMAP message store provider, a POP3 message store provider, and an SMTP
message transport provider.
Configuration of the JavaMail API is typically done by setting properties in a
Properties object that is used to create a javax.mail.Session object using a
static factory method. To allow the Java EE platform to configure and manage
JavaMail API sessions, an application component that uses the JavaMail API
should request a Session object using JNDI, and should list its need for a Session
object in its deployment descriptor using a resource-ref element, or by using a
Resource annotation. A JavaMail API Session object should be considered a
resource factory, as described in Section EE.5.7, Resource Manager Connection
Factory References. This specification requires that the Java EE platform support
javax.mail.Session objects as resource factories, as described in that section.
The Java EE platform requires that a message transport be provided that is
capable of handling addresses of type javax.mail.internet.InternetAddress
and messages of type javax.mail.internet.MimeMessage. The default message
transport must be properly configured to send such messages using the send
method of the javax.mail.Transport class. Any authentication needed by the
default transport must be handled without need for the application to provide a
javax.mail.Authenticator or to explicitly connect to the transport and supply
authentication information.
This specification does not require that a Java EE product support any
message store protocols.
Note that the JavaMail API creates threads to deliver notifications of Store,
Folder, and Transport events. The use of these notification facilities may be
limited by the restrictions on the use of threads in various containers. In EJB
containers, for instance, it is typically not possible to create threads.
The JavaMail API uses the JavaBeans Activation Framework API to support
various MIME data types. The JavaMail API must include
javax.activation.DataContentHandlers for the following MIME data types,
corresponding to the Java programming language type indicated in Table EE.6-4.
Table EE.6-4
Mime Type
Java Type
text/plain
java.lang.String
text/html
java.lang.String
Early Draft
Table EE.6-4
Mime Type
Java Type
text/xml
java.lang.String
multipart/*
javax.mail.internet.MimeMultipart
message/rfc822
javax.mail.internet.MimeMessage
EE.6.10
In full Java EE products, all EJB containers and all web containers must support the
full set of Connector APIs. All such containers must support Resource Adapters that
use any of the specified transaction capabilities. The Java EE deployment tools must
support deployment of Resource Adapters, as defined in the Connector
specification, and must support the deployment of applications that use Resource
Adapters.
The Connector specification is available at http://jcp.org/en/jsr/
detail?id=322.
EE.6.11
The Web Services for Java EE specification defines the capabilities a Java EE
application server must support for deployment of web service endpoints. A
complete deployment model is defined, including several new deployment
descriptors. All Java EE products must support the deployment and execution of
web services as specified by the Web Services for Java EE specification (JSR-109).
The Web Services for Java EE specification is available at http://jcp.org/
en/jsr/detail?id=109.
181
182
EE.6.12
The JAX-RPC specification defines client APIs for accessing web services as well
as techniques for implementing web service endpoints. The Web Services for Java
EE specification describes the deployment of JAX-RPC-based services and clients.
The EJB and Servlet specifications also describe aspects of such deployment. In
Java EE products that support JAX-RPC, it must be possible to deploy JAX-RPCbased applications using any of these deployment models.
The JAX-RPC specification describes the support for message handlers that
can process message requests and responses. In general, these message handlers
execute in the same container and with the same privileges and execution context
as the JAX-RPC client or endpoint component with which they are associated.
These message handlers have access to the same JNDI java:comp/env namespace
as their associated component. Custom serializers and deserializers, if supported,
are treated in the same way as message handlers.
Note that neither web service annotations nor injection is supported for JAXRPC service endpoints and handlers. New applications are encouraged to use
JAX-WS to take advantage of these new facilities that make it easier to write web
services.
The JAX-RPC specification is available at http://jcp.org/en/jsr/
detail?id=101.
EE.6.13
The JAX-WS specification provides support for web services that use the JAXB
API for binding XML data to Java objects. The JAX-WS specification defines client
APIs for accessing web services as well as techniques for implementing web service
endpoints. The Web Services for Java EE specification describes the deployment of
JAX-WS-based services and clients. The EJB and Servlet specifications also
describe aspects of such deployment. It must be possible to deploy JAX-WS-based
applications using any of these deployment models.
The JAX-WS specification describes the support for message handlers that
can process message requests and responses. In general, these message handlers
execute in the same container and with the same privileges and execution context
as the JAX-WS client or endpoint component with which they are associated.
Early Draft
These message handlers have access to the same JNDI java:comp/env namespace
as their associated component. Custom serializers and deserializers, if supported,
are treated in the same way as message handlers.
The JAX-WS specification is available at http://jcp.org/en/jsr/
summary?id=224.
EE.6.14
JAX-RS defines APIs for the development of Web services built according to the
Representational State Transfer (REST) architectural style.
In a full Java EE product, all Java EE web containers are required to support
applications that use JAX-RS technology.
The specification describes the deployment of services as a servlet. It must be
possible to deploy JAX-RS-based applications using this deployment model with
the servlet-class element of the web.xml descriptor naming the applicationsupplied extension of the JAX-RS Application abstract class.
The specification defines a set of optional container-managed facilities and
resources that are intended to be available in a Java EE container all such
features and resources must be made available.
The JAX-RS specification is available at http://jcp.org/en/jsr/
summary?id=339.
EE.6.15
The Java Architecture for XML Binding (JAXB) provides a convenient way to bind
an XML schema to a representation in Java language programs. JAXB can be used
independently or in combination with JAX-WS, where it provides a standard data
binding for web service messages. In a full Java EE product, all Java EE application
client containers, web containers, and EJB containers are required to support the
JAXB API.
The Java API for XML Data Binding specification can be found at http://
jcp.org/en/jsr/detail?id=222.
183
184
EE.6.16
The JAXR specification defines APIs for client access to XML-based registries
such as ebXML registries and UDDI registries. Java EE products that support JAXR
must include a JAXR registry provider that meets at least the JAXR level 0
requirements.
The JAXR specification is available at http://jcp.org/en/jsr/
detail?id=93.
EE.6.17
The Java EE Management API provides APIs for management tools to query a Java
EE application server to determine its current status, applications deployed, and so
on. All Java EE products must support this API as described in its specification.
The Java EE Management API specification is available at http://jcp.org/
en/jsr/detail?id=77.
EE.6.18
The Java EE Deployment API defines the interfaces between the runtime
environment of a deployment tool and plug-in components provided by a Java EE
application server. These plug-in components execute in the deployment tool and
implement the Java EE product-specific deployment mechanisms. Java EE products
that support the Java EE Deployment API are required to supply these plug-in
components for use in tools from other vendors.
Note that the Java EE Deployment specification does not define new APIs for
direct use by Java EE applications. However, it would be possible to create a Java
EE application that acts as a deployment tool and provides the runtime
environment required by the Java EE Deployment specification.
The Java EE Deployment API specification is available at http://jcp.org/
en/jsr/detail?id=88.
Early Draft
EE.6.19
The JACC specification defines a contract between a Java EE application server and
an authorization policy provider. In a full Java EE product, all Java EE application
containers, web containers, and enterprise bean containers are required to support
this contract.
The JACC specification can be found at http://jcp.org/en/jsr/
detail?id=115.
EE.6.20
EE.6.21
JSP pages are usually translated into Java language pages and then compiled to
create class files. The Debugging Support for Other Languages specification
describes information that can be included in a class file to relate class file data to
185
186
data in the original source file. All Java EE products are required to be able to
include such information in class files that are generated from JSP pages.
The Debugging Support for Other Languages specification can be found at
http://jcp.org/en/jsr/detail?id=45.
EE.6.22
JSTL defines a standard tag library that makes it easier to develop JSP pages. All
Java EE products are required to provide JSTL for use by all JSP pages.
The Standard Tag Library for JavaServer Pages specification can be found at
http://jcp.org/en/jsr/detail?id=52.
EE.6.23
The Web Services Metadata for the Java Platform specification defines Java
language annotations that can be used to simplify the development of web services.
These annotations can be used with JAX-WS web service components.
The Web Services Metadata for the Java Platform specification can be found
at http://jcp.org/en/jsr/detail?id=181.
EE.6.24
Early Draft
EE.6.25
The Common Annotations specification defines Java language annotations that are
used by several other specifications, including this specification. The specifications
that use these annotations fully define the requirements for these annotations. The
applet container need not support any of these annotations. All other containers
must provide definitions for all of these annotations, and must support the semantics
of these annotations as described in the corresponding specifications and
summarized in the following table.
Table EE.6-5
Annotation
App Client
Web
EJB
Resource
Resources
PostConstruct
PreDestroy
Generated
RunAs
DeclareRoles
RolesAllowed
PermitAll
DenyAll
ManagedBean
DataSourceDefinition
DataSourceDefinitions
The Common Annotations for the Java Platform specification can be found at
http://jcp.org/en/jsr/detail?id=250.
187
188
EE.6.26
Java Persistence is the standard API for the management of persistence and object/
relational mapping. The Java Persistence specification provides an object/relational
mapping facility for application developers using a Java domain model to manage a
relational database. Java Persistence is required to be supported in Java EE. It can
also be used in Java SE environments.
As mandated by the Java Persistence specification, in a Java EE environment
the classes of the persistence unit should not be loaded by the application class
loader or any of its parent class loaders until after the entity manager factory for
the persistence unit has been created.
The Java Persistence specification can be found at http://jcp.org/en/jsr/
detail?id=338.
EE.6.27
The Bean Validation specification defines a metadata model and API for JavaBean
validation. The default metadata source is annotations, with the ability to override
and extend the metadata through the use of XML validation descriptors.
The Java EE platform requires that web containers make an instance of
ValidatorFactory available to JSF implementations by storing it in a servlet
context attribute named
javax.faces.validator.beanValidator.ValidatorFactory.
Early Draft
EE.6.28
EE.6.29
EE.6.30
EE.6.31
The Dependency Injection for Java (DI) specification defines a standard set of
annotations (and one interface) for use on injectable classes.
In the Java EE platform, support for Dependency Injection is mediated by
CDI. More specifically, DI injection points are only active in bean archives, as
specified in CDI. See Section EE.5.23, Support for Dependency Injection for
more detail.
The DI specification can be found at http://jcp.org/en/jsr/
detail?id=330.
189
190
Early Draft
C H A P T E R
EE.7
Interoperability
This chapter describes the interoperability requirements for the Java Platform,
EE.7.1
Introduction to Interoperability
The Java EE platform will be used by enterprise environments that support clients of
many different types. The enterprise environments will add new services to existing
Enterprise Information Systems (EISs). They will be using various hardware
platforms and applications written in various languages.
In particular, the Java EE platform may be used in enterprise environments to
bring together any of the following kinds of applications:
applications written in such languages as C++ and Visual Basic.
applications running on a personal computer platform, or Unix workstation.
standalone Java technology-based applications that are not directly supported
by the Java EE platform.
It is the interoperability requirements of the Java EE platform, set out in this
chapter, that make it possible for it to provide indirect support for various types of
clients, different hardware platforms, and a multitude of software applications.
The interoperability features of the Java EE platform permit the underlying
disparate systems to work together seamlessly, while hiding much of the
complexity required to join these pieces together.
The interoperability requirements for the current Java EE platform release
allow:
191
192
EE.7.2
Interoperability Protocols
This specification requires that a Java EE product support a standard set of protocols
and formats to ensure interoperability between Java EE applications and with other
applications that also implement these protocols and formats. The specification
requires support for the following groups of protocols and formats:
Internet and web protocols
OMG protocols
Java technology protocols
Data formats
Most of these protocols and formats are supported by Java SE and by the
underlying operating system.
EE.7.2.1
Standards based Internet protocols are the means by which different pieces of the
platform communicate. The Java EE platform typically supports the following
Internet protocols, as described in the corresponding technology specifications:
TCP/IP protocol familyThis is the core component of Internet communication. TCP/IP and UDP/IP are the standard transport protocols for the Internet.
TCP/IP is supported by Java SE and the underlying operating system.
HTTP 1.1This is the core protocol of web communication. As with TCP/IP,
HTTP 1.1 is supported by Java SE and the underlying operating system. A
Early Draft
INTEROPERABILITYPROTOCOLS
OMG Protocols
This specification requires the a full Java EE product to support the following
Object Management Group (OMG) based protocols:
IIOP (Internet Inter-ORB Protocol)Supported by Java IDL and RMI-IIOP in
Java SE. Java IDL provides standards-based interoperability and connectivity
through the Common Object Request Broker Architecture (CORBA). CORBA
specifies the Object Request Broker (ORB) which allows applications to communicate with each other regardless of location. This interoperability is delivered through IIOP, and is typically found in an intranet setting. IIOP can be
used as an RMI protocol using the RMI-IIOP technology. IIOP is defined in
Chapters 13 and 15 of the CORBA 2.3.1 specification, available at http://
omg.org/cgi-bin/doc?formal/99-10-07.
EJB interoperability protocolThe EJB interoperability protocol is based on
IIOP (GIOP 1.2) and the CSIv2 CORBA Secure Interoperability specification. The EJB interoperability protocol is defined in the EJB specification.
CORBA Interoperable Naming Service protocolThe COSNaming-based
INS protocol is an IIOP-based protocol for accessing a name service. The EJB
193
194
interoperability protocol requires the use of the INS protocol for lookup of EJB
objects using the JNDI API. In addition, it must be possible to use the Java IDL
COSNaming API to access the INS name service. All Java EE products must
provide a name service that meets the requirements of the Interoperable Naming Service specification, available at http://omg.org/cgi-bin/doc?formal/
2000-06-19. This name service may be provided as a separate name server or
as a protocol bridge or gateway to another name service. Either approach is
consistent with this specification.
EE.7.2.3
This specification requires the Java EE platform to support the JRMP protocol,
which is the Java technology-specific Remote Method Invocation (RMI) protocol.
JRMP is a required component of Java SE and is one of two required RMI
protocols. (IIOP is the other required RMI protocol, see above.)
JRMP is a distributed object model for the Java programming language.
Distributed systems, running in different address spaces and often on different
hosts, must be able to communicate with each other. JRMP permits program-level
objects in different address spaces to invoke remote objects using the semantics of
the Java programming language object model.
Complete information on the JRMP specification can be found at http://
docs.oracle.com/javase/7/docs/technotes/guides/rmi.
EE.7.2.4
Data Formats
Early Draft
INTEROPERABILITYPROTOCOLS
Image file formatsThe Java EE platform must support GIF, JPEG, and PNG
images. Support for these formats is provided by the java.awt.image APIs
(see the URL: http://docs.oracle.com/javase/7/docs/api/java/awt/
image/package-summary.html) and by Java EE web clients.
JAR filesJAR (Java Archive) files are the standard packaging format for
Java technology-based application components, including the ejb-jar specialized format, the Web application archive (WAR) format, the Resource Adapter archive (RAR), and the Java EE enterprise application archive (EAR)
format. JAR is a platform-independent file format that permits many files to
be aggregated into one file. This allows multiple Java components to be bundled into one JAR file and downloaded to a browser in a single HTTP transaction. JAR file formats are supported by the java.util.jar and
java.util.zip packages. For complete information on the JAR specification,
see http://docs.oracle.com/javase/7/docs/technotes/guides/jar.
Class file formatThe class file format is specified in the Java Virtual Machine specification. Each class file contains one Java programming language
typeeither a class or an interfaceand consists of a stream of 8-bit bytes. For
complete information on the class file format, see http://docs.oracle.com/
javase/specs/.
195
196
Early Draft
C H A P T E R
EE.8
for assembling, packaging, and deploying a Java EE application. The main goal of
these requirements is to provide scalable and modular application assembly, and
portable deployment of Java EE applications into any Java EE product.
Java EE applications are composed of one or more Java EE components and
an optional Java EE application deployment descriptor. The deployment
descriptor, if present, lists the applications components as modules. If the
deployment descriptor is not present, the applications modules are discovered
using default naming rules. A Java EE module represents the basic unit of
composition of a Java EE application. Java EE modules consist of one or more
Java EE components and an optional module level deployment descriptor. The
flexibility and extensibility of the Java EE component model facilitates the
packaging and deployment of Java EE components as individual components,
component libraries, or Java EE applications.
A full Java EE product must support all the facilities described in this chapter.
A Java EE profile may support only a subset of the Java EE module types. Any
requirements related to a module type not supported by a product based on a
particular Java EE profile should be understood to not apply to such a product.
Figure EE.8-1 shows the composition model for Java EE deployment units
and includes the optional use of alternate deployment descriptors by the
application package to preserve any digital signatures of the original Java EE
modules. An alternate deployment descriptor may also be provided external to the
application package as described in Section EE.8.4.1, Assembling a Java EE
Application.
197
198
Components
Java EE
Modules
EJB
Java EE Application
EJB
module
EJB
EJB
WEB
Web app
module
2
WEB
APP
DD
DD
DD
DD
DD
Deployment
Tool
DD
application
client
module
DD
DD
DD
DD
Resource
Adapter
module
DD
4
4
4
DD
DD
add/delete ingredients
deploy standalone modules
Figure EE.8-1
EE.8.1
Java EE Deployment
The development life cycle of a Java EE application begins with the creation of
discrete Java EE components. These components may then be packaged with a
module level deployment descriptor to create a Java EE module. Java EE modules
can be deployed as stand-alone units or can be assembled with a Java EE application
deployment descriptor and deployed as a Java EE application.
Figure EE.8-2 shows the life cycle of a Java EE application.
Early Draft
Creation
Created by
Component
Provider
Assembly
Assembled and
Java EE Module Augmented by
Application
Assembler
Deployment
Java EE APP
Processed by
Deployer
deploy
Java EE Container/Server
Enterprise
Components
Figure EE.8-2
EE.8.1.1
Component Creation
The EJB, servlet, application client, and Connector specifications include the XML
Schema definition of the associated module level deployment descriptors and
component packaging architecture required to produce Java EE modules. (The
application client specification is found in Chapter EE.10 of this document.)
A Java EE module is a collection of one or more Java EE components (web,
EJB, application client, or Connector) with an optional module deployment
descriptor of that type. Any number of components of the same container type can
be packaged together with a single Java EE deployment descriptor appropriate to
that container type to produce a Java EE module. Components of different
container types may not be mixed in a single Java EE module, except for the
packaging of EJB components within a web module.
A Java EE module represents the basic unit of composition of a Java EE application. In some cases a single Java EE module (not necessarily packaged into
a Java EE application package) will contain an entire application. In other cases an application will be composed of multiple Java EE modules.
The deployment descriptor for a Java EE module contains declarative data required to deploy the components in the module. The deployment descriptor
199
200
for a Java EE module also contains assembly instructions that describe how
the components are composed into an application.
Starting with version 5 of the Java EE platform, a web application module, an
enterprise bean module, or an application client module need not contain a deployment descriptor. Instead, the deployment information may be specified by
annotations present in the class files of the module.
Starting with version 5 of the Java EE platform, a Java EE enterprise application archive need not contain a deployment descriptor. Instead, the deployment information may be determined using default naming rules for
embedded modules.
An individual Java EE module can be deployed as a stand-alone Java EE
module without an application level deployment descriptor and represents a
valid Java EE application.
Java EE modules may express dependencies on libraries as described below in
Section EE.8.2, Library Support.
All Java EE modules have a name. The name can be explicitly set in the
deployment descriptor for the module. If not set, the name of the module is the
pathname of the module in the ear file with any filename extension (.jar, .war, .rar)
removed, but with any directory names included. The name of a module must be
unique within an application. If and only if the name is not unique (e.g., because
two names are identical after removing different filename extensions) the
deployment tool may choose new unique names for any of the conflicting
modules; module names that do not conflict must not be changed. The algorithm
for choosing unique names in such a case is product specific. Applications that
depend on the names of their modules must ensure that their module names are
unique.
For example, an application with this structure:
myapp.ear
inventory.jar
ui.war
has a default application name of "myapp", and defines two modules with
default names "inventory" and "ui".
An application with this structure:
bigapp.ear
Early Draft
ejbs
inventory.jar
accounts.jar
ui
store.war
admin.war
has a default application name of "bigapp", and defines four modules with
default names "ejbs/inventory", "ejbs/accounts", "ui/store", and "ui/admin".
EE.8.1.2
Application Assembly
A Java EE application may consist of one or more Java EE modules and one Java
EE application deployment descriptor. A Java EE application is packaged using the
Java Archive (JAR) file format into a file with a .ear (Enterprise ARchive)
filename extension. A minimal Java EE application package will only contain Java
EE modules and, optionally, the application deployment descriptor. A Java EE
application package may also include libraries referenced by Java EE modules
(using the Class-Path mechanism described below in Section EE.8.2, Library
Support), help files, and documentation to aid the deployer.
The deployment of a portable Java EE application should not depend on any
entities that may be contained in the package other than those defined by this
specification. Deployment of a portable Java EE application must be possible
using only the application deployment descriptor, if any, and the Java EE modules
(and their dependent libraries) and descriptors listed in it.
The Java EE application deployment descriptor represents the top level view
of a Java EE applications contents. The Java EE application deployment
descriptor is specified by an XML schema or document type definition (see
Section EE.8.6, Java EE Application XML Schema).
In certain cases, a Java EE application will need customization before it can
be deployed into the enterprise. In the case of an application intended for use by
multiple tenants, such customization should be anticipated. New Java EE modules
may be added to the application. Existing modules may be removed from the
application. Some Java EE modules may need custom content created, changed,
or replaced. For example, an application consumer may need to use an HTML
editor to add company graphics to a template login page that was provided with a
Java EE web application.
All Java EE applications have a name. The name can be explicitly set in the
application deployment descriptor. If not set, the name of the application is the
201
202
base name of the ear file with any .ear extension removed and with any directory
names removed. The name of an application must be unique in an application
server instance. If an attempt is made to deploy an application with a name that
conflicts with an already deployed application, the deployment tool may choose a
new unique name for the application. The deployment tool may also allow a
different name to be specified at deployment time. A deployment tool may use
product-specific means to decide whether a deployment operation is a deployment
of a new application, in which case the name must be unique, or a redeployment
of an existing application, in which case the name may match the existing
application.
Similarly, when a stand-alone module is deployed, the module name is used
as the application name, and obeys the same rules as described above for
application names. The module name can be explicitly set in the module
deployment descriptor. If not set, the name of the module is the base name of the
module file with any extension (.war, .jar, .rar) removed and with any directory
names removed.
EE.8.1.3
Deployment
EE.8.2
Library Support
The Java EE platform provides several mechanisms for applications to use optional
packages and shared libraries (hereafter referred to as libraries). Libraries may be
bundled with an application or may be installed separately for use by any
application.
Java EE products are required to support the use of bundled and installed
libraries as specified in the Extension Mechanism Architecture and Optional
Early Draft
LIBRARYSUPPORT
Bundled Libraries
(See the JAR File Specification for important details and limitations of the
syntax of Class-Path headers.) The Java EE deployment tools must process
all such referenced files and directories when processing a Java EE module.
Any deployment descriptors in referenced .jar files must be ignored when
processing the referencing .jar file. The deployment tool must install the
.jar files and directories in a way that preserves the relative references
between the files. Typically this is done by installing the .jar files into a
directory hierarchy that matches the original application directory hierarchy.
All referenced .jar files or directories must appear in the logical class path of
the referencing JAR files at runtime.
Only JAR format files or directories containing class files or resources to be
loaded directly by a standard class loader should be the target of a Class-Path
reference; such files are always named with a .jar extension. Top level JAR
files that are processed by a deployment tool should not contain Class-Path
entries; such entries would, by definition, reference other files external to the
deployment unit. A deployment tool is not required to process such external
references.
203
204
2. A .ear file may contain a directory that contains libraries packaged in JAR
files. The library-directory element of the .ear files deployment descriptor
contains the name of this directory. If a library-directory element isnt specified, or if the .ear file does not contain a deployment descriptor, the directory
named lib is used. An empty library-directory element may be used to
specify that there is no library directory.
All files in this directory (but not subdirectories) with a .jar extension must
be made available to all components packaged in the EAR file, including
application clients. These libraries may reference other libraries, either bundled with the application or installed separately, using any of the techniques
described herein.
3. A web application may include libraries in the WEB-INF/lib directory. See the
Servlet specification for details. These libraries may reference other libraries,
either bundled with the application or installed separately, using any of the
techniques described herein.
EE.8.2.2
Installed Libraries
Libraries that have been installed separately may be referenced in the following
way:
1. JAR format files of all types may contain an Extension-List attribute in their
Manifest file, indicating a dependency on an installed library. The JAR File
Specification defines the semantics of such attributes for use by applets; this
specification requires support for such attributes for all component types and
corresponding JAR format files. The deployment tool is required to check such
dependency information and reject the deployment of any component for
which the dependency can not be met. Portable applications should not assume
that any installed libraries will be available to a component unless the components JAR format file, or one of the containing JAR format files, expresses a
dependency on the library using the Extension-List and related attributes.
The referenced libraries must be made available to all components contained
within the referencing file, including any components contained within other
JAR format files within the referencing file. For example, if a .ear file references an installed library, the library must be made available to all components in all .war files, EJB .jar files, application .jar files, and resource
adapter .rar files within the .ear file.
Early Draft
LIBRARYSUPPORT
Library Conflicts
If an application includes a bundled version of a library, and the same library exists
as an installed library, the instance of the library bundled with the application should
be used in preference to any installed version of the library. This allows an
application to bundle exactly the version of a library it requires without being
influenced by any installed libraries. Note that if the library is also a required
component of the Java EE platform version on which the application is being
deployed, the platform version may (and typically will) take precedence.
EE.8.2.4
Library Resources
Libraries that dynamically load classes must consider the class loading environment
of a Java EE application. Libraries will often be loaded by a class loader that is a
parent class loader of the class loader that is used to load application classes. A
library that only needs to dynamically load classes provided by the library itself can
safely use the Class method forName. However, libraries that need to dynamically
205
206
load classes that have been provided as a part of the application need to use the
context class loader to load the classes. Access to the context class loader requires
RuntimePermission(getClassLoader), which is not normally granted to
applications, but should be granted to libraries that need to dynamically load classes.
Libraries can use a method such as the following to assert their privilege when
accessing the context class loader. This technique will work in both Java SE and
Java EE.
public ClassLoader getContextClassLoader() {
return AccessController.doPrivileged(
new PrivilegedAction<ClassLoader>() {
public ClassLoader run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().
getContextClassLoader();
} catch (SecurityException ex) { }
return cl;
}
});
}
EE.8.2.6
Examples
The following example illustrates a simple use of the bundled library mechanism to
reference a library of utility classes that are shared between enterprise beans in two
separate ejb-jar files.
app1.ear:
Early Draft
LIBRARYSUPPORT
META-INF/application.xml
ejb1.jar
Class-Path: util.jar
ejb2.jar
Class-Path: util.jar
util.jar
207
208
META-INF/application.xml
ejb1.jar:
META-INF/MANIFEST.MF:
Extension-List: util
util-Extension-Name: com/example/util
util-Specification-Version: 1.4
META-INF/ejb-jar.xml
util.jar:
META-INF/MANIFEST.MF:
Extension-Name: com/example/util
Specification-Title: example.coms util package
Specification-Version: 1.4
Specification-Vendor: example.com
Implementation-Version: build96
EE.8.3
The Java EE specification purposely does not define the exact types and
arrangements of class loaders that must be used by a Java EE product. Instead, the
specification defines requirements in terms of what classes must or must not be
visible to components. A Java EE product is free to use whatever class loaders it
chooses to meet these requirements. Portable applications must not depend on the
types of class loaders used or the hierarchical arrangement of class loaders, if any.
Portable applications must not depend on the order in which classes and resources
are loaded. Applications should use the techniques described in Section EE.8.2.5,
Dynamic Class Loading if they need to load classes dynamically.
In addition to the required classes specified below, a Java EE product must
provide a way to allow an application to access a class library installed in the
application server, even if it has not expressed a dependency on that library. This
supports the use of old applications and extension libraries that do not use the
defined extension dependency mechanism.
The following sections describe the requirements for each container type. In
all cases, access to classes is governed by the rules of the Java language and the
Java virtual machine. In all cases, access to classes and resources is governed by
the rules of the Java security model.
Early Draft
EE.8.3.1
Components in the web container must have access to the following classes
and resources. Note that as of Java EE 6, EJB components may be packaged in a
web component module. Such EJB components have the same access as other
components in the web container. See the EJB specification for further detail.
The content of the WEB-INF/classes directory of the containing war file.
The content of all jar files in the WEB-INF/lib directory of the containing war
file, but not any subdirectories.
The transitive closure of any libraries referenced by the above jar files (as
specified in Section EE.8.2, Library Support).
The transitive closure of any libraries referenced by the war file itself (as
specified in Section EE.8.2, Library Support).
The transitive closure of any libraries specified by or referenced by the containing ear file (as specified in Section EE.8.2, Library Support).
The contents of all jar files included in any resource adapter archives (rar
files) included in the same ear file.
The contents of all jar files included in each resource adapter archive (rar file)
deployed separately to the application server, if that resource adapter is used
to satisfy any resource references in the module.
The contents of all jar files included in each resource adapter archive (rar file)
deployed separately to the application server, if any jar file in that rar file is
used to satisfy any reference from the module using the Extension Mechanism
Architecture (as specified in Section EE.8.2, Library Support).
The transitive closure of any libraries referenced by the jar files in the rar files
above (as specified in Section EE.8.2, Library Support).
The transitive closure of any libraries referenced by the rar files themselves
(as specified in Section EE.8.2, Library Support).
The Java EE API classes specified in Table EE.6-1 for the web container.
All Java SE 7 API classes.
Components in the web container may have access to the following classes
and resources. Portable applications must not depend on having or not having
access to these classes or resources.
209
210
The classes and resources accessible to any other web modules included in the
same ear file, as described above.
The content of any EJB jar files included in the same ear file.
The content of any client jar files specified by the above EJB jar files.
The transitive closure of any libraries referenced by the above EJB jar files
and client jar files (as specified in Section EE.8.2, Library Support).
The contents of any jar files included in any resource adapter archives (rar
files) deployed separately to the application server.
The transitive closure of any libraries referenced by the jar files in the rar files
above (as specified in Section EE.8.2, Library Support).
The transitive closure of any libraries referenced by the rar files above themselves (as specified in Section EE.8.2, Library Support).
The Java EE API classes specified in Table EE.6-1 for the containers other
than the web container.
Any installed libraries available in the application server.
Other classes or resources contained in the application package, and specified
by an explicit use of an extension not defined by this specification.
Other classes and resources that are part of the implementation of the application server.
Components in the web container must not have access to the following
classes and resources, unless such classes or resources are covered by one of the
rules above.
Other classes or resources in the application package. For example, the application should not have access to the classes in application client jar files.
EE.8.3.2
Components in the EJB container must have access to the following classes and
resources.
The content of the EJB jar file.
The transitive closure of any libraries referenced by the EJB jar file (as specified in Section EE.8.2, Library Support).
Early Draft
The transitive closure of any libraries specified by or referenced by the containing ear file (as specified in Section EE.8.2, Library Support).
The contents of all jar files included in any resource adapter archives (rar
files) included in the same ear file.
The contents of all jar files included in each resource adapter archive (rar file)
deployed separately to the application server, if that resource adapter is used
to satisfy any resource references in the module.
The contents of all jar files included in each resource adapter archive (rar file)
deployed separately to the application server, if any jar file in that rar file is
used to satisfy any reference from the module using the Extension Mechanism
Architecture (as specified in Section EE.8.2, Library Support).
The transitive closure of any libraries referenced by the jar files in the rar files
above (as specified in Section EE.8.2, Library Support.
The transitive closure of any libraries referenced by the rar files themselves
(as specified in Section EE.8.2, Library Support).
The Java EE API classes specified in Table EE.6-1 for the EJB container.
All Java SE 7 API classes.
Components in the EJB container may have access to the following classes
and resources. Portable applications must not depend on having or not having
access to these classes or resources.
The classes and resources accessible to any web modules included in the same
ear file, as described in Section EE.8.3.1, Web Container Class Loading Requirements above.
The content of any EJB jar files included in the same ear file.
The content of any client jar files specified by the above EJB jar files.
The transitive closure of any libraries referenced by the above EJB jar files
and client jar files (as specified in Section EE.8.2, Library Support).
The contents of any jar files included in any resource adapter archives (rar
files) deployed separately to the application server.
The transitive closure of any libraries referenced by the jar files in the rar files
above (as specified in Section EE.8.2, Library Support).
The transitive closure of any libraries referenced by the rar files above themselves (as specified in Section EE.8.2, Library Support).
211
212
The Java EE API classes specified in Table EE.6-1 for the containers other
than the EJB container.
Any installed libraries available in the application server.
Other classes or resources contained in the application package, and specified
by an explicit use of an extension not defined by this specification.
Other classes and resources that are part of the implementation of the application server.
Components in the EJB container must not have access to the following
classes and resources, unless such classes or resources are covered by one of the
rules above.
Other classes or resources in the application package. For example, the application should not have access to the classes in application client jar files.
EE.8.3.3
Components in the application client container must have access to the following
classes and resources.
The content of the application client jar file.
The transitive closure of any libraries referenced by the above jar file (as
specified in Section EE.8.2, Library Support).
The transitive closure of any libraries specified by or referenced by the containing ear file (as specified in Section EE.8.2, Library Support).
The Java EE API classes specified in Table EE.6-1 for the application client
container.
All Java SE 7 API classes.
Components in the application client container may have access to the
following classes and resources. Portable applications must not depend on having
or not having access to these classes or resources.
The Java EE API classes specified in Table EE.6-1 for the containers other than
the application client container.
Any installed libraries available in the application server.
Early Draft
APPLICATIONASSEMBLY
The requirements for the applet container are completely specified by the Java SE 7
specification. This specification adds no new requirements for the applet container.
EE.8.4
Application Assembly
This section specifies the sequence of steps that are typically followed when
composing a Java EE application.
EE.8.4.1
213
214
Early Draft
APPLICATIONASSEMBLY
there is only one web module in the Java EE application, the context root
may be the empty string. If no deployment descriptor is included in the
application package, the context root of the web module will be the module
name. See the Servlet specification for detailed requirements of context
root naming.
e. Make sure that each component in the application properly describes any
dependencies it may have on other components in the application. A Java
EE application should not assume that all components in the application
will be available on the class path of the application at run time. Each
component might be loaded into a separate class loader with a separate
namespace. If the classes in a JAR file depend on classes in another JAR
file, the first JAR file should reference the second JAR file using the ClassPath mechanism. A notable exception to this rule is JAR files located in the
WEB-INF/lib directory of a web application. All such JAR files are
included in the class path of the web application at runtime; explicit
references to them using the Class-Path mechanism are not needed.
Another exception to this rule is JAR files located in the library directory
(usually named lib) in the application package. Note that the presence of
component-declaring annotations in shared artifacts, such as libraries in the
library directory and libraries referenced by more than one module through
Class-Path references, can have unintended and undesirable consequences
and is not recommended.
f. There must be only one version of each class in an application. If one
component depends on one version of a library, and another component
depends on another version, it may not be possible to deploy an application
containing both components. With the exception of application clients, a
Java EE application should not assume that each component is loaded in a
separate class loader and has a separate namespace. All components in a
single application may be loaded in a single class loader and share a single
namespace. Note, however, that it must be possible to deploy an
application such that all components of the application are in a namespace
(or namespaces) separate from that of other applications. Typically, this
will be the normal method of deployment. By default, application clients
are each deployed into their own Java virtual machine instance, and thus
each application client has its own class namespace, and the classes from
application clients are not visible in the class namespace of other
components.
215
216
After the application is created, Java EE modules may be added or removed before
deployment. When adding or removing a module the following steps must be
performed:
1. Decide on a location in the application package for the new module. Optionally
create new directories in the application package hierarchy to contain any Java
EE modules that are being added to the application.
2. Ensure that the name of the new module does not conflict with any of the existing modules, either by choosing an appropriate default filename for the module or by explicitly specifying the module name in the modules deployment
descriptor or in an alternate deployment descriptor.
3. Copy the new Java EE modules to the desired location in the application package. The packaged modules are inserted directly in the desired location; the
modules are not unpackaged.
Early Draft
DEPLOYMENT
4. Edit the deployment descriptors for the Java EE modules to link the dependencies which are internally satisfied by the Java EE modules included in the application.
5. Edit the Java EE application deployment descriptor (if included) to meet the
content requirements of the Java EE platform and the validity requirements of
the Java EE:application XML DTD or schema.
EE.8.5
Deployment
217
218
Early Draft
DEPLOYMENT
EE.8.5.1
This section specifies the requirements for deploying a stand-alone Java EE module.
1. The deployment tool must first read the Java EE module deployment descriptor
if provided externally to the package or if present in the package. See the component specifications for the required location and name of the deployment descriptor for each component type.
2. If the deployment descriptor is absent, or is present and is a Java EE 5 version
descriptor and the metadata-complete attribute is not set to true, the deployment tool must examine all the class files in the application package. Any annotations that specify deployment information must be logically merged with
the information in the deployment descriptor (if present). The correspondence
of annotation information with deployment descriptor information, as well as
the overriding rules, are described in this and other Java EE specifications. The
result of this logical merge process provides the deployment information used
in subsequent deployment steps. Note that there is no requirement for the
merge process to produce a new deployment descriptor, although that might be
a common implementation technique.
3. When deploying a standalone module, the module name is used as the application name. The deployment tool must ensure that the application name is
unique in the application server instance. If the name is not unique, the deployment tool may automatically choose a unique name or allow the Deployer to
choose a unique name, but must not fail the deployment. This ensures that existing modules continue to be deployable.
4. The deployment tool must deploy all of the components listed in the Java EE
219
220
Early Draft
DEPLOYMENT
d. For all files in the application package with a filename extension of .jar,
but not contained in the lib directory, do the following:
i. If the JAR file contains a META-INF/MANIFEST.MF file with a MainClass attribute, or contains a META-INF/application-client.xml file,
consider the JAR file to be an application client module.
ii. If the JAR file contains a META-INF/ejb-jar.xml file, or contains any
class with an EJB component annotation (Stateless, etc.), consider the
JAR file to be an EJB module.
iii. All other JAR files are ignored unless referenced by a JAR file
discovered above using one of the JAR file reference mechanisms such
as the Class-Path header in a manifest file.
2. The deployment tool must ensure that the application name is unique in the application server instance. If the name is not unique, the deployment tool may
automatically choose a unique name or allow the Deployer to choose a unique
name, but must not fail the deployment. This ensures that existing applications
continue to be deployable.
3. The deployment tool must open each of the Java EE modules listed in the Java
EE application deployment descriptor or discovered using the rules above and
read the Java EE module deployment descriptor, if present in the package. See
the Enterprise JavaBeans, servlet, Java EE Connector and application client
specifications for the required location and name of the deployment descriptor
for each component type. Deployment descriptors are optional for all module
types. (The application client specification is Chapter EE.10, Application Clients.)
4. If the module deployment descriptor is absent, or is present and is a Java EE 5
or later version descriptor and the metadata-complete attribute is not set to
true, the deployment tool must examine all the class files in the application
package that can be used by the module (that is, all class files that are included
in the .ear file and can be referenced by the module, such as the class files included in the module itself, class files referenced from the module by use of a
Class-Path reference, class files included in the library directory, etc.). Any
annotations that specify deployment information must be logically merged
with the information in the deployment descriptor (if present). Note that the
presence of component-declaring annotations in shared artifacts, such as libraries in the library directory and libraries referenced by more than one mod-
221
222
Deploying a Library
Early Draft
DEPLOYMENT
1. The deployment tool must record the extension name and version information
from the manifest file of the library JAR file. The deployment tool must make
the library available to other Java EE deployment units that request it according to the version matching rules described in the Optional Package Versioning specification. Note that the library itself may include dependencies on
other libraries and these dependencies must also be satisfied.
2. The deployment tool must make the library available with at least the same security permissions as any application or module that uses it. The library may
be installed with the full security permissions of the container.
3. Not all libraries will be deployable on all Java EE products at all times. Libraries that conflict with the operation of the Java EE product may not be deployable. For example, an attempt to deploy an older version of a library that has
subsequently been included in the Java EE platform specification may be rejected. Similarly, deployment of a library that is also used in the implementation of the Java EE product may be rejected. Deployment of a library that is in
active use by an application may be rejected.
EE.8.5.4
Module Initialization
223
224
EE.8.6
EE.8.7
The XML Schema located at TBD defines types that are used by many other Java
EE deployment descriptor schemas, both in this specification and in other
specifications.
Early Draft
C H A P T E R
EE.9
Profiles
This chapter describes the requirements common to all Java EE profiles. It does
not define any concrete profiles, delegating this task to separate specifications.
The Java EE Web Profile Specification, published in conjunction with the
present specification, defines the first Java EE profile, the Web Profile.
The definition of other profiles is left to future specifications.
EE.9.1
Introduction
225
226
EE.9.2
Profile Definition
A profile is defined in accordance with the rules of the Java Community Process.
Typically, a proposal to create a new profile, or to revise an existing one, will be
submitted as a Java Specification Request (JSR). Once the JSR is approved, an
expert group will be formed and conduct work as dictated by the process. The JSR
for a profile must mention the version of the Java EE Platform that it builds on.
Additionally, if it builds on an existing profile, it must mention this fact as well.
Although profiles can be created and evolved independently of the Java EE
platform, modulo the rules contained in this specification, it is envisioned that
profiles will maintain a reasonable level of alignment with the platform itself, in
order to avoid fragmenting the development space into progressively
incompatible islands. To this end, a profile must build on the most recent version
of the Java EE platform available at the time the JSR for the profile is approved. It
is also recommended that profile expert groups go beyond this requirement and,
as much as it is practical, ensure that their profile builds on the most recent
version of the Java EE platform at the time the profile is finalized.
EE.9.3
A profile must include all technologies that are required components of the Java EE
platform or of any profiles on which it builds. These technologies will be listed as
required in the profile.
A profile may promote to required status any technologies that are optional
components of the Java EE platform or of any profile on which it builds.
Unless otherwise mandated by a profile, any technologies that are optional
components of the Java EE platform, or of any profile on which the profile in
question builds, must be optional components of the profile itself.
A profile may include as a required or as an optional component any
technology outside of those included in the Java EE platform or any profile on
which it builds, as long as the corresponding compatibility requirements are
satisfied.
A profile must preserve any requirements defined in the Java EE platform
specification, or in the specification of any profile on which it builds, as long as
the preconditions for those requirements are satisfied. Typically, the preconditions
will involve the presence of one or more technologies among those included in the
profile. Unconditional requirements must be obeyed unconditionally.
Early Draft
EXPRESSION OF REQUIREMENTS
A profile may add any requirements that pertain to one or more technologies
whose inclusion it allows or requires. Such requirements must not conflict with
those set by the Java EE platform or by any profile on which the present one
builds.
The specification for individual technologies may allow for certain features of
the technology in question to be optional. In this case, a profile may promote one
or more of these features to required status, assuming the Java EE platform or any
profile on which it builds hasnt done so already.
A profile must not conflict with the specifications for any technologies it
includes either as required or optional components. Therefore, unless the
specification for an individual technology explicitly allows for certain features or
sets of requirements to be optionally implementable, a profile must not itself
attempt to redefine any such features or requirements. For example, a profile may
not allow omitting a package or type or method from an API specified elsewhere,
unless the specification for that API explicitly allows for this to happen.
Although this specification does not define any APIs, a profile may do so.
Since such an API would be available only in profiles that build on the one that
defines it, this approach limits the reusability of the API and thus is discouraged.
EE.9.4
Expression of Requirements
EE.9.5
The Java Platform, Standard Edition 7 is the required foundation for any Java EE 7
profile.
227
228
EE.9.6
All the technologies listed in Section EE.6.1, Required APIs, and not designated
as required in Section EE.9.5, Requirements for All Java EE Profiles, are
designated as optional for use in Java EE profiles.
The following functionality is designated as optional for use in Java EE profiles:
RMI/IIOP interoperability requirements (see Section EE.7.2.2, OMG Protocols)
Support for java:comp/ORB (see Section EE.5.12, ORB References)
EE.9.7
This section defines the requirements for full Java EE platform products. These
requirements correspond to the full set of requirements in previous versions of the
Java EE platform specification and update those requirements for this new version
of the platform.
Please note that, due to the effects of the pruning process, future versions of
the Java EE specification will likely relax the requirements given here,
specifically by marking as optional technologies that have been subject to pruning
and that are required by the present specification. The set of technologies that
have been made optional and/or identified as candidates for pruning is given in
Section EE.6.1.3, Pruned Java Technologies.
The following technologies are required:
EJB 3.2 (except for EJB entity beans and associated EJB QL, which have been
made optional)
Servlet 3.1
Early Draft
JSP 2.2
EL 3.0
JMS 2.0
JTA 1.2
JavaMail 1.4
Connector 1.6
Web Services 1.3
JAX-WS 2.2
JAX-RS 2.0
JAXB 2.2
Java EE Management 1.1
JACC 1.4
JASPIC 1.0
JSP Debugging 1.0
JSTL 1.2
Web Services Metadata 2.1
JSF 2.2
Common Annotations 1.1
Java Persistence 2.1
Bean Validation 1.1
Managed Beans 1.0
Contexts and Dependency Injection for Java EE 1.1
Dependency Injection for Java 1.0
229
230
Early Draft
C H A P T E R
EE.10
Application Clients
This chapter describes application clients in the Java Platform, Enterprise
EE.10.1
Overview
Application clients are first tier client programs that execute in their own Java
virtual machines. Application clients follow the model for Java technology-based
applications: they are invoked at their main method and run until the virtual machine
is terminated. However, like other Java EE application components, application
clients depend on a container to provide system services. The application client
container may be very light-weight compared to other Java EE containers, providing
only the security and deployment services described below
EE.10.2
Security
The Java EE authentication requirements for application clients are the same as for
other Java EE components, and the same authentication techniques may be used as
for other Java EE application components.
No authentication is necessary when accessing unprotected web resources.
When accessing protected web resources, the usual varieties of authentication
may be used, namely HTTP Basic authentication, SSL client authentication, or
HTTP Login Form authentication. Lazy authentication may be used.
231
232
EE.10.3
Transactions
Application clients are not required to have direct access to the transaction facilities
of the Java EE platform. A Java EE product is not required to provide a JTA
UserTransaction object for use by application clients. Application clients can
Early Draft
invoke enterprise beans that start transactions, and they can use the transaction
facilities of the JDBC API. If a JDBC API transaction is open when an application
client invokes an enterprise bean, the transaction context is not required to be
propagated to the EJB server.
EE.10.4
As with all Java EE components, application clients use JNDI to look up enterprise
beans, get access to resource managers, reference configurable parameters set at
deployment time, and so on. Application clients use the java: JNDI namespace to
access these items (see Chapter EE.5, Resources, Naming, and Injection for
details).
Injection is also supported for the application client main class. Because the
application client container does not create instances of the application client main
class, but merely loads the class and invokes the static main method, injection into
the application client class uses static fields and methods, unlike other Java EE
components. Injection occurs before the main method is called.
EE.10.5
Application clients have all the facilities of the JavaTM Platform, Standard Edition
(subject to security restrictions), as well as various standard extensions, as described
in Chapter EE.6 Application Programming Interface. Each application client
executes in its own Java virtual machine. Application clients start execution at the
main method of the class specified in the Main-Class attribute in the manifest file of
the application clients JAR file (although note that application client container code
will typically execute before the application client itself, in order to prepare the
environment of the container, install a SecurityManager, initialize the name service
client library, and so on).
EE.10.6
Application clients are packaged in JAR format files with a .jar extension and may
include a deployment descriptor similar to other Java EE application components.
The deployment descriptor describes the enterprise beans, web services, and other
types of external resources referenced by the application. If the deployment
233
234
Deployment descriptor
metadata-complete?
process annotations?
application-client_1_2
N/A
No
application-client_1_3
N/A
No
application-client_1_4
N/A
No
application-client_5
Yes
No
application-client_5
No
Yes
application-client_6
No
Yes
application-client_7
No
Yes
none
N/A
Yes
The tool used to deploy an application client to the client machine, and the
mechanism used to install the application client, is not specified. Very
sophisticated Java EE products may allow the application client to be deployed on
a Java EE server and automatically made available to some set of (usually
intranet) clients. Other Java EE products may require the Java EE application
bundle containing the application client to be manually deployed and installed on
each client machine. And yet another approach would be for the deployment tool
on the Java EE server to produce an installation package that could be used by
each client to install the application client. There are many possibilities here and
this specification doesnt prescribe any one. It only defines the package format for
the application client and the things that must be possible during the deployment
process.
How an application client is invoked by an end user is unspecified. Typically
a Java EE Product Provider will provide an application launcher that integrates
Early Draft
with the application client machines native operating system, but the level of
such integration is unspecified.
EE.10.7
235
236
module-name?
description*
small-icon?
large-icon?
display-name+
description*
icon*
env-entry-name
env-entry*
env-entry-value?
env-entry-type?
mapped-name?
injection-target-class
injection-target*
injection-target-name
lookup-name?
description*
ejb-ref*
ejb-ref-name
ejb-ref-type?
service-ref*
home?
remote?
description*
ejb-link?
res-ref-name
mapped-name?
res-type?
resource-ref*
injection-target-class
injection-target*
res-auth?
injection-target-name
lookup-name?
res-sharing-scope?
mapped-name?
injection-target*
application-client
injection-target-class
injection-target-name
lookup-name?
description*
resource-env-ref-name
resource-env-ref*
resource-env-ref-type?
description*
mapped-name?
message-destination-ref-name
injection-target*
message-destination-type?
lookup-name?
injection-target-class
injection-target-name
message-destination-usage?
message-destination-ref*
message-destination-link?
mapped-name?
injection-target-class
injection-target*
injection-target-name
lookup-name?
description*
persistence-unit-ref-name
persistence-unit-ref*
post-construct*
persistence-unit-name?
lifecycle-callback-class?
mapped-name?
lifecycle-callback-method
injection-target*
injection-target-class
injection-target-name
pre-destroy*
lifecycle-callback-class?
lifecycle-callback-method
callback-handler?
description*
display-name+
message-destination*
data-source*
Figure EE.10-1
Early Draft
icon*
message-destination-name
C H A P T E R
EE.11
that are primarily intended to be used to extend the capabilities of the Java EE
containers. In addition, some Java EE technologies include service provider
interfaces along with their application programming interfaces. A Java EE profile
may include some or all of these facilities, as described in Chapter EE.9, Profiles.
EE.11.1
The Connector API defines how resource adapters are packaged and integrated with
any Java EE product. Many types of service providers can be provided using the
Connector API and packaging, including JDBC drivers, JMS providers, and JAXR
providers. All Java EE products must support the Connector APIs, as specified in
the Connector specification.
The Connector specification is available at http://jcp.org/en/jsr/
detail?id=322.
EE.11.2
The JACC specification defines the contract between a J2EE container and an
authorization policy provider.
The JACC specification is available at http://jcp.org/en/jsr/
detail?id=115.
237
238
EE.11.3
EE.11.4
Java Persistence
EE.11.5
EE.11.6
JavaMail
Early Draft
C H A P T E R
EE.12
EE.12.1
Compatibility
The word compatibility covers many different concepts. Java EE products are
compatible with the Java EE specification if they implement the APIs and behavior
required by the specification. Applications are compatible with a release of the Java
EE platform if they only depend on APIs and behavior defined by that release of the
platform. A new release of the Java EE platform is compatible with previous
releases of the platform if all portable applications written to the previous release of
the platform will also run unchanged and with identical behavior on the new release
of the platform.
Compatibility is a core value of the Java EE platform. A Java EE product is
required to support portable applications written to previous versions of the
platform. Compatibility and portability work together to provide the Write Once,
Run Anywhere value of the Java EE platform. Java EE products conform to the
Java EE specifications by providing APIs and behavior as required by the
specifications. Portable applications depend only on the APIs and behavior
required by the Java EE specifications. In general, portable applications written to
a previous version of the platform will continue to work without change and with
identical behavior on the current version of the platform.
239
240
EE.12.1.1
JavaServer Pages
EE.12.2
Migration
JavaServer Faces
JavaServer Faces can make it much easier to develop a web user interface for an
application. Applications using JavaServer Pages to provide a web user interface
may want to migrate to JavaServer Faces as a higher level component framework
for building such user interfaces.
Previous versions of the JavaServer Faces and JavaServer Pages
specifications defined APIs for using and controlling the expression language
support in those technologies. In this release those APIs have been deprecated and
are replaced by APIs in the javax.el package. Applications are strongly
encouraged to migrate to these new APIs. Note that the deprecated APIs continue
to work as they did in previous releases.
EE.12.2.2
Java Persistence
Java Persistence provides a much richer set of modeling capabilities and object/
relational mapping capabilities than EJB CMP entity beans, and is significantly
Early Draft
MIGRATION
easier to use. Applications that manage persistent data in a database should strongly
consider the use of Java Persistence in preference to either EJB CMP or the use of
JDBC with data access objects.
Support for EJB CMP and BMP entity beans has been made optional in this
release. Support for EJB CMP 1.1 entity beans has been deprecated since Java EE
5. Applications are strongly encouraged to migrate applications using EJB entity
beans to the Java Persistence API.
EE.12.2.3
JAX-WS
JAX-WS, along with JAXB and the Metadata for Web Services specification,
provides simpler and more complete support for web services than is available using
the JAX-RPC technology. Support for JAX-RPC has been made optional in this
release. Applications that provide web services using JAX-RPC should consider
migrating to the JAX-WS API. Note that because both technologies support the
same web service interoperability standards, clients and services can be migrated to
the new API independently.
EE.12.2.4
Annotations
241
242
Early Draft
C H A P T E R
EE.13
Future Directions
This version of the Java Platform, Enterprise Edition (Java EE) specification
EE.13.1
The Java Network Launch Protocol defines a mechanism for deploying Java
applications on a server and launching them from a client. A future version of this
specification may require that Java EE products be able to deploy application clients
in a way that allows them to be launched by a JNLP client, and that application
client containers be able to launch application clients deployed using the JNLP
technology. Java Web Start is the reference implementation of a JNLP client.
More information on JNLP is available at http://jcp.org/en/jsr/
detail?id=056; more information on Java Web Start is available at http://
www.oracle.com/technetwork/java/javase/javawebstart/index.html.
243
244
EE.13.2
Java EE SPI
Many of the APIs that make up the Java EE platform include an SPI layer that
allows service providers or other system level components to be plugged in. This
specification does not describe the execution environment for all such service
providers, nor the packaging and deployment requirements for all service providers.
However, the Java EE Connector Architecture does define the requirements for
certain types of service providers called resource adapters, and the Java
Authorization Contract for Containers defines requirements for security service
providers. Future versions of this specification will more fully define the Java EE
SPI.
Early Draft
A P P E N D I X
EE.A
EE.A.1
246
INF/application.xml in the .ear file. Note that this name is case-sensitive.Figure
Early Draft
247
Figure EE.A-1
248
application-name?
description*
display-name*
small-icon?
icon*
large-icon?
initialize-in-order?
web-uri
context-root
module+
alt-dd?
description*
security-role*
description*
role-name
env-entry-name
library-directory?
env-entry-type?
env-entry*
env-entry-value?
mapped-name?
injection-target*
lookup-name?
injection-target-class
injection-target-name
description*
ejb-ref*
ejb-ref-name
description*
ejb-local-ref*
ejb-ref-type?
ejb-ref-name
home?
ejb-ref-type?
remote?
local-home?
ejb-link?
local?
mapped-name?
ejb-link?
injection-target-class
injection-target*
injection-target-name
mapped-name?
application
injection-target-class
injection-target*
injection-target-name
lookup-name?
service-ref*
lookup-name?
description*
res-ref-name
res-type?
resource-ref*
res-auth?
description*
res-sharing-scope?
resource-env-ref-name
resource-env-ref*
mapped-name?
resource-env-ref-type?
injection-target-class
injection-target*
mapped-name?
injection-target-class
injection-target*
injection-target-name
lookup-name?
injection-target-name
lookup-name?
description*
message-destination-ref-name
message-destination-type?
message-destination-usage?
message-destination-ref*
message-destination-link?
description*
mapped-name?
persistence-unit-ref-name
persistence-unit-ref*
injection-target*
persistence-unit-name?
lookup-name?
injection-target-class
injection-target-name
mapped-name?
injection-target*
injection-target-class
injection-target-name
persistence-context-ref*
persistence-unit-name?
lifecycle-callback-class?
post-construct*
pre-destroy*
lifecycle-callback-class?
lifecycle-callback-method
callback-handler?
lifecycle-callback-method
description*
message-destination*
icon*
Early Draft
persistence-context-type?
persistence-property*
name
value
display-name+
data-source*
description*
persistence-context-ref-name
message-destination-name
249
application_6.xsd
EE.A.2
EE.A.3
250
Figure EE.A-2
module-name?
description*
small-icon?
large-icon?
display-name+
description*
icon*
env-entry-name
env-entry*
env-entry-value?
env-entry-type?
mapped-name?
injection-target-class
injection-target*
injection-target-name
lookup-name?
description*
ejb-ref*
ejb-ref-name
ejb-ref-type?
service-ref*
home?
remote?
description*
ejb-link?
res-ref-name
mapped-name?
res-type?
resource-ref*
injection-target-class
injection-target*
res-auth?
injection-target-name
lookup-name?
res-sharing-scope?
mapped-name?
injection-target*
application-client
injection-target-class
injection-target-name
lookup-name?
description*
resource-env-ref-name
resource-env-ref*
resource-env-ref-type?
description*
mapped-name?
message-destination-ref-name
injection-target*
message-destination-type?
lookup-name?
injection-target-class
injection-target-name
message-destination-usage?
message-destination-ref*
message-destination-link?
mapped-name?
injection-target-class
injection-target*
injection-target-name
lookup-name?
description*
persistence-unit-ref-name
persistence-unit-ref*
post-construct*
persistence-unit-name?
lifecycle-callback-class?
mapped-name?
lifecycle-callback-method
injection-target*
injection-target-class
injection-target-name
pre-destroy*
lifecycle-callback-class?
lifecycle-callback-method
callback-handler?
description*
display-name+
message-destination*
data-source*
Early Draft
icon*
message-destination-name
251
EE.A.4
web-uri
connector | ejb | java | web
module+
context-root
alt-dd?
description*
security-role*
role-name
library-directory?
Figure EE.A-3
application_5.xsd
252
EE.A.5
EE.A.6
Early Draft
253
description*
display-name+
small-icon?
large-icon?
description*
icon*
env-entry-name
env-entry*
env-entry-value?
env-entry-type?
mapped-name?
injection-target-class
injection-target*
injection-target-name
description*
ejb-ref-name
ejb-ref-type?
ejb-ref*
home?
remote?
description*
ejb-link?
res-ref-name
mapped-name?
res-type?
resource-ref*
injection-target-class
injection-target*
res-auth?
injection-target-name
res-sharing-scope?
mapped-name?
injection-target-class
injection-target*
injection-target-name
description*
resource-env-ref-name
application-client
resource-env-ref*
resource-env-ref-type?
description*
mapped-name?
display-name+
message-destination*
injection-target-class
injection-target*
injection-target-name
icon*
description*
message-destination-name
message-destination-ref-name
message-destination-type?
message-destination-usage?
message-destination-ref*
message-destination-link?
mapped-name?
description*
injection-target*
injection-target-class
injection-target-name
persistence-unit-ref-name
persistence-unit-ref*
persistence-unit-name?
mapped-name?
injection-target*
injection-target-class
injection-target-name
post-construct*
lifecycle-callback-class?
lifecycle-callback-method
pre-destroy*
lifecycle-callback-class?
lifecycle-callback-method
callback-handler?
Figure EE.A-4
254
EE.A.7
This section provides the XML Schema for the J2EE application deployment
descriptor. The XML grammar for a J2EE application deployment descriptor is
defined by the J2EE:application schema. The granularity of composition for J2EE
application assembly is the J2EE module. A J2EE:application deployment
descriptor contains a name and description for the application and the URI of a UI
icon for the application, as well a list of the J2EE modules that comprise the
application. The content of the XML elements is in general case sensitive. This
means, for example, that <role-name>Manager</role-name> is a different role than
<role-name>manager</role-name>.
A valid J2EE application deployment descriptors may conform to the XML
Schema definition below. The deployment descriptor must be named META-INF/
application.xml in the .ear file. Note that this name is case-sensitive.
Figure EE.A-5 shows a graphic representation of the structure of the J2EE
application XML Schema.
description*
display-name+
small-icon?
icon*
large-icon?
application
web-uri
connector | ejb* | java | web
module+
context-root?
alt-dd?
description*
security-role*
role-name
Figure EE.A-5
The XML Schema that defines the XML grammar for a J2EE 1.4 application
deployment descriptor is located at http://java.sun.com/xml/ns/j2ee/
application_1_4.xsd.
Early Draft
255
EE.A.8
The XML Schema that defines types that are used by many other J2EE 1.4
deployment descriptor schemas, both in this specification and in other
specifications, is located at http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd.
EE.A.9
This section provides the XML DTD for the J2EE 1.3 application deployment
descriptor. The XML grammar for a J2EE application deployment descriptor is
defined by the J2EE:application document type definition. The granularity of
composition for J2EE application assembly is the J2EE module. A
J2EE:application deployment descriptor contains a name and description for the
application and the URI of a UI icon for the application, as well as a list of the J2EE
modules that comprise the application. The content of the XML elements is in
general case sensitive. This means, for example, that <role-name>Manager</rolename> is a different role than <role-name>manager</role-name>.
A valid J2EE 1.3 application deployment descriptor may contain the
following DOCTYPE declaration:
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE
Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
256
application
icon
small-icon
display-name
large-icon
description?
web-uri
Figure EE.A-6
module+
alt-dd?
security-role*
description?
role-name
context-root?
The DTD that defines the XML grammar for a J2EE 1.3 application
deployment descriptor is available at http://java.sun.com/dtd/
application_1_3.dtd.
EE.A.10
This section provides the XML DTD for the J2EE 1.2 version of the application
deployment descriptor. A valid J2EE 1.2 application deployment descriptor may
contain the following DOCTYPE declaration:
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE
Application 1.2//EN" "http://java.sun.com/j2ee/dtds/
application_1_2.dtd">
Early Draft
257
application
icon?
small-icon?
display-name
large-icon?
description?
web-uri
Figure EE.A-7
module+
alt-dd?
security-role*
description?
role-name
context-root
The DTD that defines the XML grammar for a J2EE 1.2 application
deployment descriptor is available at http://java.sun.com/j2ee/dtds/
application_1_2.dtd.
EE.A.11
The XML grammar for a J2EE application client deployment descriptor is defined
by the J2EE application-client schema. The root element of the deployment
descriptor for an application client is application-client. The content of the XML
elements is in general case sensitive. This means, for example, that <resauth>Container</res-auth> must be used, rather than <res-auth>container</
res-auth>.
A valid application-client deployment descriptors may conform to the
following XML Schema definition. The deployment descriptor must be named
META-INF/application-client.xml in the application clients .jar file. Note that
this name is case-sensitive.
Figure EE.A-8 shows the structure of the J2EE 1.4 application-client XML
Schema, which is available at http://java.sun.com/xml/ns/j2ee/applicationclient_1_4.xsd.
258
description*
display-name+
small-icon?
icon*
large-icon?
description*
env-entry-name
env-entry*
env-entry-type
env-entry-value?
description*
ejb-ref-name
ejb-ref-type
ejb-ref*
home
remote
ejb-link?
description*
res-ref-name
application-client
resource-ref*
res-type
res-auth
res-sharing-scope?
description*
resource-env-ref*
resource-env-ref-name
resource-env-ref-type
description*
message-destination-ref-name
message-destination-ref*
message-destination-type
message-destination-usage
message-destination-link?
callback-handler?
description*
display-name+
message-destination*
icon*
message-destination-name
Early Draft
259
Figure EE.A-8
EE.A.12
This section describes the XML DTD for the J2EE 1.3 version of the application
client deployment descriptor. The XML grammar for a J2EE application client
deployment descriptor is defined by the J2EE:application-client document type
definition. The root element of the deployment descriptor for an application client is
application-client. The content of the XML elements is in general case sensitive.
This means, for example, that <res-auth>Container</res-auth> must be used,
rather than <res-auth>container</res-auth>.
A valid application-client deployment descriptor may contain the
following DOCTYPE declaration:
<!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD
J2EE Application Client 1.3//EN" "http://java.sun.com/dtd/
application-client_1_3.dtd">
icon
display-nam
e
small-icon
description
?
env-entry*
ejb-ref*
resource-ref*
resource-env-ref*
large-ico
n
description
?
env-entry-name
description
?
ejb-ref-nam
e
description
?
env-entry-type
ejb-ref-type
res-ref-name
hom
e
res-type
description
?
Figure EE.A-9
env-entry-value?
remote
res-aut
h
ejb-link
?
res-sharing-scope
?
resource-env-ref-name
resource-env-ref-type
callback-handler
?
260
EE.A.13
This section describes the XML DTD for the J2EE 1.2 version of the application
client deployment descriptor. A valid application client deployment descriptor may
contain the following DOCTYPE declaration:
<!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD
J2EE Application Client 1.2//EN" "http://java.sun.com/j2ee/dtds/application-client_1_2.dtd">
application-client
icon?
display-name
small-icon?
large-icon?
description?
env-entry-name
description?
description?
env-entry-type
ejb-ref-name
Early Draft
ejb-ref*
resource-ref*
env-entry-value?
ejb-ref-type
description?
Figure EE.A-10
env-entry*
home
remote
res-ref-name
ejb-link?
res-type
res-auth
A P P E N D I X
EE.B
Revision History
EE.B.1
EE.B.1.1
Additional Requirements
261
262
Added to Chapter EE.8, Application Assembly and Deployment, the requirement that an alternate deployment descriptor may be used external to the
application.
Added Section EE.5.20, Tenant Identifier References, to reflect requirement that identifier for current tenant be made available as java:comp/tenantId.
Updated rules in Section EE.5.2.6, Annotations and Deployment Descriptors, for overriding Resource annotations to include mapped names.
Added Section EE.5.18, Default Data Source, to reflect requirement that a
default data source be made available to the application.
Added Section EE.5.19, Default JMS Connection Factory, to reflect requirement that a default JMS connection factory be made available to the application.
EE.B.1.2
Removed Requirements
Support for EJB entity beans and associated EJB QL has been made optional.
Support for JAX-RPC has been made optional.
Support for the Deployment API has been made optional.
Support for JAXR has been made optional.
Removed restriction against use of UserTransaction in Servlet filters.
EE.B.1.3
Editorial Changes
Early Draft
263
264
Early Draft
A P P E N D I X
EE.C
Related Documents
This specification refers to the following documents. The terms used to refer to
the documents in this specification are included in parentheses.
http://jcp.org/en/
266
Early Draft
267
http://
http://
http://jcp.org/en/
http://
http://
http://
http://
268
http://jcp.org/
Contexts and Dependency Injection for the Java EE Platform 1.1 (CDI
specification). Available at http://jcp.org/en/jsr/detail?id=346.
Dependency Injection for Java 1.0 (DI specification). Available at
jcp.org/en/jsr/detail?id=330.
Extension Mechanism Architecture, Available at
http://
http://docs.oracle.com/
javase/7/docs/technotes/guides/extensions/index.html.
http://docs.oracle.com/
javase/7/docs/technotes/guides/extensions/index.html.
http://docs.oracle.com/javase/7/
docs/technotes/guides/jar/jar.html.
http://
http://
http://
http://www.omg.org/cgi-bin/
http:/
http://tools.ietf.org/html/
Early Draft
269
http://
270
Early Draft