Chapter 3. Deployment, Installation, and Configuration Features

Once we have looked at WebLogic 12c and how it fits into the Java EE 6 techniques, let's have a closer look at how we can deploy, build, integrate, and configure our applications into the new WebLogic 12c.

Besides getting it certified for JAVA EE 6, Oracle has done a great job making it ready for the Cloud, Oracle's own engineered systems or Public Cloud.

Nevertheless, WebLogic 12c also runs perfectly on conventional systems, using all the built-in optimizations and benefitting from of all the new built-in enhancements. WebLogic 12c has been optimized for deployment and running on:

  • Oracle's Private Cloud, Exalogic
  • Public Cloud
  • Conventional systems

In this chapter we will have a closer look in the diverse tools and interfaces for development, deployment, upgrades, and other new configuration features.

Develop, build, compile, and deploy on WebLogic 12c

Developing an application is quite a complicated process from the first version of an application until it becomes live and is in production status. WebLogic 12c provides you the best help and support to make it an easy, quick but also reliable process with finally the desired results.

Lightweight development with WebLogic 12c

Just for pure development, Oracle provides a lightweight ZIP file installation, especially meant for quick building of an environment. This is a complete WebLogic Server installation in a ZIP file for development use only and supported on Windows, Linux, and Mac OS X systems. The extracted installation contains all the necessary artifacts you need to develop applications on WebLogic Server, but uses less disk space than a normal WebLogic Server distribution. It includes all WebLogic Server components except for the following:

  • Samples
  • Derby database
  • Webserver plugins
  • Native JNI libraries for unsupported platforms
  • Administration Console help files for non-English locales
  • Oracle Configuration Management (OCM) and ADR files
  • Sun SDK and Oracle JRockit SDK
  • Coherence libraries

For developers, this is benefit, because you just unzip it, create a WebLogic Domain, start it, and within a few minutes you will have it running, ready for your applications. The supplementary ZIP file provides you the samples and the Derby database in case you might need it.

To download the ZIP installer, go to Oracle Technology Network, there you will see a link for ZIP distribution.

Lightweight development with WebLogic 12c

Some hints and tips using development on WebLogic 12c

To use and configure your development environment as optimally as you can, consider the following hints:

Using FastSwap

When you want to use the FastSwap option, please think about the following best practices:

  • In the weblogic-application.xml descriptor, FastSwap should be enabled in your exploded deployment archive
  • The compiled source code modules should be in their corresponding directories in the exploded deployment structure
  • Do not use archives, must be unpackaged classes
  • Deploy application to WebLogic Server using the exploded deployment structure
  • Configure your favorite IDE to directly compile classes in the exploded deployment structure
  • In your IDE, you should develop, edit, and autocompile immediately
    Using FastSwap

Using the wlx option

Standard WebLogic Server starts up with the wls option. The default is wls, which starts all the WebLogic Server services, including EJB, JMS, connector, clustering, deployment, and management.

The wlx option starts a server instance that excludes the following services, making for a lighter weight runtime footprint:

  • Enterprise JavaBeans (EJB)
  • Java EE Connecter Architecture (JCA)
  • Java Message Service (JMS)

Using WebLogic server tooling

WebLogic Server provides a wide variety of helpful tooling to help developers.

  • Incorporate into development process as necessary
  • Before using it, set environment before executing
    <DOMAIN_HOME>/bin/setDomainEnv.cmd(sh)
    

For several types of applications, there are tools available as follows:

  • weblogic.appc: Compiles JSPs, EJB, and validates deployment descriptors
  • weblogic.marathon.ddinit.EarInit: Generates EAR-level deployment descriptors
  • weblogic.marathon.ddinit.WebInit: Generates web module deployment descriptors
  • weblogic.DDConverter: Converts deployment descriptors to current WLS version
  • weblogic.Deployer: Command-line deployment utility
  • weblogic.PlanGenerator: Generates a template deployment plan for an application

Standard Java IDE support

To support developers in their work, WebLogic 12c supports a few IDEs to develop, build, compile, and deploy their Java applications onto WebLogic Server. WebLogic 12c supports the following IDEs.

Eclipse and Oracle Enterprise Pack for Eclipse (12.1.1.0)

