JBoss AS7.1 Developer Guide - Webccess.org

tastelessbeachInternet και Εφαρμογές Web

12 Νοε 2013 (πριν από 3 χρόνια και 6 μήνες)

708 εμφανίσεις

JBoss AS 7.1
JBoss Community Documentation
Page
of
1
415
Developer Guide
Exported from
at 2013-05-21 23:07:02 EDT
JBoss Community Documentation Editor
Copyright 2013 JBoss Community contributors.
JBoss AS 7.1
JBoss Community Documentation
Page
of
2
415
Table of Contents
1
JBoss AS 7 Developer Guide
_________________________________________________________
18
1
.
1
Target Audience
_______________________________________________________________
18
1
.
2
Prerequisites
__________________________________________________________________
18
2
Class loading in JBoss AS 7
__________________________________________________________
19
2
.
1
Deployment Module Names
______________________________________________________
19
2
.
2
Automatic Dependencies
________________________________________________________
19
2
.
3
Class Loading Precedence
_______________________________________________________
20
2
.
4
WAR Class Loading
____________________________________________________________
20
2
.
5
EAR Class Loading
_____________________________________________________________
20
2
.
5
.
1
Class Path Entries
________________________________________________________
23
2
.
6
Global Modules
________________________________________________________________
23
2
.
7
JBoss Deployment Structure File
__________________________________________________
23
2
.
8
Accessing JDK classes
__________________________________________________________
25
3
Implicit module dependencies for deployments
____________________________________________
26
3
.
1
What's an implicit module dependency?
_____________________________________________
26
3
.
2
How and when is an implicit module dependency added?
_______________________________
27
3
.
3
Which are the implicit module dependencies?
________________________________________
27
4
How do I migrate my application from JBoss AS 5 or AS 6 to JBoss AS 7?
______________________
30
4
.
1
Migration Overview
_____________________________________________________________
30
4
.
2
Update Application Dependencies Due to Class Loading Changes
________________________
30
4
.
2
.
1
Modular class loading overview
______________________________________________
31
4
.
2
.
2
Understand module dependencies
___________________________________________
32
4
.
2
.
3
Create or modify files that control class loading in AS7
____________________________
32
4
.
2
.
4
Change ResourceBundle location
____________________________________________
36
4
.
2
.
5
Where to Find Additional Information
__________________________________________
36
4
.
3
Update the DataSource Configuration
______________________________________________
36
4
.
3
.
1
Overview
_______________________________________________________________
37
4
.
3
.
2
Define the datasource
_____________________________________________________
38
4
.
3
.
3
Install the JDBC driver
_____________________________________________________
38
4
.
3
.
4
Configure the datasource for Hibernate or JPA
__________________________________
40
4
.
3
.
5
Where to Find Additional Information
__________________________________________
41
4
.
4
Update the Resource Adapter Configuration
_________________________________________
41
4
.
4
.
1
Overview
_______________________________________________________________
41
4
.
4
.
2
Define the resource adapter
_________________________________________________
42
4
.
5
Update application JNDI namespace names
_________________________________________
42
4
.
5
.
1
Overview
_______________________________________________________________
43
4
.
5
.
2
Review the JNDI Namespace Rules
__________________________________________
43
4
.
5
.
3
Modify your application code to follow the new JNDI namespace rules
_______________
44
4
.
5
.
4
Examples of JNDI mappings in previous releases and how they might look now
________
45
4
.
5
.
5
Where to Find Additional Information
__________________________________________
45
4
.
6
Migrate remote EJB clients to the AS7 client API
______________________________________
45
4
.
7
Migrate EAP 5 Deployed Applications That Make Remote Invocations to AS 7
_______________
45
JBoss AS 7.1
JBoss Community Documentation
Page
of
3
415
4
.
7
.
1
Overview
_______________________________________________________________
46
4
.
7
.
2
Update the Client Code
____________________________________________________
46
4
.
8
Modify logging dependencies
_____________________________________________________
49
4
.
8
.
1
Overview
_______________________________________________________________
49
4
.
8
.
2
Update your application code for third-party logging frameworks
____________________
49
4
.
8
.
3
Modify code to use the New JBoss Logging Framework
___________________________
49
4
.
8
.
4
Where to Find Additional Information
__________________________________________
49
4
.
9
Configure changes for applications that use Hibernate and JPA
__________________________
49
4
.
9
.
1
Overview
_______________________________________________________________
50
4
.
9
.
2
Update your Hibernate 3 application to use Hibernate 4
___________________________
50
4
.
9
.
3
Changes in JPA container managed behaviour
__________________________________
53
4
.
9
.
4
Infinispan as Second Level Cache
____________________________________________
53
4
.
9
.
5
Migrate to Hibernate 4 Validator
_____________________________________________
54
4
.
10
Changes you need to make for Security
_____________________________________________
57
4
.
10
.
1
Configure Security for Basic Authentication
_____________________________________
57
4
.
10
.
2
Modify security domain names
_______________________________________________
57
4
.
11
Configure JAX-RS / Resteasy changes
_____________________________________________
57
4
.
12
Configure LDAP security realm changes
____________________________________________
59
4
.
13
Migrate from JBoss Messaging to HornetQ
__________________________________________
60
4
.
13
.
1
Before you start
__________________________________________________________
60
4
.
13
.
2
Transfer configurations
____________________________________________________
61
4
.
13
.
3
Modify application code
____________________________________________________
61
4
.
13
.
4
Migrate existing messages
__________________________________________________
61
4
.
14
Changes you need to make for Clustering
___________________________________________
61
4
.
14
.
1
Starting AS7 with clustering enabled
__________________________________________
62
4
.
14
.
2
Specifying the bind address
_________________________________________________
63
4
.
14
.
3
Configure jvmRoute to support mod_jk and mod_proxy
___________________________
63
4
.
14
.
4
Specifying multicast address/port
____________________________________________
64
4
.
14
.
5
Using an alternate protocol stack
_____________________________________________
65
4
.
15
HA Singleton Deployment
________________________________________________________
65
4
.
16
Additional changes you may need to make
___________________________________________
65
4
.
16
.
1
Change Maven plugin name
________________________________________________
65
4
.
16
.
2
Update Applications That Use Service-style Deployments
_________________________
65
4
.
17
Debug and Resolve Migration Issues
_______________________________________________
65
4
.
17
.
1
Debug and resolve ClassNotFoundExceptions and NoCLassDefFoundErrors
__________
66
4
.
17
.
2
Debug and resolve ClassCastExceptions
______________________________________
68
4
.
17
.
3
Debug and resolve class loading issues
_______________________________________
69
4
.
17
.
4
Debug and resolve NoSuchMethodExceptions
__________________________________
69
4
.
17
.
5
Debug and resolve DuplicateServiceExceptions
_________________________________
70
4
.
17
.
6
Debug and resolve JBoss Seam debug page errors.
_____________________________
70
4
.
18
EJB 2.x Support
_______________________________________________________________
71
4
.
18
.
1
Modify the Code to Use the New JNDI Namespace Rules
_________________________
71
4
.
18
.
2
Replace JBoss AOP Interceptors
_____________________________________________
71
4
.
18
.
3
Modify the jboss-web.xml File Descriptor
_______________________________________
71
4
.
18
.
4
Replace the jboss.xml deployment descriptor file
________________________________
71
4
.
18
.
5
Start the Server with the Full Profiles
__________________________________________
71
JBoss AS 7.1
JBoss Community Documentation
Page
of
4
415
4
.
19
Migration required for other components
____________________________________________
72
4
.
20
How to migrate Seam 2 archives to JBoss AS 7
_______________________________________
72
4
.
20
.
1
Overview
_______________________________________________________________
72
4
.
20
.
2
Update the datasource configuration
__________________________________________
72
4
.
20
.
3
Add any required dependencies
_____________________________________________
73
4
.
20
.
4
Copy dependent archives from outside frameworks or other locations
________________
73
4
.
20
.
5
Seam 2 JPA example deployment on JBoss AS 7
_______________________________
74
4
.
20
.
6
How to debug and resolve Seam 2 JNDI errors
__________________________________
75
4
.
21
Running Seam 3 archives on JBoss AS 7
____________________________________________
75
4
.
22
Migrating Spring applications
_____________________________________________________
76
4
.
23
Tools That Can Assist with Migration
_______________________________________________
76
4
.
23
.
1
Use Tattletale to find application dependencies
__________________________________
76
4
.
23
.
2
IronJacamar Datasource and Resource Adapter Migration Tool
_____________________
77
5
EJB invocations from a remote standalone client using JNDI
_________________________________
84
5
.
1
Deploying your EJBs on the server side:
____________________________________________
84
5
.
2
Writing a remote client application for accessing and invoking the EJBs deployed on the server
_
86
5
.
3
Setting up EJB client context properties
_____________________________________________
92
5
.
4
Using a different file for setting up EJB client context
___________________________________
95
5
.
5
Setting up the client classpath with the jars that are required to run the client application
_______
95
5
.
6
Summary
_____________________________________________________________________
96
6
EJB invocations from a remote server
__________________________________________________
97
6
.
1
Application packaging
___________________________________________________________
97
6
.
2
Beans
_______________________________________________________________________
98
6
.
3
Security
______________________________________________________________________
98
6
.
4
Configuring a user on the "Destination Server"
________________________________________
99
6
.
5
Start the "Destination Server"
____________________________________________________
100
6
.
6
Deploying the application
_______________________________________________________
100
6
.
7
Configuring the "Client Server" to point to the EJB remoting connector on the "Destination Server"
_
100
6
.
8
Start the "Client Server"
________________________________________________________
101
6
.
9
Create a security realm on the client server
_________________________________________
101
6
.
10
Create a outbound-socket-binding on the "Client Server"
_______________________________
103
6
.
11
Create a "remote-outbound-connection" which uses this newly created "outbound-socket-binding"
_
103
6
.
12
Packaging the client application on the "Client Server"
_________________________________
105
6
.
13
Contents on jboss-ejb-client.xml
__________________________________________________
106
6
.
14
Deploy the client application
_____________________________________________________
106
6
.
15
Client code invoking the bean
____________________________________________________
107
7
Remote EJB invocations via JNDI - Which approach to use?
________________________________
108
8
JBoss EJB 3 reference guide
________________________________________________________
109
8
.
1
Resource Adapter for Message Driven Beans
_______________________________________
109
8
.
1
.
1
Specification of Resource Adapter using Metadata Annotations
____________________
109
8
.
2
Run-as Principal
______________________________________________________________
110
8
.
2
.
1
Specification of Run-as Principal using Metadata Annotations
_____________________
110
8
.
3
Security Domain
______________________________________________________________
110
8
.
3
.
1
Specification of Security Domain using Metadata Annotations
_____________________
110
JBoss AS 7.1
JBoss Community Documentation
Page
of
5
415
8
.
4
Transaction Timeout
___________________________________________________________
110
8
.
4
.
1
Specification of Transaction Timeout with Metadata Annotations
___________________
111
8
.
4
.
2
Specification of Transaction Timeout in the Deployment Descriptor
_________________
112
8
.
5
Timer service
_________________________________________________________________
112
8
.
5
.
1
Single event timer
_______________________________________________________
113
8
.
5
.
2
Recurring timer
__________________________________________________________
113
8
.
5
.
3
Calendar timer
__________________________________________________________
114
9
JPA reference guide
_______________________________________________________________
115
9
.
1
Introduction
__________________________________________________________________
115
9
.
2
Entity manager
_______________________________________________________________
116
9
.
3
Application-managed entity manager
______________________________________________
116
9
.
4
Container-managed entity manager
_______________________________________________
116
9
.
5
Persistence Context
___________________________________________________________
116
9
.
6
Transaction-scoped persistence context
____________________________________________
117
9
.
7
Container-managed Extended Persistence context
___________________________________
117
9
.
8
Entities
______________________________________________________________________
118
9
.
9
Deployment
__________________________________________________________________
118
9
.
10
Troubleshooting
_______________________________________________________________
118
9
.
11
Using the Hibernate 4 JPA persistence provider
______________________________________
120
9
.
12
Using the Infinispan second level cache
____________________________________________
121
9
.
13
Replacing the current Hibernate 4.0.x jars with a newer version
_________________________
121
9
.
14
Packaging the Hibernate 3.5 or greater 3.x JPA persistence provider with your application
____
125
9
.
15
Sharing the Hibernate 3.5 or greater JPA persistence provider between multiple applications
__
125
9
.
16
Using EclipseLink
_____________________________________________________________
127
9
.
17
Native Hibernate use
___________________________________________________________
127
9
.
18
Injection of Hibernate Session and SessionFactoryInjection of Hibernate Session and
SessionFactory
____________________________________________________________________
127
9
.
19
Persistence unit properties
______________________________________________________
127
9
.
20
Binding EntityManagerFactory to JNDI
_____________________________________________
130
9
.
21
Community
__________________________________________________________________
131
9
.
21
.
1
People who have contributed to the AS7 JPA layer:
_____________________________
131
9
.
22
Hall of fame
__________________________________________________________________
131
9
.
22
.
1
For answering JPA related AS questions in the forums:
__________________________
131
10
OSGi developer guide
______________________________________________________________
132
11
JNDI reference guide
______________________________________________________________
133
11
.
1
Overview
____________________________________________________________________
133
11
.
2
Local JNDI
___________________________________________________________________
133
11
.
2
.
1
Binding entries to JNDI
___________________________________________________
134
11
.
3
Remote JNDI
_________________________________________________________________
136
11
.
3
.
1
remote:
________________________________________________________________
137
11
.
3
.
2
ejb:
___________________________________________________________________
138
12
Spring applications development and migration guide
_____________________________________
139
12
.
1
Dependencies and Modularity
____________________________________________________
139
12
.
2
Persistence usage guide
________________________________________________________
139
12
.
3
Native Spring/Hibernate applications
______________________________________________
139
12
.
4
JPA-based applications
_________________________________________________________
139
JBoss AS 7.1
JBoss Community Documentation
Page
of
6
415
12
.
4
.
1
Using server-deployed persistence units
______________________________________
140
12
.
4
.
2
Using Spring-managed persistence units
_____________________________________
141
12
.
4
.
3
Managing dependencies
__________________________________________________
142
13
All JBoss AS 7 documentation
_______________________________________________________
143
14
Application Client Reference
_________________________________________________________
144
14
.
1
Getting Started
_______________________________________________________________
144
14
.
2
Connecting to more than one host
________________________________________________
144
15
Class Loading in AS7
______________________________________________________________
145
15
.
1
Deployment Module Names
_____________________________________________________
145
15
.
2
Automatic Dependencies
_______________________________________________________
145
15
.
3
Class Loading Precedence
______________________________________________________
146
15
.
4
WAR Class Loading
___________________________________________________________
146
15
.
5
EAR Class Loading
____________________________________________________________
146
15
.
5
.
1
Class Path Entries
_______________________________________________________
149
15
.
6
Global Modules
_______________________________________________________________
149
15
.
7
JBoss Deployment Structure File
_________________________________________________
149
15
.
8
Accessing JDK classes
_________________________________________________________
151
16
Deployment Descriptors used In AS7.1
________________________________________________
152
17
Development Guidelines and Recommended Practices
____________________________________
156
18
EJB 3 Reference Guide
_____________________________________________________________
157
18
.
1
Resource Adapter for Message Driven Beans
_______________________________________
157
18
.
1
.
1
Specification of Resource Adapter using Metadata Annotations
____________________
157
18
.
2
Run-as Principal
______________________________________________________________
158
18
.
2
.
1
Specification of Run-as Principal using Metadata Annotations
_____________________
158
18
.
3
Security Domain
______________________________________________________________
158
18
.
3
.
1
Specification of Security Domain using Metadata Annotations
_____________________
158
18
.
4
Transaction Timeout
___________________________________________________________
158
18
.
4
.
1
Specification of Transaction Timeout with Metadata Annotations
___________________
159
18
.
4
.
2
Specification of Transaction Timeout in the Deployment Descriptor
_________________
160
18
.
5
Timer service
_________________________________________________________________
160
18
.
5
.
1
Single event timer
_______________________________________________________
161
18
.
5
.
2
Recurring timer
__________________________________________________________
161
18
.
5
.
3
Calendar timer
__________________________________________________________
162
18
.
6
EJB3 subsystem configuration guide
______________________________________________
162
18
.
6
.
1
<session-bean>
_________________________________________________________
164
18
.
6
.
2
<mdb>
________________________________________________________________
164
18
.
6
.
3
<pools>
_______________________________________________________________
165
18
.
6
.
4
<caches>
______________________________________________________________
165
18
.
6
.
5
<passivation-stores>
_____________________________________________________
165
18
.
6
.
6
<async>
_______________________________________________________________
165
18
.
6
.
7
<timer-service>
_________________________________________________________
165
18
.
6
.
8
<remote>
______________________________________________________________
165
18
.
6
.
9
<thread-pools>
__________________________________________________________
165
18
.
6
.
10
<iiop>
_________________________________________________________________
166
18
.
6
.
11
<in-vm-remote-interface-invocation>
_________________________________________
166
18
.
7
EJB IIOP Guide
_______________________________________________________________
166
JBoss AS 7.1
JBoss Community Documentation
Page
of
7
415
18
.
7
.
1
Enabling IIOP
___________________________________________________________
167
18
.
7
.
2
Enabling JTS
___________________________________________________________
167
18
.
7
.
3
Dynamic Stub's
_________________________________________________________
167
18
.
7
.
4
Configuring EJB IIOP settings via jboss-ejb3.xml
_______________________________
168
18
.
8
jboss-ejb3.xml Reference
_______________________________________________________
168
18
.
8
.
1
Example File
___________________________________________________________
168
19
EJB invocations from a remote client using JNDI
_________________________________________
172
19
.
1
Deploying your EJBs on the server side:
___________________________________________
172
19
.
2
Writing a remote client application for accessing and invoking the EJBs deployed on the server

