upgrade jboss 42

25
27/11/2007 Upgrading to JBoss AS 4.2 Radim Marek 12/14/07

Upload: uday-kumar

Post on 10-Apr-2015

414 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Upgrade Jboss 42

27/11/2007

Upgrading to JBoss AS 4.2

Radim Marek

12/14/07

Page 2: Upgrade Jboss 42

Agenda

Objectives of this presentations

• Introduction

• Installation and administration

• EJB 3.0

• Web Services

• JavaServer Faces

Upgrading to JBoss 4.213/12/2007

Page 3: Upgrade Jboss 42

JBoss AS 4.2 - Introduction

Latest version of JBoss AS is 4.2.X

• Minor branch (originally not planned)

• Brings Java EE 5 specification into 4.X series, without need to wait for longexpected JBoss AS 5 (currently planned for Q1 2008).

• Provides support for RedHat branches (EAP) with guaranteed 5 years ofcommercial support

• Improves future upgrade process

Initial release of 4.2.0 is from May 2007, current bug fix release is 4.2.2

• 4.2.3 on its way

Upgrading to JBoss 4.213/12/2007

Page 4: Upgrade Jboss 42

JBoss AS 4.2 - Introduction

Other main features of this branch are

• Tomcat 6.0/JBossWeb included

• Latest implementation of EJB 3.0

• Integration of JavaServer Faces 1.2

• Support for JAX-WS 2.0 (JSR 224)

• JBoss Transaction (Arjuna) as the default transaction engine (JTA)

In addition there are many bug fixes and improvements.

Upgrading to JBoss 4.213/12/2007

Page 5: Upgrade Jboss 42

JBoss AS 4.2 - Introduction

JBoss AS 4.2 is mature product

• If you’re using any Java EE 5 technologies the upgrade is recommended

• The upgrade process is relatively straightforward

• Most of the changes are related to updated technologies mentioned in thisintroduction

Upgrading to JBoss 4.213/12/2007

Page 6: Upgrade Jboss 42

JBoss AS 4.2 - Installation and administration

Installation of JBoss AS 4.2 is still very simple

• Download the archive from http://labs.jboss.com/

• Extract it

• Run!

The structure of the extracted installation is still same

• 3 configuration profiles (minimal, default and all)

Upgrading to JBoss 4.213/12/2007

Page 7: Upgrade Jboss 42

JBoss AS 4.2 - Installation and administration

Major security related change affects default binding address!

• Before JBoss 4.2 default binding address was 0.0.0.0 (all interfaces)

• With JBoss 4.2 default binding address is 127.0.0.1 (localhost)

To achieve same behaviour as with JBoss AS before 4.2 use

• ./run.sh -b 0.0.0.0

It’s strongly recommended to secure installation before switching bind address!

Upgrading to JBoss 4.213/12/2007

Page 8: Upgrade Jboss 42

JBoss AS 4.2 - Installation and administration

Minimum requirement for running JBoss AS 4.2 is Java 5

• JDK 6 is not formally supported, and confilict related to JAX-RPC API causedproblems with the implementation of web services

• Recent update of JBossWS to 2.0.1 fixed this problem and the AS 4.2.2 (whichincluded this revision) should support JDK 6

• Further testing is recommended!

Upgrading to JBoss 4.213/12/2007

Page 9: Upgrade Jboss 42

JBoss AS 4.2 - Installation and administration

Changes to embedded technologies are reflected in administrators

• conf/log4j.xml renamed to conf/jboss-log4j.xml to allow custom libraries andapplications to use own log4j setting independent from the server

• Tomcat 6 is bundled as part of JBossWeb, deploy/jbossweb-tomcat55.sar hasbeen replaced by deploy/jboss-web.deployer

• Update of JBossWS (>1.0.x) made redundant custom extension JSE fordeployment WS endpoints nested in SAR files. Standard WAR files should be usedfor such a deployments (simple repackaged).

Upgrading to JBoss 4.213/12/2007

Page 10: Upgrade Jboss 42

JBoss AS 4.2 - EJB3

EJB 3.0 is included by default in JBoss AS 4.2