In November 1998, IBM began creating a development tool platform that eventually became known as Eclipse, as a new Java IDE to create new products and applications.

Eclipse and Oracle Enterprise Pack for Eclipse (12.1.1.0)

Eclipse was based on an open, free platform, but that base would be complemented by commercial companies encouraged to create for-profit tools built on top of the Eclipse platform. Most of the committers and contributors to Eclipse came from a short list of the commercial vendors, with IBM being the largest contributor.

Also, Oracle is now one of the contributors with its Enterprise Pack for Eclipse, used as a set of plugins designed to support Java EE development, if you use Eclipse as your IDE.

At the time of writing this book, Oracle hasn't released JDeveloper 12c, OSB 12c, or SOA Suite 12c is not yet available on WebLogic 12c, but in this case, you can use Eclipse in combination with the Oracle Enterprise for Eclipse 12.1.1 (OEPE), so you still can build WebLogic SCA application and deploy it on WebLogic 12c.

To build SCA applications in WebLogic, use WAR located at wlserver_12.1commondeployable-librariesweblogic-sca-1.1.war as a shared library and target it to the server instance you want to deploy your SCA application to.

Oracle Enterprise Pack for Eclipse 12c provides the following key features:

  • Oracle Application Development Framework Support, a set of plugins to create, configure, and run Oracle ADF applications.
  • WebLogic Server support. You can:
    • Develop applications faster with virtual EAR technology
    • Deploy applications remotely
    • Edit deployment descriptors and plans
    • Support for WebLogic Shared Library
    • Support for WebLogic SCA
    • Support for WLST and python syntax
    • Support for XMLBeans
    • You can use EJBGen
    • Support for Web services
  • Support for Oracle's Public Cloud. You can deploy your applications to the Cloud. You can specify to target your applications to the Cloud.
    Eclipse and Oracle Enterprise Pack for Eclipse (12.1.1.0)
  • Support for Web Services. Use standard Web Service technologies, such as XML, SOAP, and WSDL.
  • Oracle Database Support lets you connect and query Oracle Databases.
  • Support for Object Relational Mapping, Spring, and Web Application Development, using a technology called AppXray for analyzing the JSP pages, Java source files, resource bundles, and web configuration files.
  • Support for coherence.

NetBeans IDE 7.1

Another well-known IDE for developing Java EE applications is NetBeans. NetBeans IDE is a free, open source IDE ,written in Java and can run on Windows, Mac OS, Linux, Solaris, and other platforms supporting a compatible JVM. The JDK comes bundled with the release.

NetBeans 7.1 provides support for WebLogic 12c. The IDE works in fact with any standard Java Enterprise Edition (Java EE) container, such as GlassFish Server Open Source Edition 3.1.1, WebLogic 12c and 11g, Apache Tomcat, and JBoss.

The following screenshot shows you the creation of a new Web Application for deployment to WebLogic 12c:

NetBeans IDE 7.1

Other expected IDEs

You might expect JDeveloper 12c, but at the time of publishing this book this version was not yet available. Oracle will release with this version release during 2012, along with other Fusion Middleware Products which are not yet on the 12c release such as Oracle SOA/BPM Suite and Oracle Service Bus.

Another IDE that is coming up to support WebLogic 12c is IntelliJ's IDEA from JetBrains, and then the open Community Edition.

Some features that IntelliJ IDEA has are:

  • Rich Code Editor understanding various code syntaxes. You can refactor and inspect your code. Navigation is good and clear. Also, full support for Java 7.
  • Various test integrations such as JUnit and TestNG plus its own test runner UI.
  • Diverse setups for projects and builds if you use Maven, Gradle, or Ant-based projects.
  • Google Android development including latest SDK support.
  • User interface and integration for version control systems, such as Subversion, Git/GitHub, Mercurial, and CVS.
  • An XML editor with a built-in Java XML interface.
  • If you are developing Java applications for desktops you can use the Swing UI designer.
    Other expected IDEs

WebLogic 12c and Maven integration

When working on a project, it is good to have a central system that controls and builds your software projects. One well-known tool for this from Apache is Maven.

So in general, Maven is:

  • An automated build system
  • A project management system
  • A library and dependency handling system
  • A project description system
  • A site generation system

