Top Banner
CUSTOMER LOGO This slide format serves to call attention to a quote from a prominent customer, executive, or thought leader in regards to a particular topic.Name Title, Company Name
71

Partner Webcast – Weblogic for Developers - 12 July 2012

May 13, 2015

Download

Spiritual

Oracle Weblogic Server is the industry’s leading application server for deploying Java EE applications with support for new features for lowering cost of operations, improving performance and enhancing scalability.

But it’s also a great choice for the Java developers because of the differentiating capabilities that facilitate integration with other tools and frameworks, promote reusability and rapid redeployment of your applications.

During the webinar we’re explore these differentiation features in more detail.
Find out more at
https://blogs.oracle.com/imc/entry/partner_webcast_weblogic_for_developers
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Partner Webcast – Weblogic for Developers - 12 July 2012

CUSTOMER LOGO

“This slide format serves to call

attention to a quote from a prominent

customer, executive, or thought leader

in regards to a particular topic.”

• Name • Title, Company Name

Page 2: Partner Webcast – Weblogic for Developers - 12 July 2012

<Insert Picture Here>

Oracle Weblogic Server: the differentiation

features for the developers

Dmitry Nefedkin

Oracle ISV Migration Center FMW Consultant

[email protected]

Page 3: Partner Webcast – Weblogic for Developers - 12 July 2012

ISV Migration Center Team

• Who we Are ISV Migration Center Team is a team of senior technical consultants based

in Eastern and Central Europe and represents Oracle's technical investment for

partners.

• Mission Statement Enable partners to rapidly and successfully adopt and implement

Oracle latest technology

• What do we Offer Whether you are selling Oracle technology, building business

solutions, including hosted Internet solutions or providing system integration and

implementation services for Oracle technology, IMC Team can help you succeed.

• How can we assist We offer a wide range of free services for partners such as one2one

assistance, webinars, seminars and hands-on workshops.

Our blog: http://blogs.oracle.com/imc

Contacts:

Thanos Terentes Printzios ([email protected] )

ISV Migration Center Manager, ECEMEA

Page 4: Partner Webcast – Weblogic for Developers - 12 July 2012

<Insert Picture Here>

Agenda

• Weblogic for Developers Overview

• Java standards supported by Oracle

Weblogic

• Classloading in Weblogic

• Weblogic integration with Apache Maven

• Advanced deployment features

• Spring Framework support in Weblogic

• Useful links

Page 5: Partner Webcast – Weblogic for Developers - 12 July 2012

User Engagement

Identity Management & Security

Business Process Management

Content Management

Business Intelligence

Service Integration Data Integration

Development Tools

Enterprise Management

Web Social Mobile

Cloud Application Foundation

Traffic Director

Exalogic Elastic Cloud Oracle Public

Cloud

Oracle Cloud Application Foundation Foundation for Oracle Fusion Middleware in the Cloud

Cloud Application Foundation

WebLogic Server

Coherence Tuxedo

Page 6: Partner Webcast – Weblogic for Developers - 12 July 2012

Modern Development with WebLogic

Server 12c Development Tooling, Maven, Spring, Classloading, Open Source …

• Java EE 6 Full Profile Certified

• Standard Java IDE Support

• Deeper Maven Integration

• Built in Java VM Flight Recorder/Diagnostics

• GlassFish DD Support on WebLogic

• Latest Spring Framework 3.0.x Support

• Built in Classloading Analysis Tool (CAT)

CAT

Page 7: Partner Webcast – Weblogic for Developers - 12 July 2012

<Insert Picture Here>

Agenda

• Weblogic for Developers Overview

• Java standards supported by Oracle

Weblogic

• Classloading in Weblogic

• Weblogic integration with Apache Maven

• Advanced deployment features

• Spring Framework support in Weblogic

• Useful links

Page 8: Partner Webcast – Weblogic for Developers - 12 July 2012

8

WebLogic Server 11g – standards

supported Java EE 5.0 and Java SE 6.0 • Standards Compliant

• Certified JEE 5.0 Compatible

• Latest version: JPA 2.0 & JSF 2.0 compliant

• High Performance

• Advanced Security

• Enterprise Messaging

• Web Services

• Integrated Operations & Administration

• Integrated, Productive Development Tools

• Open Source Certified √ Java EE Management 1.1