174
19
.
3
Setting up EJB client context properties
____________________________________________
180
19
.
4
Using a different file for setting up EJB client context
__________________________________
183
19
.
5
Setting up the client classpath with the jars that are required to run the client application
______
183
19
.
6
Summary
____________________________________________________________________
184
20
EJB invocations from a remote server instance
__________________________________________
185
20
.
1
Application packaging
__________________________________________________________
185
20
.
2
Beans
______________________________________________________________________
186
20
.
3
Security
_____________________________________________________________________
186
20
.
4
Configuring a user on the "Destination Server"
_______________________________________
187
20
.
5
Start the "Destination Server"
____________________________________________________
188
20
.
6
Deploying the application
_______________________________________________________
188
20
.
7
Configuring the "Client Server" to point to the EJB remoting connector on the "Destination Server"
_
188
20
.
8
Start the "Client Server"
________________________________________________________
189
20
.
9
Create a security realm on the client server
_________________________________________
189
20
.
10
Create a outbound-socket-binding on the "Client Server"
______________________________
191
20
.
11
Create a "remote-outbound-connection" which uses this newly created "outbound-socket-binding"
_
191
20
.
12
Packaging the client application on the "Client Server"
________________________________
193
20
.
13
Contents on jboss-ejb-client.xml
_________________________________________________
194
20
.
14
Deploy the client application
_____________________________________________________
194
20
.
15
Client code invoking the bean
___________________________________________________
195
21
Example Applications - Migrated to AS7
________________________________________________
196
21
.
1
Example Applications Migrated from Previous Releases
_______________________________
196
21
.
1
.
1
Seam 2 JPA example
_____________________________________________________
196
21
.
1
.
2
Seam 2 DVD Store example
_______________________________________________
196
21
.
1
.
3
Seam 2 Booking example
_________________________________________________
196
21
.
1
.
4
Seam 2 Booking - step-by-step migration of binaries
____________________________
196
21
.
1
.
5
jBPM-Console application
_________________________________________________
196
21
.
1
.
6
Order application used for performance testing
_________________________________
197
21
.
1
.
7
Migrate example application
_______________________________________________
197
21
.
2
Example Applications Based on EE6
______________________________________________
197
21
.
3
Porting the Order Application from EAP 5.1 to AS 7
___________________________________
197
21
.
3
.
1
Overview of the application
________________________________________________
197
21
.
3
.
2
Summary of changes
_____________________________________________________
197
21
.
4
Seam 2 Booking Application - Migration of Binaries from EAP5.1 to AS7
__________________
203
21
.
4
.
1
Step 1: Build and deploy the EAP5.1 version of the Seam Booking application
________
204
JBoss AS 7.1
JBoss Community Documentation
Page
of
8
415
21
.
4
.
2
Step 2: Debug and resolve deployment errors and exceptions
_____________________
204
21
.
4
.
3
Step 3: Debug and resolve runtime errors and exceptions
________________________
219
21
.
4
.
4
Step 4: Access the application
______________________________________________
223
21
.
4
.
5
Summary of Changes
____________________________________________________
223
22
How do I migrate my application from AS5 or AS6 to AS7
__________________________________
225
22
.
1
Migration Overview
____________________________________________________________
225
22
.
2
Update Application Dependencies Due to Class Loading Changes
_______________________
225
22
.
2
.
1
Modular class loading overview
_____________________________________________
226
22
.
2
.
2
Understand module dependencies
__________________________________________
227
22
.
2
.
3
Create or modify files that control class loading in AS7
___________________________
227
22
.
2
.
4
Change ResourceBundle location
___________________________________________
231
22
.
2
.
5
Where to Find Additional Information
_________________________________________
231
22
.
3
Update the DataSource Configuration
_____________________________________________
231
22
.
3
.
1
Overview
______________________________________________________________
232
22
.
3
.
2
Define the datasource
____________________________________________________
233
22
.
3
.
3
Install the JDBC driver
____________________________________________________
233
22
.
3
.
4
Configure the datasource for Hibernate or JPA
_________________________________
235
22
.
3
.
5
Where to Find Additional Information
_________________________________________
236
22
.
4
Update the Resource Adapter Configuration
________________________________________
236
22
.
4
.
1
Overview
______________________________________________________________
236
22
.
4
.
2
Define the resource adapter
________________________________________________
237
22
.
5
Update application JNDI namespace names
________________________________________
237
22
.
5
.
1
Overview
______________________________________________________________
238
22
.
5
.
2
Review the JNDI Namespace Rules
_________________________________________
238
22
.
5
.
3
Modify your application code to follow the new JNDI namespace rules
______________
239
22
.
5
.
4
Examples of JNDI mappings in previous releases and how they might look now
_______
240
22
.
5
.
5
Where to Find Additional Information
_________________________________________
240
22
.
6
Migrate remote EJB clients to the AS7 client API
_____________________________________
240
22
.
7
Migrate EAP 5 Deployed Applications That Make Remote Invocations to AS 7
______________
240
22
.
7
.
1
Overview
______________________________________________________________
241
22
.
7
.
2
Update the Client Code
___________________________________________________
241
22
.
8
Modify logging dependencies
____________________________________________________
244
22
.
8
.
1
Overview
______________________________________________________________
244
22
.
8
.
2
Update your application code for third-party logging frameworks
___________________
244
22
.
8
.
3
Modify code to use the New JBoss Logging Framework
__________________________
244
22
.
8
.
4
Where to Find Additional Information
_________________________________________
244
22
.
9
Configure changes for applications that use Hibernate and JPA
_________________________
244
22
.
9
.
1
Overview
______________________________________________________________
245
22
.
9
.
2
Update your Hibernate 3 application to use Hibernate 4
__________________________
245
22
.
9
.
3
Changes in JPA container managed behaviour
_________________________________
248
22
.
9
.
4
Infinispan as Second Level Cache
___________________________________________
248
22
.
9
.
5
Migrate to Hibernate 4 Validator
____________________________________________
249
22
.
10
Changes you need to make for Security
___________________________________________
252
22
.
10
.
1
Configure Security for Basic Authentication
___________________________________
252
22
.
10
.
2
Modify security domain names
_____________________________________________
252
22
.
11
Configure JAX-RS / Resteasy changes
____________________________________________
252
JBoss AS 7.1
JBoss Community Documentation
Page
of
9
415
Configure JAX-RS / Resteasy changes
___________________________________________
252
22
.
12
Configure LDAP security realm changes
___________________________________________
254
22
.
13
Migrate from JBoss Messaging to HornetQ
_________________________________________
255
22
.
13
.
1
Before you start
_________________________________________________________
255
22
.
13
.
2
Transfer configurations
___________________________________________________
256
22
.
13
.
3
Modify application code
___________________________________________________
256
22
.
13
.
4
Migrate existing messages
________________________________________________
256
22
.
14
Changes you need to make for Clustering
__________________________________________
256
22
.
14
.
1
Starting AS7 with clustering enabled
_________________________________________
257
22
.
14
.
2
Specifying the bind address
_______________________________________________
258
22
.
14
.
3
Configure jvmRoute to support mod_jk and mod_proxy
__________________________
258
22
.
14
.
4
Specifying multicast address/port
___________________________________________
259
22
.
14
.
5
Using an alternate protocol stack
___________________________________________
260
22
.
15
HA Singleton Deployment
______________________________________________________
260
22
.
16
Additional changes you may need to make
_________________________________________
260
22
.
16
.
1
Change Maven plugin name
_______________________________________________
260
22
.
16
.
2
Update Applications That Use Service-style Deployments
________________________
260
22
.
17
Debug and Resolve Migration Issues
______________________________________________
260
22
.
17
.
1
Debug and resolve ClassNotFoundExceptions and NoCLassDefFoundErrors
________
261
22
.
17
.
2
Debug and resolve ClassCastExceptions
_____________________________________
263
22
.
17
.
3
Debug and resolve class loading issues
______________________________________
264
22
.
17
.
4
Debug and resolve NoSuchMethodExceptions
_________________________________
264
22
.
17
.
5
Debug and resolve DuplicateServiceExceptions
________________________________
265
22
.
17
.
6
Debug and resolve JBoss Seam debug page errors.
____________________________
265
22
.
18
EJB 2.x Support
______________________________________________________________
266
22
.
18
.
1
Modify the Code to Use the New JNDI Namespace Rules
________________________
266
22
.
18
.
2
Replace JBoss AOP Interceptors
___________________________________________
266
22
.
18
.
3
Modify the jboss-web.xml File Descriptor
_____________________________________
266
22
.
18
.
4
Replace the jboss.xml deployment descriptor file
_______________________________
266
22
.
18
.
5
Start the Server with the Full Profiles
________________________________________
266
22
.
19
Migration required for other components
___________________________________________
267
22
.
20
How to migrate Seam 2 archives to JBoss AS 7
_____________________________________
267
22
.
20
.
1
Overview
______________________________________________________________
267
22
.
20
.
2
Update the datasource configuration
________________________________________
267
22
.
20
.
3
Add any required dependencies
____________________________________________
268
22
.
20
.
4
Copy dependent archives from outside frameworks or other locations
______________
268
22
.
20
.
5
Seam 2 JPA example deployment on JBoss AS 7
______________________________
269
22
.
20
.
6
How to debug and resolve Seam 2 JNDI errors
________________________________
270
22
.
21
Running Seam 3 archives on JBoss AS 7
__________________________________________
270
22
.
22
Migrating Spring applications
____________________________________________________
271
22
.
23
Tools That Can Assist with Migration
______________________________________________
271
22
.
23
.
1
Use Tattletale to find application dependencies
________________________________
271
22
.
23
.
2
IronJacamar Datasource and Resource Adapter Migration Tool
___________________
272
23
How do I migrate my application to AS7 from other application servers
________________________
279
23
.
1
Choose from the list below:
______________________________________________________
279
23
.
2
How do I migrate my application from WebLogic to AS 7
_______________________________
279
23
.
3
How do I migrate my application from WebSphere to AS 7
_____________________________
279
JBoss AS 7.1
JBoss Community Documentation
Page
of
10
415
24
Implicit module dependencies for deployments
___________________________________________
280
24
.
1
What's an implicit module dependency?
____________________________________________
280
24
.
2
How and when is an implicit module dependency added?
______________________________
281
24
.
3
Which are the implicit module dependencies?
_______________________________________
281
25
JAX-RS Reference Guide
___________________________________________________________
284
25
.
1
Subclassing javax.ws.rs.core.Application and using @ApplicationPath
____________________
284
25
.
2
Subclassing javax.ws.rs.core.Application and using web.xml
____________________________
285
25
.
3
Using web.xml
________________________________________________________________
285
26
JNDI Reference
___________________________________________________________________
286
26
.
1
Overview
____________________________________________________________________
286
26
.
2
Local JNDI
___________________________________________________________________
286
26
.
2
.
1
Binding entries to JNDI
___________________________________________________
287
26
.
3
Remote JNDI
_________________________________________________________________
289
26
.
3
.
1
remote:
________________________________________________________________
290
26
.
3
.
2
ejb:
___________________________________________________________________
291
27
JPA Reference Guide
______________________________________________________________
292
27
.
1
Introduction
__________________________________________________________________
292
27
.
2
Entity manager
_______________________________________________________________
293
27
.
3
Application-managed entity manager
______________________________________________
293
27
.
4
Container-managed entity manager
_______________________________________________
293
27
.
5
Persistence Context
___________________________________________________________
293
27
.
6
Transaction-scoped persistence context
____________________________________________
294
27
.
7
Container-managed Extended Persistence context
___________________________________
294
27
.
8
Entities
______________________________________________________________________
295
27
.
9
Deployment
__________________________________________________________________
295
27
.
10
Troubleshooting
______________________________________________________________
295
27
.
11
Using the Hibernate 4 JPA persistence provider
_____________________________________
297
27
.
12
Using the Infinispan second level cache
___________________________________________
298
27
.
13
Replacing the current Hibernate 4.0.x jars with a newer version
_________________________
298
27
.
14
Packaging the Hibernate 3.5 or greater 3.x JPA persistence provider with your application
____
302
27
.
15
Sharing the Hibernate 3.5 or greater JPA persistence provider between multiple applications
__
302
27
.
16
Using EclipseLink
_____________________________________________________________
304
27
.
17
Native Hibernate use
__________________________________________________________
304
27
.
18
Injection of Hibernate Session and SessionFactoryInjection of Hibernate Session and
SessionFactory
____________________________________________________________________
304
27
.
19
Persistence unit properties
______________________________________________________
304
27
.
20
Binding EntityManagerFactory to JNDI
____________________________________________
307
27
.
21
Community
__________________________________________________________________
308
27
.
21
.
1
People who have contributed to the AS7 JPA layer:
_____________________________
308
27
.
22
Hall of fame
_________________________________________________________________
308
27
.
22
.
1
For answering JPA related AS questions in the forums:
__________________________
308
28
OSGi Developer Guide
_____________________________________________________________
309
29
Remote EJB invocations via JNDI - EJB client API or remote-naming project
___________________
310
29
.
1
Purpose
_____________________________________________________________________
310
29
.
2
History
______________________________________________________________________
310
29
.
3
Overview
____________________________________________________________________
310
JBoss AS 7.1
JBoss Community Documentation
Page
of
11
415
29
.
3
.
1
Client code relying on jndi.properties in classpath
_______________________________
310
29
.
3
.
2
How does remoting naming work
____________________________________________
312
29
.
3
.
3
JNDI operations allowed using remote-naming project
___________________________
313
29
.
3
.
4
Pre-requisites of remotely accessible JNDI objects
______________________________
314
29
.
3
.
5
JNDI lookup strings for remote clients backed by the remote-naming project
__________
314
29
.
3
.
6
How does remote-naming project implementation transfer the JNDI objects to the clients
___
315
29
.
4
Summary
____________________________________________________________________
315
29
.
5
Remote EJB invocations backed by the remote-naming project
__________________________
315
29
.
6
Why use the EJB client API approach then?
_________________________________________
318
29
.
6
.
1
Is the lookup optimization applicable for all bean types?
__________________________
320
30
Spring applications development and migration guide
_____________________________________
321
30
.
1
Dependencies and Modularity
____________________________________________________
321
30
.
2
Persistence usage guide
________________________________________________________
321
30
.
3
Native Spring/Hibernate applications
______________________________________________
321
30
.
4
JPA-based applications
_________________________________________________________
321
30
.
4
.
1
Using server-deployed persistence units
______________________________________
322
30
.
4
.
2
Using Spring-managed persistence units
_____________________________________
323
30
.
4
.
3
Managing dependencies
__________________________________________________
324
31
Webservices reference guide
________________________________________________________
325
31
.
1
JAX-WS User Guide
___________________________________________________________
325
31
.
1
.
1
Web Service Endpoints
___________________________________________________
325
31
.
1
.
2
Web Service Clients
______________________________________________________
328
31
.
1
.
3
Common API
___________________________________________________________
334
31
.
1
.
4
JAX-WS Annotations
_____________________________________________________
337
31
.
1
.
5
JSR-181 Annotations
_____________________________________________________
339
31
.
2
JAX-WS Tools
________________________________________________________________
340
31
.
2
.
1
Server side
_____________________________________________________________
340
31
.
2
.
2
Client Side
_____________________________________________________________
345
31
.
2
.
3
wsconsume
____________________________________________________________
348
31
.
2
.
4
wsprovide
______________________________________________________________
354
31
.
3
Advanced User Guide
__________________________________________________________
359
31
.
3
.
1
WS-* support
___________________________________________________________
360
31
.
3
.
2
JAXB Introductions
_______________________________________________________
360
31
.
3
.
3
Address rewrite
_________________________________________________________
361
31
.
3
.
4
Authentication
__________________________________________________________
361
31
.
3
.
5
JBossWS integration layer with Apache CXF
__________________________________
364
31
.
3
.
6
WS-Addressing
_________________________________________________________
367
31
.
3
.
7
WS-Security
____________________________________________________________
370
31
.
3
.
8
WS-Reliable Messaging
___________________________________________________
393
31
.
3
.
9
SOAP over JMS
_________________________________________________________
399
31
.
3
.
10
HTTP Proxy
____________________________________________________________
411
31
.
4
JBoss Modules and WS applications
______________________________________________
413
31
.
4
.
1
Setting module dependencies
______________________________________________
413
31
.
4
.
2
______________________________________________________________________
415
JBoss AS 7.1
JBoss Community Documentation
Page
of
12
415
JBoss AS 7 Developer Guide
Target Audience
Prerequisites
Class loading in JBoss AS 7
Deployment Module Names
Automatic Dependencies
Class Loading Precedence
WAR Class Loading
EAR Class Loading
Class Path Entries
Global Modules
JBoss Deployment Structure File
Accessing JDK classes
Implicit module dependencies for deployments
What's an implicit module dependency?
How and when is an implicit module dependency added?
Which are the implicit module dependencies?
How do I migrate my application from JBoss AS 5 or AS 6 to JBoss AS 7?
Migration Overview
Update Application Dependencies Due to Class Loading Changes
Modular class loading overview
Understand module dependencies
How to Package EARs and WARs
Create or modify files that control class loading in AS7
jboss-web.xml
MANIFEST.MF file
Manually edited MANIFEST files
How to define
file dependencies if you use Maven
MANIFEST.MF
jboss-deployment-structure.xml
application.xml
Change ResourceBundle location
Where to Find Additional Information
Update the DataSource Configuration
Overview
Define the datasource
Install the JDBC driver
Install the JDBC driver as a deployment
Install the JDBC driver as a core module
Configure the datasource for Hibernate or JPA
Where to Find Additional Information
Update the Resource Adapter Configuration
Overview
Define the resource adapter
JBoss AS 7.1
JBoss Community Documentation
Page
of
13
415
Update application JNDI namespace names
Overview
Review the JNDI Namespace Rules
Modify your application code to follow the new JNDI namespace rules
Examples of JNDI mappings in previous releases and how they might look now
Migrate remote EJB clients to the AS7 client API
Migrate EAP 5 Deployed Applications That Make Remote Invocations to AS 7
Overview
Update the Client Code
Modify logging dependencies
Overview
Update your application code for third-party logging frameworks
Modify code to use the New JBoss Logging Framework
Where to Find Additional Information
Configure changes for applications that use Hibernate and JPA
Overview
Update your Hibernate 3 application to use Hibernate 4
Changes for Hibernate 3.3 applications
Changes for Hibernate 3.5 applications
General Changes when migrating to Hibernate 4
Changes in JPA container managed behaviour
Infinispan as Second Level Cache
Overview
Infinispan second-level cache settings
Migrate to Hibernate 4 Validator
Accessing the default ValidatorFactory
Life cycle triggered validation
Manual validation
Using the new Bean Validation constraints
Custom constraints
Where to Find Additional Information
Changes you need to make for Security
Configure Security for Basic Authentication
Modify security domain names
Configure JAX-RS / Resteasy changes
Configure LDAP security realm changes
Migrate from JBoss Messaging to HornetQ
Before you start
Transfer configurations
Modify application code
Migrate existing messages
JBoss AS 7.1
JBoss Community Documentation
Page
of
14
415
Changes you need to make for Clustering
Starting AS7 with clustering enabled
Specifying the bind address
Configure
to support
and
jvmRoute
mod_jk
mod_proxy
Specifying multicast address/port
Using an alternate protocol stack
HA Singleton Deployment
Additional changes you may need to make
Change Maven plugin name
Update Applications That Use Service-style Deployments
Debug and Resolve Migration Issues
Debug and resolve ClassNotFoundExceptions and NoCLassDefFoundErrors
Change the application structure to find classes within the application
How to find the JBoss module dependency
How to find the JAR in previous install
Debug and resolve ClassCastExceptions
Remove any unnecessary JARs from the Application archive
Exclude any conflicting dependencies using the
file
jboss-deployment-structure.xml
Debug and resolve class loading issues
Debug and resolve
NoSuchMethodExceptions
Debug and resolve DuplicateServiceExceptions
Debug and resolve JBoss Seam debug page errors.
EJB 2.x Support
Modify the Code to Use the New JNDI Namespace Rules
Replace JBoss AOP Interceptors
Modify the
File Descriptor
jboss-web.xml
Replace the
deployment descriptor file
jboss.xml
Start the Server with the Full Profiles
Migration required for other components
How to migrate Seam 2 archives to JBoss AS 7
Overview
Update the datasource configuration
Add any required dependencies
Copy dependent archives from outside frameworks or other locations
Seam 2 JPA example deployment on JBoss AS 7
How to debug and resolve Seam 2 JNDI errors
Running Seam 3 archives on JBoss AS 7
Migrating Spring applications
JBoss AS 7.1
JBoss Community Documentation
Page
of
15
415
Tools That Can Assist with Migration
Use Tattletale to find application dependencies
Install Tattletale
Create and review the Tattletale report
IronJacamar Datasource and Resource Adapter Migration Tool
Summary
Download and install IronJacamar
Use the IronJacamar Migration Tool to convert a datasource configuration file.
Use the IronJacamar Migration Tool to convert a resource adapter configuration
file.
EJB invocations from a remote standalone client using JNDI
Deploying your EJBs on the server side:
Writing a remote client application for accessing and invoking the EJBs deployed on the server
Setting up EJB client context properties
Using a different file for setting up EJB client context
Setting up the client classpath with the jars that are required to run the client application
Summary
EJB invocations from a remote server
Application packaging
Beans
Security
Configuring a user on the "Destination Server"
Start the "Destination Server"
Deploying the application
Configuring the "Client Server" to point to the EJB remoting connector on the "Destination
Server"
Start the "Client Server"
Create a security realm on the client server
Create a outbound-socket-binding on the "Client Server"
Create a "remote-outbound-connection" which uses this newly created
"outbound-socket-binding"
Packaging the client application on the "Client Server"
Contents on jboss-ejb-client.xml
Deploy the client application
Client code invoking the bean
Remote EJB invocations via JNDI - Which approach to use?
JBoss AS 7.1
JBoss Community Documentation
Page
of
16
415
JBoss EJB 3 reference guide
Resource Adapter for Message Driven Beans
Specification of Resource Adapter using Metadata Annotations
Run-as Principal
Specification of Run-as Principal using Metadata Annotations
Security Domain
Specification of Security Domain using Metadata Annotations
Transaction Timeout
Specification of Transaction Timeout with Metadata Annotations
Specification of Transaction Timeout in the Deployment Descriptor
Example of
trans-timeout
Timer service
Single event timer
Recurring timer
Calendar timer
Programmatic calendar timer
Annotated calendar timer
JPA reference guide
Introduction
Entity manager
Application-managed entity manager
Container-managed entity manager
Persistence Context
Transaction-scoped persistence context
Container-managed Extended Persistence context
Entities
Deployment
Troubleshooting
Using the Hibernate 4 JPA persistence provider
Using the Infinispan second level cache
Replacing the current Hibernate 4.0.x jars with a newer version
Packaging the Hibernate 3.5 or greater 3.x JPA persistence provider with your application
Sharing the Hibernate 3.5 or greater JPA persistence provider between multiple applications
Using EclipseLink
Native Hibernate use
Injection of Hibernate Session and SessionFactoryInjection of Hibernate Session and
SessionFactory
Persistence unit properties
Binding EntityManagerFactory to JNDI
Community
People who have contributed to the AS7 JPA layer:
Hall of fame
For answering JPA related AS questions in the forums:
OSGi developer guide
JBoss AS 7.1
JBoss Community Documentation
Page
of
17
415
JNDI reference guide
Overview
Local JNDI
Binding entries to JNDI
Using @EJB
Using a deployment descriptor
Programatically
In the Naming Subsystem Configuration
Remote JNDI
remote:
ejb:
Spring applications development and migration guide
Dependencies and Modularity
Persistence usage guide
Native Spring/Hibernate applications
JPA-based applications
Using server-deployed persistence units
Using Spring-managed persistence units
Placement of the persistence unit definitions
Managing dependencies
All JBoss AS 7 documentation
JBoss AS 7.1
JBoss Community Documentation
Page
of
18
415
1