With Maven you can keep a set of standards, and maintain project lifecycling. You can define phases in your lifecycle like for instance when you'd like to execute a particular build or plugin. An important thing within Maven is the project object model.

This is well known to Maven users. If your project is using a well-defined project object model (POM), Maven can then apply cross-cutting logic from a set of shared or custom plugins.

The project object model (POM)

One of the fundamentals in Maven is of course the POM. It describes all kinds of important data of a project such as the project, its name/version, type, and dependencies. It standardizes your configuration and standard directory layout for project, so you do not need to configure, and no path settings are required.

POM can automate building and packaging and it bundles all tests, resources, and classes.

With the POM you will have well-defined project life cycling.

In the following screenshot, you can see the Maven Build process:

The project object model (POM)

Maven support was already introduced in 11g R1 PS3 (10.3.4) supporting Application Deployment operations with:

  • Maven Mojo + WebLogic Deployer + WebLogic Client
  • Supported Deployment Lifecycle operations: list-apps, deploy/undeploy, start, stop, and update

WebLogic 12c provides additional functionality since the 11g release like:

  • Installation of Weblogic ZIP distribution onto a machine where WebLogic has not been installed
  • WebLogic domain creation
  • Start/Stop WebLogic Servers
  • Execute WLST Scripts

You can use Maven installation to install the WLS maven plugin.

See how the WebLogic Maven plugin is installed:

The project object model (POM)

A typical pom.xml for the WebLogic Maven plugin can be seen in this line of XML code:

<plugin>
<
groupId>com.oracle.weblogic</groupId>gp g gp
<plugin>
<
groupId>com.oracle.weblogic</groupId>
gp g gp
<artifactId>wls-maven-plugin</artifactId>
<artifactId>wls-maven-plugin</artifactId>
<version>12.1.1.0</version>
<configuration>
<middlewareHome>c:wls1211</middlewareHome>
<adminurl>t3://127.0.0.1</adminurl>
<build>
<plugins>
<build>
<plugins>
<version>12.1.1.0</version>
<configuration>
<middlewareHome>c:wls1211</middlewareHome>
<adminurl>t3://127.0.0.1</adminurl>
<user>weblogic</user>
<password>welcome1</password>
<user>weblogic</user>
<password>welcome1</password>
</configuration>
</plugin>
</configuration>
</plugin>
</plugins>
</plugins>
</build></build>

One of the nice features is that you can manipulate your WebLogic domain by stopping, starting, deploying, undeploying, and redeploying.

With a simple Maven command, you can start the domain:

mvn wls:start-server
The project object model (POM)

Advanced features of WebLogic Maven plugin

An advanced feature is automating deployment parameters using Maven properties.

You can bind the WebLogic plugin to Maven execution phases for automating deployment and provisioning operations. Also, you can use Maven profiles for multiple deployment targets and simplify configuration with inheritance and integration with continuous integration servers.

Another advanced feature is to associate WebLogic tasks with Maven phases. The Maven plugin goals can be bound to a Maven phase to execute during that phase. This can be very 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.

Here you can see the plugin for phase goals:

Advanced features of WebLogic Maven plugin

Maven support for several IDEs

Maven provides support for IDEs used for WebLogic development.

Some common features:

  • Materialize projects from Maven POM
  • Dependency integration with Compile/Test/Run classpath
  • Maven repository browsing
  • Multimodule Maven project support
  • Form-based POM Editor
  • Dependency graph

Maven for Eclipse/OEPE

To support Eclipse with Maven, you can download and install the open-source plugin calledM2Eclipse from Sonatype. With this plugin, you can do the following things:

  • Create and export Maven projects
  • Dependency management and integration with the Eclipse classpath
  • Automatic dependency downloads and classpath updates
  • Create projects with Maven Archetypes
  • Browse and searching remote Maven repositories
  • POM management with automatic update to dependency list
  • Adapt nested multimodule Maven projects to the Eclipse IDE
  • Form-based and text-based POM Editor
  • GUI presentation of dependency tree and resolved dependencies

NetBeans and Maven

NetBeans 6.7+ provides native support for Maven so you can create or import Maven projects.

NetBeans and Maven