√ Java EE Deployment 1.2

√ JMX 1.2

√ JTA 1.1

√ JCA 1.5

√ JNDI 1.2

√ JMS 1.1

√ JAX-WS 2.1

√ EJB 3.0

√ Servlet 2.5

√ JSF 1.2, 2.0

√ JSP 2.1

√ JDBC 4.0 √

5.0 Java EE

6.0 Java SE

Java Standard Support

Page 9: Partner Webcast – Weblogic for Developers - 12 July 2012

9

Weblogic Server 11g – limited Java EE6

Support (since 10.3.4)

• Support for JSF 2.0

• Support for JPA 2.0

• Uses the JPA 2.0 reference implementation via

Oracle TopLink /EclipseLink

• Supported by Oracle Enterprise Pack for Eclipse

• Adds more mapping capabilities and options

• Optimistic AND pessimistic locking

• Criteria API for Java API-based queries

• Support for JAX-RS 1.1

• Uses the Jersey 1.1 reference implementation

• RESTful Web Services support - simple client/server Web Services

using stateless protocol (HTTP)

• Update web.xml to delegate requests to Jersey Servlet, add JAX-RS

annotations and the REST is easy

Page 10: Partner Webcast – Weblogic for Developers - 12 July 2012

10

Weblogic 12c – full Java EE 6 support

• API Pruning

• Standards-based dependency injection

• Handle simple to complex with no external dependencies

Flexible & Lightweight

• Embrace open source frameworks

• Enable Drag & Drop framework installation

• Standards-based DI extensions don’t create proprietary lock-in

Extensible

• POJO Programming Model

• More annotations, better IDE support

• Less XML configuration, more convention

• Annotations, not deployment descriptors

Developer Productivity

Page 11: Partner Webcast – Weblogic for Developers - 12 July 2012

11

Major New Updates in Java EE 6

* Based on a Sample POJO/JPA/REST Based Application Built for JavaOne

• Less XML, Less Code

• Java Server Faces 2.0

• Java Servlets 3.0

• Java Persistence 2.0

• Enterprise Java Beans 3.1 & Interceptors 1.1

Lines of Code* Lines of XML* Java Classes*

25%

Less

50%

Less

80%

Less

• Simplification, Productivity

• Managed Beans 1.0

• Bean Validation 1.0

• JAX-WS 2.2

• Modernization

• Context & Dependency Injection 1.0

• Bean Validation 1.0

• Java API for RESTful Web Services

Page 12: Partner Webcast – Weblogic for Developers - 12 July 2012

12

Java SE 7: Cleaner, More Maintainable

Code

• Oracle WebLogic Server 12c supports Java SE 7 (and Java SE 6)

• Java language optimizations

• Client and server support

• Internationalization

• SSL/TLS 1.2 in JSSE

• Converged Java VM

Page 13: Partner Webcast – Weblogic for Developers - 12 July 2012

13

Try Java EE6 - pre-built Weblogic VM

http://www.oracle.com/technetwork/community/developer-vm/index.html

Page 14: Partner Webcast – Weblogic for Developers - 12 July 2012

14

<Insert Picture Here>

Agenda

• Weblogic for Developers Overview

• Java standards supported by Oracle

Weblogic

• Classloading in Weblogic

• Weblogic integration with Apache Maven

• Advanced deployment features

• Spring Framework support in Weblogic

• Useful links

Page 15: Partner Webcast – Weblogic for Developers - 12 July 2012

How Java loads classes

Is Class loaded?

Ask Parent Classloader

Check my classpath

Page 16: Partner Webcast – Weblogic for Developers - 12 July 2012

WebLogic ClassLoader Hierarchy Top-Down Class Loading (Default)

WEB APP

APPLICATION

DOMAIN

SYSTEM

SYSTEM ClassLoader loads:

•WebLogic Implementation classes •Classes on the System Classpath

•PRE_CLASSPATH and EXT_PRE_CLASSPATH

DOMAIN ClassLoader loads: •Classes from <domain_dir>/lib

APPLICATION ClassLoader loads: •Java EE Shared Libraries referenced in weblogic-application.xml •Any Modules defined in the application •Libraries from Java EE 5 <library-directory> directive or /lib if none configured •Libraries from <EAR>/APP-INF/lib