JBoss AS 7 Developer Guide
1
.
1

Target Audience
Java Developers
1
.
2

Prerequisites
JBoss AS 7.1
JBoss Community Documentation
Page
of
19
415
2

Class loading in JBoss AS 7
Class loading in AS7 is considerably different to previous versions of JBoss AS. Class loading is based on
the
project. Instead of the more familiar hierarchical class loading environment, AS7's class
JBoss Modules
loading is based on modules that have to define explicit dependencies on other modules. Deployments in
AS7 are also modules, and do not have access to classes that are defined in jars in the application server
unless an explicit dependency on those classes is defined.
2
.
1

Deployment Module Names
Module names for top level deployments follow the format
while sub
deployment.myarchive.war
deployments are named like

deployment.myear.ear.mywar.war
This means that it is possible for a deployment to import classes from another deployment using the other
deployments module name, the details of how to add an explicit module dependency are explained below.
2
.
2

Automatic Dependencies
Even though in AS7 modules are isolated by default, as part of the deployment process some dependencies
on modules defined by the application server are set up for you automatically. For instance, if you are
deploying a Java EE application a dependency on the Java EE API's will be added to your module
automatically. Similarly if your module contains a beans.xml file a dependency on
will be added
Weld
automatically, along with any supporting modules that weld needs to operate.
For a complete list of the automatic dependencies that are added see
.
this page
Automatic dependencies can be excluded through the use of
.
jboss-deployment-structure.xml
JBoss AS 7.1
JBoss Community Documentation
Page
of
20
415
1.
2.
3.
4.
2
.
3