Some other features are as follows:

  • Manage dependencies
  • Dependency graph viewer
  • Run/Test projects
  • Maven repository browser
  • Can also push a Maven job directly to a Hudson CI server as build job

Classloading and the Classloading Analysis Tool (CAT)

Always a matter of concern with developed applications is: how does the application start, and which classes, application, or server side will be loaded and in what order during startup phase. Also, conflicts between application classes and server classes can decrease application functionality or even make an application to start.

As a developer, you are responsible for developing and assembling applications, so make use of many sources of code/libraries within applications.

  • Use in-house libraries + Spring, Xerces, Log4J, apache-commons-*, and so on
  • Understanding how class loading works is important to make correct and efficient use of Java libraries
  • What classes get loaded from where
  • Efficiently reusing shared libraries
  • Avoiding ClassCastExceptions
  • WebLogic Server class loading is a powerful mechanism that can be used to good effect
  • Reuse of common shared libraries
  • Filtering Classloader to control library visibility
  • Construction of custom module Classloader hierarchies

Overview of Java EE application Classpath

Within the Java EE implementation standards, you can identify the following classpaths:

EAR application classpath:

  • APP-INF/classes/
  • APP-INF/lib/*.jar
  • Manifest classpath:
    • (EAR-library-classpath)*
    • (JAR-library-classpath)*

WAR application classpath:

  • WEB-INF/classes/
  • WEB-INF/*.jar
  • Manifest classpath:
    • (WAR-library-classpath)*
    • (JAR-library-classpath)*
    • (EAR-Application-classpath)

To avoid Classloader conflicts, use filtering. This enables classes to be loaded from an application-supplied library first. Classloading filtering has the following features:

  • Changes the delegation model from parent to child first
  • Works as a barrier to prevent parent from supplying class
  • Does not load classes itself
  • Useful in scenarios where application needs to use a different version of a framework that is already bundled with the server
  • Xerces, Spring, Ant, Commons-Logging

The following is an application with a list of packages in the deployment descriptor:

<weblogic-application>
...
<prefer-application-packages>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.commons.*</package-name>
<package-name>org.apache.log4j.*</package-name>
</prefer-application-packages>
...
</weblogic-application>

Built-in WLS CAT (ClassLoading Analysis Tool)

Starting from WebLogic 10.3.4, the WLS-CAT tool was a built-in tool for analyzing classes from the Classloader configuration of an application. It is web-based and you can easily detect Classloading issues, doing some debugging in an application's classpath, and even giving clues how to resolve it. It's a standalone web application, located in the WebLogic Server Home,/server/lib/wls-cat.war, and it has a reference to every deployed application.

Built-in WLS CAT (ClassLoading Analysis Tool)

By clicking on the link, WLS-CAT starts up for that specific application and gives you details about the application classes and possible conflicts. WLS- CAT analyzes classes loaded by the system classpath Classloader and the WebLogic Server main application Classloaders. You can perform analysis at the class, package, or JAR level.

WLS-CAT could tell you to use the web app Classloader by setting the prefer-application-packages in your weblogic.xml as specified in the preceding code.

The following is the detailed view of a Classload analysis:

Built-in WLS CAT (ClassLoading Analysis Tool)

The WLS-CAT is a very powerful and smart tool which gives you more knowledge about Classloading hierarchies, conflicts, and solutions.

Deployment descriptor support for GlassFish Server

GlassFish Server offers some support for weblogic-application.xml, weblogic.xml, and weblogic-webservices.xml deployment descriptor files. WebLogic Server 12c is able to easily deploy web applications developed for GlassFish, reading the glassfish-web.xml descriptor, and automatically applying a set of common configuration elements to the web application when it is running on WebLogic Server. The element in weblogic-application.xml that GlassFish Server supports is security. The equivalent element in the glassfish-application.xml file is security-role-mapping. As a consequence, an application that has been developed for Glassfish and deployed on that environment can easily be migrated on a Weblogic platform by a simple re-deploy. Of course, this is a subject for discussion depending on the application's security model since that will have to be accommodated for the Weblogic Security Framework.

See GlassFish redeployment to WebLogic in action:

Deployment descriptor support for GlassFish Server
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.162.37