WEB APP ClassLoader loads: •Java EE Shared Libraries referenced in weblogic.xml •WEB-INF/classes •WEB-INF/lib

•Enables Servlets and JSPs to see EJB classes •Enables redeployment of Web Apps w/o redeploying EJBs

Page 17: Partner Webcast – Weblogic for Developers - 12 July 2012

APPLICATION

WEB APP

WebLogic Filtering ClassLoader Force classes to be loaded from the APPLICATION

• The FilteringClassLoader mechanism allows you to specify classes

that should always be loaded from the application (not the SYSTEM

ClassLoader)

• This allows you to use alternate versions of applications, such

as Xerces and Ant, than those that are packed with WebLogic

• Enables resources from the child of the FilteringClassLoader (an

Application classloader) down to the calling classloader are returned

before the ones from the system classloader

• The FilteringClassLoader is configured with a list of packages

specified in weblogic-application.xml or weblogic.xml (introduced in

10.3.3) files.

FILTERING

ClassLoader

SYSTEM

DOMAIN

Page 18: Partner Webcast – Weblogic for Developers - 12 July 2012

Filtering ClassLoader Configuration Specify Packages to load from APP-INF/lib & WEB-INF/lib

• Specify the packages that should be loaded by the Application

including:

• Java EE Shared Libraries

• EAR: /lib (preferred)

• EAR: APP-INF/lib

• WAR: WEB-INF/lib

• Overrides the classes that are loaded with WebLogic allowing

you to use libraries that may conflict with those included in

WebLogic

Page 19: Partner Webcast – Weblogic for Developers - 12 July 2012

<prefer-application-packages>

(Recommended)

Allows a Web Application to use its

own third-party libraries from WEB-

INF/lib by specifying certain

packages that should always be

loaded from the Web Application

<prefer-web-inf-classes>

Allows a Web application to use its

own version third-party classes

from WEB-INF/classes, which

might also be part of WebLogic

Server

• There are two options for configuring the classloader in at the Web

Application level

• <container-descriptor> / <prefer-application-packages>

• <container-descriptor> / <prefer-web-inf-classes>

• Only one of these options can be used at a time

• Oracle recommends using <prefer-application-packages> to configure

the FilteringClassLoader

Web Filtering ClassLoader Configuration Load Classes from WEB-INF

Page 20: Partner Webcast – Weblogic for Developers - 12 July 2012

Custom ClassLoader Structure

• Defined in weblogic-application.xml

• Custom classloader hierarchies allow better

control over class visibility and reload-ability

• The ability to create custom module

ClassLoaders provides a mechanism to declare

alternate classloader organizations that allow

the following:

• Reloading individual EJB modules independently

• Reloading groups of modules to be reloaded

together

• Reversing the parent child relationship between

specific Web modules and EJB modules

• Namespace separation between EJB modules

Advanced Configuration for Reloading Classes

Page 21: Partner Webcast – Weblogic for Developers - 12 July 2012

WebLogic ClassLoader Analysis Tool NEW in WebLogic 11gR1 (10.3.4)

• Available at http://<wls_host>:<wls_port>/wls-cat

• Application provided libraries can collide with 3rd party

libraries used by WebLogic Server

• Hard to diagnose class and library conflicts

• Filtering Classloader feature enables applications to use

their own libraries

• Correctly configuring it can be a challenge

• Classloader Analysis Tool Helps Identify and Resolve

Conflicts Quickly

• CAT cracks open the classloader black box

• Displays classloaders’ hierarchies and sources

• Allows you to search for a class/resource on a classloader

• Views class definitions, interfaces

• Analyzes classpath conflicts, generates corresponding

filtering classloader configuration

CAT

Page 22: Partner Webcast – Weblogic for Developers - 12 July 2012

Analyze Classpath Conflicts WebLogic 10.3.4 ClassLoader Analysis Tool

• The ClassLoader Analysis tool shows you where the class

conflicts are

• This allows you to

see the conflicting

libraries, where

they are located

and allows you to

decide how to

resolve it

Page 23: Partner Webcast – Weblogic for Developers - 12 July 2012

ClassLoader Configuration Suggestion WebLogic 10.3.4 ClassLoader Analysis Tool

• The ClassLoader Analysis tool

provides the XML

configuration necessary for

configuring the Filtering

ClassLoader