Class Loading Precedence
A common source of errors in Java applications is including API classes in a deployment that are also
provided by the container. This can result in multiple versions of the class being created and the deployment
failing to deploy properly. To prevent this in AS7, module dependencies are added in a specific order that
should prevent this situation from occurring. 
In order of highest priority to lowest priority
System Dependencies - These are dependencies that are added to the module automatically by the
container, including the Java EE api's.
User Dependencies - These are dependencies that are added through 
 or through the 
 manifest entry for modules
jboss-deployment-structure.xml
Dependencies:
or through 
for jar files.
Class-Path:
Local Resource - Class files packaged up inside the deployment itself, e.g. class files from
or
of a war.
WEB-INF/classes
WEB-INF/lib
Inter deployment dependencies - These are dependencies on other deployments in an ear
deployment. This can include classes in an ear's lib directory, or classes defined in other ejb jars. 
2
.
4

WAR Class Loading
The war is considered to be a single module, so classes defined in
are treated the same as
WEB-INF/lib
classes in
. All classes packaged in the war will be loaded with the same class loader.
WEB-INF/classes
2
.
5

EAR Class Loading
Ear deployments are multi-module deployments. This means that not all classes inside an ear will
necessarily have access to all other classes in the ear, unless explicit dependencies have been defined. By
default the
directory is a single module, and every WAR or EJB jar deployment is also a separate
EAR/lib
module. Sub deployments (wars and ejb-jars) always have a dependency on the parent module, which gives
them access to classes in
, however they do not always have an automatic dependency on each
EAR/lib
other. This behaviour is controlled via the
 setting in the ee subsystem