• Mature support still available for EJB 2.1 (If you don't need/want EJB3 support,simply remove deploy/ejb3.deployer).

• Used version is EJB 3.0 RC10 (final version to be part of AS 5)

Upgrade from previous release (available as plug-in) for 4.0 is simple

• From 4.0.5: No change required for EJB 3

• From 4.0.4: Annotation @EJB was still in package javax.annotation and needs tobe changed to javax.ejb

Upgrading to JBoss 4.213/12/2007

Page 11: Upgrade Jboss 42

JBoss AS 4.2 - EJB3

Current limitations of EJB 3.0 implementation in JBoss AS 4.2 include

• Unfinished alignment of the security constrains on different types of EJB objects inthe same way as it works for EJB 2.1

• EJB 3 web service endpoints can be only specified using annotations and notmetadata in XML file (fix already exists and will be included in release 4.2.3)

EJB 3.0 implementation is stable and already proven in many production deployments!

Upgrading to JBoss 4.213/12/2007

Page 12: Upgrade Jboss 42

JBoss AS 4.2 - EJB

To support easy integration with the legacy solutions developed using older JBoss ASlibraries the full support is included and test for AS version 3.2.8 and later!

More information available at

http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossVersionCompatibilityMatrix

Upgrading to JBoss 4.213/12/2007

Page 13: Upgrade Jboss 42

JBoss AS 4.2 - Web Services

Most visible change to JBoss 4.2 is related to Web Services implementation

• Implementation is JBossWS

• Current version is 2.0.1.SP2 (JBoss AS 4.2.2)

• Follows specification JAX-WS 2.0 (JSR 224)

Upgrading process can affect integration with other applications

• Not really JBoss fault!

• General misunderstanding of specification behind Web Services

Upgrading to JBoss 4.213/12/2007

Page 14: Upgrade Jboss 42

JBoss AS 4.2 - Web Services - background

Before addressing particular migration issues, it’s important to understand terminology!

JAX-WS 2.0 is current specification supported by JBossWS

• Java API for XML Web Services (JAX-WS)

• Part of Java EE 5

Replacing former specification JAX-RPC

• To reflect move from RPC-style to document-style endpoints

Upgrading to JBoss 4.213/12/2007

Page 15: Upgrade Jboss 42

JBoss AS 4.2 - Web Services - background

Differences between JAX-RPC and JAX-WS

• Different packages names (do not confused with Java packages!)

• JAX-RPC requires endpoint to extend java.rmi.Remote and can throwjava.rmi.RemoteException

• Change in uses of holder objects (using Java 5 generics)

No matter what specification the main specifications are still in use

• SOAP (version 1.2)

• WSDL (version 2.0)

Upgrading to JBoss 4.213/12/2007

Page 16: Upgrade Jboss 42

JBoss AS 4.2 - Web Services - background

Document style web services have got following advantages

• No type encoding information

• Schema to be used to validate document

• WS-I compliant

But there is one major drawbacks

• WSDL is getting complicated

Upgrading to JBoss 4.213/12/2007

Page 17: Upgrade Jboss 42

JBoss AS 4.2 - Web Services - background

More information available online

JBossWS WIKIhttp://jbws.dyndns.org/mediawiki/index.php?title=Articles_and_Specs

Sun Bloghttp://blogs.sun.com/trajesh/entry/migrating_from_jax_rpc_to

IBM JAX-RPC vs JAX-WS Articleshttp://www.ibm.com/developerworks/webservices/library/ws-tip-jaxwsrpc.html

Upgrading to JBoss 4.213/12/2007

Page 18: Upgrade Jboss 42

JBoss AS 4.2 - Web Services

Code level changes required for migration follows:

Following requirements for classes participating in Web Services

• Default constructor required (previously only for classes supposed to beconstructed by the remote side)

• Setters/getters required

To prevent problems always create regular Java Beans!

Upgrading to JBoss 4.213/12/2007

Page 19: Upgrade Jboss 42

JBoss AS 4.2 - Web Services

Major changes related to JBoss specific annotations (extending JSR 181)

Annotation @PortComponent is not supported

• Web context and security related metadata are now set using @WebContext

• Endpoint configuration now specified by @EndpointConfig

To make life a little bit more complicated

• @WebContext changed package from package org.jboss.ws.annotation toorg.jboss.wsf.spi.annotation (in JBossWS 2.0 ~ JBoss AS 4.2.2)

Upgrading to JBoss 4.213/12/2007

Page 20: Upgrade Jboss 42

JBoss AS 4.2 - Web Services

Before we can continue we have to focus on @WebContext a little bit more.

Automatic derivation of the web context root for the web services has changed

• No longer based on EAR or JAR file name

• Currently derived from class name

If multiple web services are deployed is not able to create single context

• There is no JAX-WS specification how to handle this situation

• Current workaround is to use @WebContext annotation and use single context forall deployed Web Services within your deployment

@WebContext(contextRoot=“/mywebservices”)

Upgrading to JBoss 4.213/12/2007

Page 21: Upgrade Jboss 42

JBoss AS 4.2 - Web Services

Changes described affect project build and deployment.

Different problems can occur during integration with existing

• Related to JAXB changes (Java Architecture for XML Binding)

Related to

• Capitalization of names, in newer version is decapitalized (override name with@XmlType)

• Passing parameters, previously marked as nillable or required by default (specifymaxOccurs=0 or nillable=true or required=true using @XmlType)

• Arrays are special and you can be forced to create special holder class (LongArrayfor example)

Upgrading to JBoss 4.213/12/2007

Page 22: Upgrade Jboss 42

JBoss AS 4.2 - Web Services

Due to problem mentioned earlier, all the changes can be made only as annotations!

Make sure you annotate your classes properly (remember: all participating classes)

• To control if serialization will occur on field or properties use annotation

javax.xml.bind.annotation.XmlAccessorType

Hopefully XML override will be available soon!

Upgrading to JBoss 4.213/12/2007

Page 23: Upgrade Jboss 42

JBoss AS 4.2 - JavaServer Faces

Upgraded to reference implementation of JSF 1.2

If your application relies on the default implementation, make following changes:

• Remove previous Unified Expression Language JAR file dependencies from yourapplication.xml

• If you’re using some components that can’t be pragmatically inserted into strictxhtml+xml documents, you need to change content type manually to text/html

• New schema to be used for your faces-config.xml

• Remove StartupServletContextListener from web.xml

Upgrading to JBoss 4.213/12/2007

Page 24: Upgrade Jboss 42

JBoss AS 4.2 - Conclusion

Upgrade is not complicated, if you follow changes in all related technologies.

• Hopefully this presentation will help you to understand the changes behind it

Upgrading to JBoss 4.213/12/2007

Page 25: Upgrade Jboss 42

BSG Overview12/14/07