• This significantly eases the

configuration required to take

advantage of this advanced

feature

• Only available in WebLogic

10.3.4 and later

Page 24: Partner Webcast – Weblogic for Developers - 12 July 2012

Library Packaging vs Referencing/Linking

• Packaging:

• Include JAR files in WEB-INF/lib

• Include EJB-JAR and WAR files in EAR

• Include JAR files in APP-INF/lib

• Or in <library-directory> specified in application.xml

• Referencing / Linking

• Java EE Shared Libraries

Enterprise Archives and Shared Libraries

Page 25: Partner Webcast – Weblogic for Developers - 12 July 2012

Java EE Shared Libraries

• Shared Libraries can be packaged as EAR, WAR

or JAR files

• META-INF/MANIFEST.MF must contain:

• Extension-Name

• Specification-Version

• Implementation-Version

Packaging

Page 26: Partner Webcast – Weblogic for Developers - 12 July 2012

Java EE Shared Libraries Shared Library Deployment

Page 27: Partner Webcast – Weblogic for Developers - 12 July 2012

Java EE Shared Libraries Referencing from the application

Referencing Application uses

Deployment Descriptors to link

the shared libraries to the

application at deployment time JAR/WAR Modules

JAR Libraries

application.xml

weblogic-

application.xml

Page 29: Partner Webcast – Weblogic for Developers - 12 July 2012

29

<Insert Picture Here>

Agenda

• Weblogic for Developers Overview

• Java standards supported by Oracle

Weblogic

• Classloading in Weblogic

• Weblogic integration with Apache Maven

• Advanced deployment features

• Spring Framework support in Weblogic

• Useful links

Page 30: Partner Webcast – Weblogic for Developers - 12 July 2012

30

What is Maven

• An Apache open source project

• Maven is:

• An automated build system +

• A project management system +

• A library and dependency handling system +

• A project description system +

• A site generation system +

• …

• Mature

• Maven 1.0 2004

• Maven 2.0 2005

• Maven 3.0 end 2010

Maven is a project management tool which encompasses a project object model, a set of standards, a project lifecycle, a dependency management system, and logic for executing plugin goals at defined phases in a lifecycle.

When you use Maven, you describe your project using a well-defined project object model, Maven can then apply cross-cutting logic from a set of shared (or custom) plugins.

Jason Van Zyl, Sonatype

Page 31: Partner Webcast – Weblogic for Developers - 12 July 2012

31

Primary Maven Concepts

• Project Object Model (POM)

• A project is the fundamental unit of work in the Maven universe

• The POM describes the project, its name/version, type, dependencies,

etc.

• Portable!

• Convention over Configuration

• Sensible default behaviours for projects

• Standard directory layout for project, no configuration necessary, no

path settings required

• Enables automation of build and packaging process

• Use default directories to locate resources, sources, tests, generate

classes, packages

• Well defined project lifecycle

Understanding Apache Maven

Page 32: Partner Webcast – Weblogic for Developers - 12 July 2012

32

Maven Build Lifecycle, Phases and Goals

• Maven 2.0 is based around the central concept of a build lifecycle

• The process for building and distributing a particular artifact (project) is clearly

defined

• Only necessary to learn a small set of commands to build any Maven project,

the POM ensures the project is built correctly

• default, clean, site

• Build lifecycles are further defined by a set of build phases

• A build phase represents a stage in the lifecycle

• Executed sequentially to complete the default lifecycle

• Build phase made up of goals

• Phases are composed of goals that perform actual tasks

• Default goal bindings for standard lifecycle phases

• Plugins contribute additional goals to project

Understanding Apache Maven

Page 33: Partner Webcast – Weblogic for Developers - 12 July 2012

33

Maven Default Lifecycle

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

validate: ensure the project is correct and all necessary information is available

compile: compile the source code of the project

test: test the compiled source code using a suitable unit testing framework; tests should not require the code be packaged or deployed

package: take the compiled code and package it in its distributable format, such as a JAR, WAR, etc.

integration-test: process and deploy the package if necessary into an environment where integration tests can be run

verify: run checks to verify the package is valid and meets quality criteria

install: install the package into the local repository, for use as a dependency in other projects locally

deploy: for final release, copies the final package to the remote repository for sharing with other developers and projects.