ear-subdeployments-isolated
configuration: 
<subsystem xmlns="urn:jboss:domain:ee:1.0" >            
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
</subsystem>
By default this is set to false, which allows the sub-deployments to see classes belonging to other
sub-deployments within the .ear.
For example, consider the following .ear deployment:
JBoss AS 7.1
JBoss Community Documentation
Page
of
21
415
myapp.ear
|
|--- web.war
|
|--- ejb1.jar
|
|--- ejb2.jar
If the ear-subdeployments-isolated is set to false, then the classes in web.war can access classes belonging
to ejb1.jar and ejb2.jar. Similarly, classes from ejb1.jar can access classes from ejb2.jar (and vice-versa).
The ear-subdeployments-isolated element value has no effect on the isolated classloader of the
.war file(s). i.e. irrespective of whether this flag is set to true or false, the .war within a .ear will have
an isolated classloader and other sub-deployments within that .ear will not be able to access
classes from that .war. This is as per spec.
If the ear-subdeployments-isolated is set to true then no automatic module dependencies between the
sub-deployments are set up. User must manually setup the dependency with
entries, or by
Class-Path
setting up explicit module dependencies.
Portability
The Java EE specification says that portable applications should not rely on sub deployments
having access to other sub deployments unless an explicit Class-Path entry is set in the
MANIFEST.MF. So portable applications should always use Class-Path entry to explicitly state their
dependencies.
Class-Path: /X:/libs/libFile.jar
It is also possible to override the ear-subdeployments-isolated element value at a per deployment
level. See the section on jboss-deployment-structure.xml below.
Dependencies:
 Manifest Entries
