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:
In this chapter we will have a closer look in the diverse tools and interfaces for development, deployment, upgrades, and other new configuration features.
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.
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:
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.
To use and configure your development environment as optimally as you can, consider the following hints:
When you want to use the FastSwap
option, please think about the following best practices:
weblogic-application.xml
descriptor, FastSwap
should be enabled in your exploded deployment archiveStandard 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:
WebLogic Server provides a wide variety of helpful tooling to help developers.
<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 descriptorsweblogic.marathon.ddinit.EarInit:
Generates EAR-level deployment descriptorsweblogic.marathon.ddinit.WebInit:
Generates web module deployment descriptorsweblogic.DDConverter:
Converts deployment descriptors to current WLS versionweblogic.Deployer:
Command-line deployment utilityweblogic.PlanGenerator:
Generates a template deployment plan for an applicationTo 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.
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 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:
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:
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:
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:
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.
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:
Maven support was already introduced in 11g R1 PS3 (10.3.4) supporting Application Deployment operations with:
WebLogic 12c provides additional functionality since the 11g release like:
You can use Maven installation to install the WLS maven plugin.
See how the WebLogic Maven plugin is installed:
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
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:
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:
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.
ClassCastExceptions
Within the Java EE implementation standards, you can identify the following classpaths:
APP-INF/classes/
APP-INF/lib/*.jar
(EAR-library-classpath)*
(JAR-library-classpath)*
WEB-INF/classes/
WEB-INF/*.jar
(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:
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>
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.
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:
The WLS-CAT is a very powerful and smart tool which gives you more knowledge about Classloading hierarchies, conflicts, and solutions.
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:
3.12.162.37