Page 34: Partner Webcast – Weblogic for Developers - 12 July 2012

34

Primary Maven Concepts - Repositories

• A Maven repository holds: • Build artifacts, Dependencies & Plugins

• Two strict types of repositories • Local

• Remote

• Maven automatically looks in remote repositories for missing dependencies/plugins declared in a project

• Default PUBLIC repository is Maven Central • http://repo1.maven.org/maven2/

• Additional PUBLIC repositories can be easily defined • Java repository: http://download.java.net/maven/2/

Locating Dependencies and Plugins

Page 35: Partner Webcast – Weblogic for Developers - 12 July 2012

35

Primary Maven Concepts - Dependencies

• Maven looks for dependencies using: • Group Id / Artifact Id / Version

• Dependencies can be scoped for: • Compile / Test / Packaging / Runtime

• Maven automatically manages the download of declared dependencies in a project

• Obtained from public and/or corporate repositories

• Stored in local repository for next use

• Declare dependencies, no need to ship libraries with project

Dependency Specification & Management

<dependencies>

<dependency>

<groupId>com.oracle.weblogic

</groupId>

<artifactId>weblogic-

full</artifactId>

<version>12.1.1</version>

<scope>compile</scope>

</dependency>

...

</dependencies>

Page 36: Partner Webcast – Weblogic for Developers - 12 July 2012

36

Primary Maven Concepts - Plugins

• Plugins perform the work in the Maven ecosystem

• Default set of plugins exists from Apache

• Bound to lifecycles and phases

• Examples: Compile, JAR, WAR, etc.

• Declaratively configured

• Similar model to Project dependencies/libraries

• Automated download if hosted in public repository

• Can be manually installed

• Can be executed as standalone goals

• mvn wls:deploy

• Can be bound to execute for a given lifecycle/phase

• mvn deploy

Extending Maven Behaviour with Plugins

<plugins>

<plugin>

<groupId>org.apache.maven.plugins

</groupId>

<artifactId>maven-compiler-

plugin</artifactId>

<version>2.0.2</version>

<configuration>

<source>1.6</source>

<target>1.6</target>

</configuration>

</plugin>

</plugins>

Page 37: Partner Webcast – Weblogic for Developers - 12 July 2012

37

WebLogic Server Maven Support Overview

• Introduced with WebLogic Server 11g R1 PS3 (10.3.4)

supporting Application Deployment operations

• Maven Mojo + WebLogic Deployer + WebLogic Client

• Supported Deployment Lifecycle operations: list-apps,

deploy/undeploy, start, stop and update

• WebLogic 12c (12.1.1) provides additional functionality

since the 11g release

• Installation of Weblogic ZIP Distribution onto a machine where

WebLogic has not been installed

• WebLogic Domain Creation

• Start/Stop WebLogic Servers

• Execute WLST Scripts

Page 38: Partner Webcast – Weblogic for Developers - 12 July 2012

38

Installing the WebLogic Maven Plugin

• Use Maven install:install-file goal to install the wls-maven-

plugin.jar library

• Use $WL_HOME/server/lib/pom.xml to specify Group ID,

Artifact ID and Version

• The install:install-file will install the plugin into your local

repository

• Alternatively deploy:deploy-file can be used to deploy the

plugin to a remote repository

WebLogic-Maven Plugin

$ mvn install:install-file –Dfile=$WL_HOME/server/lib/wls-maven-plugin.jar

–DpomFile=$WL_HOME/server/lib/pom.xml

Page 39: Partner Webcast – Weblogic for Developers - 12 July 2012

39

Configure WebLogic Maven Plugin

• WebLogic Maven Plugin needs to be configured as a plugin for a project to enable it to be used

<project> <build> <plugins> <plugin>

• Specify WebLogic Server Credentials – defaults can be used for the rest!

Maven pom.xml Configuration

<build>

<plugins>

<plugin>

<groupId>com.oracle.weblogic</groupId>

<artifactId>wls-maven-

plugin</artifactId>

<version>12.1.1.0</version>

<configuration>

<user>weblogic</user>

<password>welcome1</password>

</configuration>

</plugin>

</plugins>

</build>

Parameter Default Value

adminURL t3://127.0.0.1:7001

name ${project.build.finalName}

source ${project.build.directory}/

${project.build.finalName}.${project.packaging}