Deployments (or more correctly modules within a deployment) may set up dependencies on other modules
by adding a
manifest entry. This entry consists of a comma separated list of module
Dependencies:
names that the deployment requires. The available modules can be seen under the
directory in the
modules
application server distribution. For example to add a dependency on javassist and apache velocity you can
add a manifest entry as follows:
Dependencies: org.javassist export,org.apache.velocity export services,org.antlr
JBoss AS 7.1
JBoss Community Documentation
Page
of
22
415
Each dependency entry may also specify some of the following parameters by adding them after the module
name:
This means that the dependencies will be exported, so any module that depends on this
export
module will also get access to the dependency.
By default items in META-INF of a dependency are not accessible, this makes items from
services
accessible so
in the modules can be loaded.
META-INF/services
services
If this is specified the deployment will not fail if the module is not available.
optional
If a jandex index has be created for the module these annotations will be merged into
annotations
the deployments annotation index. The
index can be generated using the
,
Jandex
Jandex ant task
and must be named
. Note that it is not necessary to break open the jar
META-INF/jandex.idx
being indexed to add this to the modules class path, a better approach is to create a jar containing
just this index, and adding it as an additional resource root in the
file.
module.xml
Adding a dependency to all modules in an EAR
Using the
parameter it is possible to add a dependency to all sub deployments in an ear. If
export
a module is exported from a
entry in the top level of the ear (or by a jar in the
Dependencies:
directory) it will be available to all sub deployments as well.
ear/lib
To generate a MANIFEST.MF entry when using maven put the following in your pom.xml:
pom.xml
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.slf4j</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
If your deployment is a jar you must use the
rather than the
maven-jar-plugin
.
maven-war-plugin
JBoss AS 7.1
JBoss Community Documentation
Page
of
23
415
2
.
5
.
1