domainHome ./Oracle/domains/mydomain

middlewareHome ./Oracle/Software

Page 40: Partner Webcast – Weblogic for Developers - 12 July 2012

40

Deploying Applications with Maven

• Deploy applications after they are packaged. Defaults: • Application Name: ${project.build.finalName} (ArtifactId-Version)

• Source: ${project.build.directory}/${project.build.finalName}.${project.packaging}

• Target: AdminServer

• Common weblogic.Deployer properties used: • stage / nostage

• remote

• upload

• userConfigFile / userKeyFile (for obfuscating the login password)

WebLogic-Maven Plugin

$ mvn wls:deploy

Page 41: Partner Webcast – Weblogic for Developers - 12 July 2012

41

Re-Deploying Applications with Maven

• Redeploy already deployed applications to same or new targets

• Key Defaults:

• Application Name: ${project.build.finalName} (ArtifactId-

Version)

• Target: AdminServer

WebLogic-Maven Plugin

$ mvn wls:redeploy

Page 42: Partner Webcast – Weblogic for Developers - 12 July 2012

42

Un-Deploying Applications with Maven

• Un-Deploy applications

• Key Defaults:

• Application Name: ${project.build.finalName} (ArtifactId-

Version)

• Common weblogic.Deployer parameters:

• timeout

• verbose

• graceful

WebLogic-Maven Plugin

$ mvn wls:undeploy

Page 43: Partner Webcast – Weblogic for Developers - 12 July 2012

43

WebLogic Zip Distribution &

WLS:INSTALL goal

• The WebLogic Zip Distribution can be downloaded from OTN

• The WebLogic Zip distribution is required to use the wls:install goal

• Can be made available via:

• A local/remote Maven Repo

• A filesystem

• An HTTP URL

164MB WebLogic Distribution

Page 44: Partner Webcast – Weblogic for Developers - 12 July 2012

44

Installing the WebLogic Zip Distribution

into your Local Repository

• The WebLogic ZIP Distribution must be available in your local

repository or a remote repository

• Install the WebLogic ZIP Distribution into your local repository

using the Maven install:install-file goal

$ mvn install:install-file -Dfile=wls1211_dev.zip

-DgroupId=com.oracle.weblogic

-DartifactId=wls-dev

-Dpackaging=zip

-Dversion=12.1.1.0

Page 45: Partner Webcast – Weblogic for Developers - 12 July 2012

45

Installing WebLogic using the ZIP Distribution

• Install WebLogic Zip Distribution using:

• A Maven repository (com.oracle.weblogic:wls-

dev:zip:12.1.1.0)

• An HTTP URL

• A filesystem path

• Key Defaults:

• Middleware Home: ${project.directory}/Oracle/Software

WebLogic-Maven Plugin

$ mvn wls:install –DartifactLocation=[Maven Artifact | HTTP URL | File Path]

Page 46: Partner Webcast – Weblogic for Developers - 12 July 2012

46

Creating a WebLogic Domain

• Create a WebLogic Domain

• Using the default template

• OR Specify a custom template

• Key Defaults

• Domain Home:

${project.directory}/Oracle/Domains/myDomain

• Domain Template: none – default Domain with Admin Server

WebLogic-Maven Plugin

$ mvn wls:create-domain –DdomainTemplate=src/main/wls/myTemplate.jar

–DdomainHome=target/domain

Page 47: Partner Webcast – Weblogic for Developers - 12 July 2012

47

Start a WebLogic Server Instance

• Starts the AdminServer for a WebLogic Domain

• Can Start Managed Servers by overriding the ‘command’

parameter

• Key Defaults:

• Domain Home:

${project.directory}/Oracle/Domains/myDomain

• Middleware Home: ${project.directory}/Oracle/Software

WebLogic-Maven Plugin

$ mvn wls:start-server

Page 48: Partner Webcast – Weblogic for Developers - 12 July 2012

48

Execute WLST using Maven

• Execute a WLST script

• propertiesFile – optional Java properties file passed as

command-line Java parameters

• Online or Offline

• Execute multiple scripts using multiple plugin declarations or

commands

WebLogic-Maven Plugin

$ mvn wls:wlst –DfileName=src/main/wlst/createDatasource.py

–DpropertiesFile=src/main/resources/dev.properties

Page 49: Partner Webcast – Weblogic for Developers - 12 July 2012

49

Stop a WebLogic Server Instance

• Stops the AdminServer for a WebLogic Domain

• Can Stop Managed Servers by overriding the ‘command’

parameter

• Key Defaults:

• Domain Home:

${project.directory}/Oracle/Domains/myDomain

• Middleware Home: ${project.directory}/Oracle/Software

WebLogic-Maven Plugin

$ mvn wls:stop-server

Page 50: Partner Webcast – Weblogic for Developers - 12 July 2012

50

Associating WebLogic tasks w/

Maven Phases

• Maven plugin goals can be bound to a Maven phase to

execute during that phase

• Useful for automating deployment of target application

to a server for testing as part of Maven lifecycle

• Use the <executions> section of the <plugin> tag to

specify the target phase and the goal(s) to execute

Pre-Integration-Test: install, create-domain, start-server, deploy

Integration-Test: <exec tests>

Post-Integration-Test: undeploy, stop-server, clean

Page 52: Partner Webcast – Weblogic for Developers - 12 July 2012

52

<Insert Picture Here>

Agenda

• Weblogic for Developers Overview

• Java standards supported by Oracle

Weblogic

• Classloading in Weblogic

• Weblogic integration with Apache Maven

• Advanced deployment features

• Spring Framework support in Weblogic

• Useful links

Page 53: Partner Webcast – Weblogic for Developers - 12 July 2012

53

FastSwap

• WebLogic’s FastSwap feature is:

• Enabled using the WebLogic deployment descriptors

• Available only if the domain is not running in production

mode

• Applicable only to Web applications that are not archived

• When enabled:

• WebLogic automatically reloads the modified Java class

files within applications

• Developers can perform iterative development without an

explicit redeployment

• FastSwap configuration:

• weblogic.xml:

<fast-swap>true</fast-swap>

Page 54: Partner Webcast – Weblogic for Developers - 12 July 2012

54

Production Redeployment Side by Side Deployment

• Multiple application versions can co-exist

• New client requests are routed to active version;

• Existing client requests can finish up with existing version

• Automatic Retirement Policy: Graceful, Timeout

• Test application version before opening up for business

• Rollback to previous application version

• Two versions of the application can be active at any given point of time

Page 55: Partner Webcast – Weblogic for Developers - 12 July 2012

55

Production Redeployment

• To support the production redeployment strategy, Oracle

WebLogic Server now recognizes a unique version string entry (max 215 characters long) in the Enterprise MANIFEST

file.

Manifest-Version: 1.0

Weblogic-Application-Version: v1

• When a redeployment operation is requested, Oracle

WebLogic Server checks the version string to determine

whether to deploy a new version of the application.

• Weblogic Domain must be running in Production Mode

Page 56: Partner Webcast – Weblogic for Developers - 12 July 2012

56

Advantages of Production Redeployment

• Saves the trouble of:

• Scheduling application down time

• Setting up redundant servers to host new application versions

• Managing client access to multiple application versions

manually

• Retiring older versions of an application manually

Page 58: Partner Webcast – Weblogic for Developers - 12 July 2012

58

<Insert Picture Here>

Agenda

• Weblogic for Developers Overview

• Java standards supported by Oracle

Weblogic

• Classloading in Weblogic

• Weblogic integration with Apache Maven

• Advanced deployment features

• Spring Framework support in Weblogic

• Useful links

Page 59: Partner Webcast – Weblogic for Developers - 12 July 2012

59

Spring Support in WebLogic

• Deploy weblogic-spring.jar as a Library file in your WebLogic domain

• Add the following to your application’s Manifest.mf file • Extension-List: WeblogicSpring

• WeblogicSpring-Extension-Name: weblogic-spring

• WeblogicSpring-Specification-Version: 12.1.1.0

• WeblogicSpring-Implementation-Version: 12.1.1.0

• For WLS 11g library versions are different

Enabling Spring Support in WLS

Page 60: Partner Webcast – Weblogic for Developers - 12 July 2012

60

Spring Support in WebLogic

• For Spring application Weblogic automatically Generates a set

of Spring Mbeans off the WebLogic ApplicationRuntimeMBeans • SpringApplicationContextRuntimeMBean

• SpringBeanDefinitionRuntimeMBean

• SpringRuntimeMBean