Class Path Entries
It is also possible to add module dependencies on other modules inside the deployment using the
manifest entry. This can be used within an ear to set up dependencies between sub
Class-Path
deployments, and also to allow modules access to additional jars deployed in an ear that are not sub
deployments and are not in the
directory. If a jar in the
directory references a jar via
EAR/lib
EAR/lib
then this additional jar is merged into the parent ear's module, and is accessible to all sub
Class-Path:
deployments in the ear. 
2
.
6

Global Modules
It is also possible to set up global modules, that are accessible to all deployments. This is done by modifying
the configuration file (standalone/domain.xml).
For example, to add javassist to all deployments you can use the following XML:
standalone.xml/domain.xml
<subsystem xmlns="urn:jboss:domain:ee:1.0" >            
<global-modules>
<module name="org.javassist" slot="main" />            
</global-modules> 
</subsystem>
Note that the
field is optional and defaults to
.
slot
main
2
.
7

JBoss Deployment Structure File
is a JBoss specific deployment descriptor that can be used to
jboss-deployment-structure.xml
control class loading in a fine grained manner. It should be placed in the top level deployment, in
META-INF
(or
for web deployments). It can do the following:
WEB-INF
Prevent automatic dependencies from being added
Add additional dependencies
Define additional modules 
Change an EAR deployments isolated class loading behaviour
Add additional resource roots to a module
An example of a complete
file for an ear deployment is as follows:
jboss-deployment-structure.xml
jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<!-- Make sub deployments isolated by default, so they cannot see each others classes without
a Class-Path entry -->
JBoss AS 7.1
JBoss Community Documentation
Page
of
24
415
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an
ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder
-->
<deployment>
<!-- exclude-subsystem prevents a subsystems deployment unit processors running on a
deployment -->
<!-- which gives basically the same effect as removing the subsystem, but it only affects
single deployment -->
<exclude-subsystems>
<subsystem name="resteasy" />
</exclude-subsystems>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies
-->
<exclusions>
<module name="org.javassist" />
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as using the
Dependencies: manifest attribute -->
<dependencies>
<module name="deployment.javassist.proxy" />
<module name="deployment.myjavassist" />
<!-- Import META-INF/services for ServiceLoader impls as well -->
<module name="myservicemodule" services="import"/>
</dependencies>
<!-- These add additional classes to the module. In this case it is the same as including
the jar in the EAR's lib directory -->
<resources>
<resource-root path="my-library.jar" />
</resources>
</deployment>
<sub-deployment name="myapp.war">
<!-- This corresponds to the module for a web deployment -->
<!-- it can use all the same tags as the <deployment> entry above -->
<dependencies>
<!-- Adds a dependency on a ejb jar. This could also be done with a Class-Path entry -->
<module name="deployment.myear.ear.myejbjar.jar" />
</dependencies>
<!-- Set's local resources to have the lowest priority -->
<!-- If the same class is both in the sub deployment and in another sub deployment that -->
<!-- is visible to the war, then the Class from the other deployment will be loaded, -->
<!-- rather than the class actually packaged in the war. -->
<!-- This can be used to resolve ClassCastExceptions if the same class is in multiple sub
deployments-->
<local-last value="true" />
</sub-deployment>
<!-- Now we are going to define two additional modules -->
<!-- This one is a different version of javassist that we have packaged -->
<module name="deployment.myjavassist" >
<resources>
<resource-root path="javassist.jar" >
<!-- We want to use the servers version of javassist.util.proxy.* so we filter it out-->
<filter>
<exclude path="javassist/util/proxy" />
</filter>
</resource-root>
</resources>
JBoss AS 7.1
JBoss Community Documentation
Page
of
25
415
</module>
<!-- This is a module that re-exports the containers version of javassist.util.proxy -->
<!-- This means that there is only one version of the Proxy classes defined -->
<module name="deployment.javassist.proxy" >
<dependencies>
<module name="org.javassist" >
<imports>
<include path="javassist/util/proxy" />
<exclude path="/**" />
</imports>
</module>
</dependencies>
</module>
</jboss-deployment-structure>
The xsd for jboss-deployment-structure.xml is available at
https://github.com/jbossas/jboss-as/blob/master/build/src/main/resources/docs/schema/jboss-deployment-structure-1_2.xsd
2
.
8