• SpringTransactionManagerRuntimeMBean

• SpringTransactionTemplateRuntimeMBean

• SpringViewResolverRuntimeMBean

• SpringViewRuntimeMBean

• Read-Only Mbeans providing better visibility into what’s

happening inside Spring applications running in the WLS

container

• Accessible via WLST or JMX Browser

Spring MBeans

Page 61: Partner Webcast – Weblogic for Developers - 12 July 2012

61

Spring Support in WebLogic

• Set of pages added to Admin Console

• Need to enable the extension in the Admin Console

• Requires a restart of the server

WebLogic Admin Console Spring Extension

Page 62: Partner Webcast – Weblogic for Developers - 12 July 2012

62

Spring Support in WebLogic

• Provides a view of the WebLogic generated Mbeans

WebLogic Admin Console Spring Extension

Page 63: Partner Webcast – Weblogic for Developers - 12 July 2012

63

Spring Support in WebLogic

• Provides runtime metrics

• Types and amounts of Spring beans that have been created for the

deployed applications Application Context

• Scope and performance metrics of Spring Application beans

• WebLogic managed transactions that have been initiated via the Spring

library code in the deployed application

WebLogic Admin Console Spring Extension

Page 64: Partner Webcast – Weblogic for Developers - 12 July 2012

64

Spring Support in WebLogic

• WebLogic adds a “parent” context to a Spring Application Context during the startup of a spring-enabled Web Application

• Context is pre-populated with the following 3 WebLogic specific beans • A WebLogic Transaction Manager bean (ref="transactionManager")

• A WebLogic Edit Server MBean Connection bean (ref="editMBeanServerConnection")

• A WebLogic Runtime Server MBean Connection bean (ref="runtimeMBeanServerConnection")

• Developers can refer to these WebLogic-specific beans (using the ref ids shown above) and have them injected into application code.

• Example: a developer may want to inject a reference to the WebLogic ServerRuntime JMX Server into a piece of code, to enable the code to then use JMX to inspect the host server's runtime MBeans, using a Spring declaration similar to the following:

<bean id="myTestBean" class="com.acme.MyTestBean">

<property name="mbeanSvrConn" ref="runtimeMBeanServerConnection"/>

</bean>

WebLogic Injected Spring Beans

Page 65: Partner Webcast – Weblogic for Developers - 12 July 2012

67

Spring Support Additional links on the topic

•Oracle Weblogic Documentation

•Oracle® Fusion Middleware Spring Support in Oracle WebLogic Server 12c Release 1 (12.1.1)

•Blogs

•Paul Done on Weblogic and Spring integration

•Middleware Magic: Enabling Spring Console Extension

Page 66: Partner Webcast – Weblogic for Developers - 12 July 2012

68

<Insert Picture Here>

Agenda

• Weblogic for Developers Overview

• Java EE standards supported by Oracle

Weblogic

• Classloading in Weblogic

• Spring Framework support in Weblogic

• Weblogic integration with Apache Maven

• Advanced deployment features

• Useful links

Page 68: Partner Webcast – Weblogic for Developers - 12 July 2012

70

Useful links

• www.oracle.com/goto/weblogicdevcast

Weblogic DevCast Series

•Java Message Service on WebLogic Server: Deep Dive

•Web Services with JAX* and Spring on Oracle WebLogic

•Distributed Grid Data Cache, JPA and Enterprise Java Scale

•Developing a Data Access Layer with JPA

•Unveiling Oracle WebLogic Server 12c – Developer Deep Dive

•Java Message Service with Java and Spring Framework on Oracle WebLogic

Page 69: Partner Webcast – Weblogic for Developers - 12 July 2012

71

Useful links

• http://java.net/projects/weblogic-examples

WebLogic Examples on Java.net

Page 70: Partner Webcast – Weblogic for Developers - 12 July 2012

Questions & Answers

Dmitry Nefedkin Oracle ISV Migration Center FMW Consultant [email protected] Webinar slides and recording will be placed to IMC Team blog: http://blogs.oracle.com/imc

Page 71: Partner Webcast – Weblogic for Developers - 12 July 2012

CUSTOMER LOGO

“This slide format serves to call

attention to a quote from a prominent

customer, executive, or thought leader

in regards to a particular topic.”

• Name • Title, Company Name