Accessing JDK classes
Not all JDK classes are exposed to a deployment by default. If your deployment uses JDK classes that are
not exposed you can get access to them using jboss-deployment-structure.xml with system dependencies:
Using jboss-deployment-structure.xml to access JDK classes
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<system export="true">
<paths>
<path name="com/sun/corba/se/spi/legacy/connection"/>
</paths>
</system>
</dependencies>
</deployment>
</jboss-deployment-structure>
JBoss AS 7.1
JBoss Community Documentation
Page
of
26
415
3

Implicit module dependencies for deployments
As explained in the
article, JBoss AS7 is based on module classloading. A class within
ClassLoading in AS7
a module B isn't visible to a class within a module A, unless module B adds a dependency on module A.
Module dependencies can be explicitly (as explained in that classloading article) or can be "implicit". This
article will explain what implicit module dependencies mean and how, when and which modules are added
as implicit dependencies.
3
.
1

What's an implicit module dependency?
Consider an application deployment which contains EJBs. EJBs typically need access to classes from the
javax.ejb.* package and other Java EE API packages. The jars containing these packages are already
shipped in JBoss AS and are available as "modules". The module which contains the javax.ejb.* classes has
a specific name and so does the module which contains all the Java EE API classes. For an application to
be able to use these classes, it has to add a dependency on the relevant modules. Forcing the application
developers to add module dependencies like these (i.e. dependencies which can be "inferred") isn't a
productive approach. Hence, whenever an application is being deployed, the deployers within the server,
which are processing this deployment "implicitly" add these module dependencies to the deployment so that
these classes are visible to the deployment at runtime. This way the application developer doesn't have to
worry about adding them explicitly. How and when these implicit dependencies are added is explained in the
next section.
JBoss AS 7.1
JBoss Community Documentation
Page
of
27
415
3
.
2

How and when is an implicit module dependency
added?
When a deployment is being processed by the server, it goes through a chain of "deployment processors".
Each of these processors will have a way to check if the deployment meets a certain criteria and if it does,
the deployment processor adds a implicit module dependency to that deployment. Let's take an example -
Consider (again) an EJB3 deployment which has the following class:
MySuperDuperBean.java
@Stateless
public class MySuperDuperBean {
...
}
As can be seen, we have a simple @Stateless EJB. When the deployment containing this class is being
processed, the EJB deployment processor will see that the deployment contains a class with the @Stateless
annotation and thus identifies this as a EJB deployment.
This is just one of the several ways, various
The EJB deployment
deployment processors can identify a deployment of some specific type.
processor will then add an implicit dependency on the Java EE API module, so that all the Java EE API
classes are visible to the deployment.
Some subsystems will always add a API classes, even if the trigger condition is not met. These are
listed separately below. 
In the next section, we'll list down the implicit module dependencies that are added to a deployment, by
various deployers within JBoss AS.
3
.
3

Which are the implicit module dependencies?
Subsystem
responsible
for adding
the implicit
dependency
Dependencies that are always
added
Dependencies that are added if a trigger
condition is met
JBoss AS 7.1
JBoss Community Documentation
Page
of
28
415
Core Server
javax.api 
sun.jdk
org.jboss.vfs
org.jboss.logging
org.apache.commons.logging
org.apache.log4j
org.slf4j
org.jboss.logging.jul-to-slf4j-stub
 
EE
Subsystem
javaee.api
 
EJB3
subsystem
 
javaee.api
JAX-RS
(Resteasy)
subsystem
javax.xml.bind.api
org.jboss.resteasy.resteasy-atom-provider 
org.jboss.resteasy.resteasy-cdi 
org.jboss.resteasy.resteasy-jaxrs 
org.jboss.resteasy.resteasy-jaxb-provider 
org.jboss.resteasy.resteasy-jackson-provider 
org.jboss.resteasy.resteasy-jsapi 
org.jboss.resteasy.resteasy-multipart-provider 
org.jboss.resteasy.async-http-servlet-30
JCA
sub-system
javax.resource.api
javax.jms.api 
javax.validation.api 
org.jboss.logging 
org.jboss.ironjacamar.api 
org.jboss.ironjacamar.impl 
org.hibernate.validator
JBoss AS 7.1
JBoss Community Documentation
Page
of
29
415
JPA
(Hibernate)
subsystem
javax.persistence.api
javaee.api
org.jboss.as.jpa
org.hibernate
org.javassist
SAR
Subsystem
 
org.jboss.logging
org.jboss.modules
Security
Subsystem
org.picketbox
 
Web
Subsystem
 
javaee.api
com.sun.jsf-impl
org.hibernate.validator
org.jboss.as.web
org.jboss.logging
Web
Services
Subsystem
org.jboss.ws.api
org.jboss.ws.spi
 
Weld (CDI)
Subsystem
 
javax.persistence.api
javaee.api
org.javassist
org.jboss.interceptor
org.jboss.as.weld
org.jboss.logging
org.jboss.weld.core
org.jboss.weld.api
org.jboss.weld.spi
JBoss AS 7.1
JBoss Community Documentation
Page
of
30
415
4

How do I migrate my application from JBoss AS
5 or AS 6 to JBoss AS 7?
The purpose of this guide is to document only those changes that are needed to successfully run and deploy
AS 5 applications on AS 7.It provides information on to resolve deployment and runtime problems and how
to prevent changes in application behaviour. This is the first step in moving to the new platform. Once the
application is successfully deployed and running on the new platform, plans can be made to upgrade
individual components to use the new functions and features of AS7.
4
.
1

Migration Overview
JBoss AS7 is structured differently from previous versions of JBoss AS, so you may want do a little research
before you attempt to migrate your application.
in the
Getting Started with JBoss Application Server 7
has a lot of useful information, including a table that lists the features that are
Getting Started Guide
supported in AS 7.0. If your application uses features that go beyond the Java Enterprise Edition 6 Web
Profile specification, you want to make sure you go with AS 7.1 or later (this is when AS7 became
EE6 Full
). You should also read 
for helpful information about how to
Profile compliant
Getting started with JBoss AS
install and run the application server.
The rest of this document describes some of the changes you might need to make to your application to
successfully deploy and run it on AS7.
Reminder
Before making any modifications to your application, make sure to create a backup copy.
JBoss AS 7.1
JBoss Community Documentation
Page
of
31
415
4
.
2

Update Application Dependencies Due to Class
Loading Changes
4
.
2
.
1

Modular class loading overview
Class loading in AS7 is considerably different than in previous versions of JBoss AS. Class loading is now
based on the
project. Instead of the more familiar hierarchical class loading environment,
JBoss Modules
AS7's class loading is based on modules that have to define explicit dependencies on other modules.
Deployments in AS7 are also modules, and do not have access to classes that are defined in jars in the
application server unless an explicit dependency on those classes is defined.
Even though in AS7 modules are isolated by default, as part of the deployment process some dependencies
on modules defined by the application server are set up for you automatically. For instance, if you are
deploying a Java EE application, a dependency on the Java EE API's will be added to your module
automatically. Similarly if your module contains a
file, a dependency on
will be added
beans.xml
Weld
automatically, along with any supporting modules that weld needs to operate. For a complete list of the
automatic dependencies that are added see 
.
Implicit module dependencies for deployments
JBoss AS 7.1
JBoss Community Documentation
Page
of
32
415
4
.
2
.
2

Understand module dependencies
The deployers within the server "implicitly" add some commonly used module dependencies, like the
javax.api and sun.jdk, to the deployment so that the classes are visible to the deployment at runtime. This
way the application developer doesn't have to worry about adding them explicitly. How and when these
implicit dependencies are added is explained in