Beruflich Dokumente
Kultur Dokumente
TABLE OF CONTENTS
CHAPTER I
Click
to se to go
ct i on
CHAPTER II
CHAPTER III
15-18
CHAPTER IV
CHAPTER V
19-28
29-31
CHAPTER I:
Officially, the tool we all know as GlassFish is really GlassFish Open Source
Edition, which is Oracles GPL/CDDL-licensed Java EE application server.
GlassFishs main competitor back in the day was the extremely lightweight
Apache Tomcat. Developers got attracted to both the new Java EE 6
specification, which finally improved development productivity and ease of use,
establishing convenient handling and administration as well. All this happened
a year and a half after Oracle completed its acquisition of BEA Systems.
With increasing uptake on Java EE technologies, GlassFish became a solid
alternative for even the most attractive and performant commercial application
servers. Leading the field by continuously delivering technical innovation and
driving specifications on the JCP had always been BEA Systems with their
WebLogic server, but the release of GlassFish 2.1 was in more or less direct
competition with Oracles and IBMs WebSphere product line. But GlassFish
was for free. And much faster.
The famous Oracle-Sun merger in early-2010 changed the rules. The GlassFish
community was afraid of Oracle cutting off GlassFish completely in favor of the
commercial WebLogic product they just recently integrated as their foundation
for almost all commercial products. But basically nothing happened. Aside
from a bunch of extra marketing and re-naming efforts for both the OSS and
the commercial edition, pretty much everything else remained the same.
Starting in November 2013, things began going downhill for GlassFish. Oracle
announced that they were cancelling the commercial supported version and
that there will not be an Oracle GlassFish Server 4.0. This essentially means
that GlassFish stays the reference implementation for subsequent Java EE
versions, but isnt seen as a commercial offering for customers.
It had seemed that Oracle wanted invest into their new assets by putting up
the so called 100-day releases with patches for both 2.1 and 3.0 versions.
Unfortunately, this was followed by nothing groundbreaking. The 3.1.0 - 3.1.2
releases brought clustering back to the 3.x branch and delivered on longoverdue component updates and fixes in early 2011.
In mid-2012, a micro-release 3.1.2.2 fixed a handful of exceptional issues. No
further updates took place until June 2013, with the initial release of GlassFish
4.0 being the reference implementation of Java EE 7. The community stood
behind GlassFish the whole time. The NetBeans bundle, the unzip and start
packages, the comparably good startup times and the overall availability of
examples and documentation made GlassFish the #1 choice not only for
beginners but also for people running real applications on it.
Also, the steps required to become a contributor (e.g. signing the OCA,
finding peers to review patches) are only one reason. The fact that the
project uses a comparably outdated infrastructure without todays expected
features, nor a user-experience like Github provides, makes it even harder
to attract developers.
Whew. So, theres more going on here too. Did you realize that there are a
bunch of value-added features provided by every application server which
are not covered by any specification? Clustering features are probably the
most prominent example. Talking about administration features or adding
new supported data sources or other products makes it even harder to
imagine that GlassFish will stay the first choice without having a commercial
payout for Oracle and without laying the ground for a vital community to
deliver patches and contributions.
So if we assume that Oracle is just moving slowly and things will keep
moving in the right direction, there is still another complex set of
questions to be answered. Both GlassFish and WebLogic share a bunch
of components (Jersey, Tyrus, etc.) and proposed community changes
might potentially interfere with the needs of a future WebLogic product
visions. This would require either a real product management team, some
kind of extension points or much-increased transparency on the project
management level. We think you can judge on your own how likely you
think these things might happen.
Ok, enough with the history, lets talk about the future! In upcoming
chapters, youll see how to migrate your application and DB connections
and datasource, plus what to do now with your Java EE implementations
of EJB, CDI, JSF, JPA, plus all the changes youll need to make to your
repositories, IDE, Continuous Integration server and frameworks. Go!
CHAPTER II:
How did we choose TomEE and JBoss as options for GlassFish users?
When GlassFish 4 was released, many users were planning to migrate their
applications from GlassFish 3 to get advantage of all benefits brought by the
Java EE 7 specifications. But now, they have been forced to plan a migration
effort towards a different application server instead, pushing the excitement
about using Java EE 7 away for now.
Some of you dont care if the application server is open source or not.
You might fear that other open source options will end up like GlassFish,
with no long-term technical support for subsequent releases. The lack of
transparency and budget are not a problem for them either, and they hardly
would have time to look at the code to find the root cause of the problem.
PRAGMATISM
Meaning
Why?
PATIENCE
Leave things alone for a while and start
evaluating alternatives to GlassFish 4
If you believe your apps are not that locked-in, youll want to
increase productivity and reduce app complexity, thus its ok to stay
with GlassFish for a while and postpone the migration opportunity
towards an application server that already supports Java EE 7.
At this point, you might may face yet another dilemma: do you continue
relying on OSS, or move to a proprietary solution?
Glassfish is an open source software and it is certainly a reason why people
decided to use it. These people are probably looking for an open source
alternative because they need full transparency, have a lower budget and
are able to improve the product if they can to.
We can combine the options above and identify alternatives for each
combination. The following table shows potential candidates to replace
your Glassfish installation based on the options above:
STAY USING
JAVA EE 6
ALSO MOVE TO
JAVA EE 7
Open source
WildFly 8 *
Proprietary
WebLogic, WebSphere
Oracle is tempting users with a claim that the easiest path away from
GlassFish is directly to WebLogic, since it supports GlassFishs deployment
descriptors and share some of the libraries already.
There is a very low probability that you are going to talk directly with
a WebLogic/WebSphere committer (one of the people in charge of
programming the application server), which is the opposite case with TomEE
and, to some extent, JBoss. On the other hand, WebLogic and WebSphere
have much more means to invest into their products for achieving higher
levels of reliability, stability, optimizations, vendor support, HW/SW cost
efficiency, and so on.
You know when the startup finishes when you see the following message:
INFO: Server startup in 1344 ms
Open a web browser and access the url http://localhost:8080 to see the
TomEE+ welcome page. We still have to create an admin user to be able to
operate the admin console, and unlike Glassfish, TomEE+ comes with no
user defined. Go to %CATALINA_HOME%\conf and edit the file tomcat-users.
xml. You find at the end of the file the default security configuration for
TomEE+. You just have to uncomment those lines to make it work:
<!-- Activate those lines to get access to TomEE GUI -->
<role rolename="tomee-admin" />
<user username="tomee" password="tomee" roles="tomeeadmin,manager-gui"/>
INSTALLING JBOSS
Download the latest installation package from http://www.jboss.org/
jbossas/downloads. In case of JBoss, there are two options:
1. JBoss Enterprise Application Platform (EAP): commercial support
by RedHat, more stable and with consistent releases of bug fixes.
2.
Open a web browser and access the URL http://localhost:8080 to see the
JBoss welcome page. We still have to create an admin user to be able to
operate the admin console, since JBoss also comes with no admin user
defined. To create one, follow the instructions in the console URL:
http://localhost:9990.
Both versions are installed the same way: just unzip the downloaded file
in a place you can easily remember. Create the environment variable
%JBOSS_HOME% pointing to the exact location where you unzipped JBoss.
Check if it's correctly installed starting the server with the command:
Windows #> %JBOSS_HOME%\bin\standalone.bat
Unix #> ./$JBOSS_HOME/bin/standalone.sh
You know when the startup finishes when you see the following message
in the console:
(EAP) JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) started in 2659ms
11
TomEE+ follows pretty much the same principle of Glassfish. The JDBC
driver becomes available when it is visible in the classpath. The practical
way of doing it is dropping the MySQL driver (mysql-connector-java5.1.23-bin.jar) in the %CATALINA_HOME%\lib folder. Restart the server to
make it available for the creation of the datasource.
12
The name of the driver file may vary, so make sure you declare exactly
the same name in the resource-root tag. Restart the server to make it
accessible using the name com.mysql elsewhere in the configuration.
13
{...}
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
</drivers>
</datasources>
OR
%JBOSS_HOME%/standalone/configuration/standalone.xml
For JBoss, change to java:/jdbc/AppDS. If you are using JPA, you will find a
reference to the datasource in the file persistence.xml. You may also find
such references in @Resource annotations.
14
CHAPTER III:
15
16
GlassFish uses its own EJB implementation, as does JBoss, but the EJB
TCK is pretty strong and while its not rare to find interop problems during
migration between vendors, its certainly not one of the bigger areas to
worry about.
17
Both WildFly and JBoss EAP have implementations of JSF based on Mojarra,
so you should get a very similar experience with your vanilla Mojarra-based
applications. JBoss now ships with a feature called Multi-JSF, which allows
you to install multiple JSF implementations at different versions from JSF 1.2
up to and beyond JSF 2.2. This includes Mojarra or Apache MyFaces and so
on. This gives you great flexibility for changing the JSF implementation in the
future or using an implementation closest to GlassFish to migrate to initially;
however, their default wrappered implementation shouldnt prove that
tricky to move to.
As you may guess, TomEE+ uses Apache MyFaces and ships with version
2.1.13, so its at the Java EE 6 level and if youre already using JSF 2.2, youd
need to try to patch TomEE+ with MyFaces 2.2 which some have tried,
or simply wait for TomEE to support it. As a migration from Mojarra to
MyFaces, Mojarra tends to allow things which MyFaces does not, such as
nested forms, actionListener validation, and more, so be prepared to do
some work here during your migration.
18
CHAPTER IV:
19
Your repository
Your IDE
We hope at this point youve stopped the thought process whereby you
are thinking, Well, at least I dont need to do anything regarding migration
of X, where X = repository ;-)
Luckily, we dont really see any problems with repositories. We include this
for the sake of completeness, unless of course you work on a product that
uses the application server as a dependency. In that case, the dependency is
probably wired deeply into the logic of your code and only your team could
have enough insight to predict the pain this migration might bring.
But if youre really interested in it, heres with the source code for JBoss and
the SVN repo for TomEE+. Both provide enough instructions to get started,
build the project, start and run some tests. And hey, if youre in the mood,
you can contribute a bugfix or two!
ECLIPSE
As you probably know, Eclipse is the most popular open source IDE
for Java development, with an enormous community behind it. Eclipse
is an excellent IDE, as we wrote in Using Eclipse for Java Development,
but its also a platform for rich applications and has the largest number
of plugins available.
Eclipse and TomEE+
Managing your application server and deploying to it from within Eclipse
is supported for nearly all of the app servers out there. For some of them,
however, integration is more complex: for example, TomEE+ deployments
work fine, however it uses Apache Tomcats connector to make it done.
20
Thats it! And when the server starts, it will deploy your application. If
instead of starting the server, Eclipse mumbles something about Runtime
Environment not being configured, open the server configuration and
ensure that one is configured.
Your next steps are straightforward and are the same for all the servers: Just
click on the application and make it Run on server, then select your TomEE+
instance and check Always use this server when running this project.
21
Installing JBoss tools will bring tons of plugins to your Eclipse instance,
however, these come from a single source and are verified to work
together well. So dont worry about performance, they bring value if youre
using JBoss.
Configuring a JBoss instance works like the same way as for the others
servers. Just select the server type and point it to some unpacked
JBoss location:
22
INTELLIJ IDEA
Whats good about Intellij IDEA is that, being a commercial IDE with rapid
release cycles, it almost always comes with batteries included. IntelliJ has a
good integration with TomEE+, so that when you specify a location of your
TomEE server directory, IntelliJ parses versions of the libraries youre using
The server now can be started with just a click of the Run button. And the
application is deployed as one would expect.
In all other aspects it just works so after a couple of clicks youll get your
server up and running.
23
NETBEANS
For this report, we tried out and configured a beta build of NetBeans 8.0.
Allegedly, its stable and faster than its predecessors.
NetBeans and TomEE+
TomEE integration requires the Java EE Base plugin to be installed, which is
a good thing since we actually set up JBoss first and realized that since we
didnt have it installed, we were prevented from deploying to the application
server configured. However, installing the plugin solved the issues... When
you develop web or enterprise applications, you want the first class support
for it in your IDE.
You can optionally specify which directory you want to have as $CATALINA_
BASE, so different server configurations wont compete with each other.
Additionally, you can specify the manager user credentials, so they can be
used for deployment.
Compared to WildFly, which is a certified Java EE 7 application server, TomEE
at the time of this report being written only supports Java EE 6. So it might be
smart to review this option in the NetBeans run dialog.
NetBeans and JBoss
Out of the box NetBeans 8.0 doesnt have any support for JBoss servers, so to
fix this problem, go through Tools > Plugins > Available plugins > WildFly
application server and install this support. As we mentioned above, the
Java EE Base plugin is completely necessary here to avoid major headaches.
After an IDE restart, you can start configuring JBoss instances. The menu to
add servers is located under the Tools > Servers item. Configuration closely
resembles that in all IDEs mentioned above: just point to the location of
JBoss and continue.
Lets say you have a TomEE+ instance unpacked and ready to be configured.
When you select TomEE as a server type in NetBeans 8.0, it asks a bit more
details than just a location of binaries.
24
YOUR CI SERVER
Like we reported in Why Devs <3 CI: A guide to loving Continuous
Integration, Continuous Integration is the key to successful development
and project monitoring--your software project simply isnt healthy or reliable
if you dont use this pretty-much standard concept. Arguably, there are not
so many differences for between application servers that affect CI servers
like Jenkins, Hudson, Bamboo, TeamCity and others.
However, for the sake of completeness, wed love to provide some insight
about how to configure your CI server to deploy build artifacts to JBoss or
TomEE application servers, using Apache Cargo.
So in order to deploy, you should open project properties, select the Run
tab and specify what application server should NetBeans use.
Apache Cargo
Different projects have different needs and have to be treated personally.
Were going to focus on a default Maven web-application project setup,
just to give you hints where to look when you want to set up your new
application server from within your CI server.
In the Java world, Apache Cargo is a de facto leader among application
server manipulation tools. Cargo provides a Java API, Ant tasks and Maven
plugins to manage your application servers and you can see in the feature
matrix that it has support for GlassFish 3.x/ 4.x, JBoss and TomEE (though
Tomcat connectors).
25
The installer will download and unpack the application server artifact. The
configuration section specifies which port Cargo should use to deploy your
application to the WildFly.
Respectively, if youre interested in the TomEE+ configuration, you just need
to change a couple of lines. For example, Mavens artifact with a TomEE+
distribution is:
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>apache-tomee</artifactId>
<version>1.6.0</version>
</dependency>
Other settings are also somewhat specific to the connector that Cargo uses
to manage the server, however there are no dramatic differences. With
Apache Cargo you can easily include an application server setup into your
continuous integration builds.
</build>
All rights reserved. 2014 ZeroTurnaround O
26
27
You can also configure which ports your TomEE instance should bind with
another XML snippet:
<container qualifier="tomee" default="true">
<configuration>
<property name="httpPort">9090</property>
<property name="stopPort">9099</property>
</configuration>
</container>
Other frameworks that manage servers have also probably thought about
integrations with different application servers, but as you can see with
GlassFish, JBoss or TomEE, Arquillian got it covered.
If you are undergoing or planning a migration, we recommend that you
create at least some acceptance tests to run in both application servers.
Such minimal test coverage cannot catch all the bugs, but it will show you if
things will blow up in your new app server environment.
Hopefully this brief introduction to getting your repositories, IDEs, CI servers
and frameworks up and running with your new application server was
helpful. Now time for closing thoughts :-)
28
CHAPTER V:
SUMMARY, CONCLUSION
AND GOODBYE COMIC ;-)
Looking for a recommendation on whether to
use TomEE+ or JBoss? Well, you wont find one
here--both options are good depending on your
needs--but this summary may help consolidate
your thoughts...
29
Source: http://xkcd.com/583/
30
Final thoughts
Looking for a quick answer? Sorry, this report isnt designed for that!
The decision to migrate at all is still probably being discussed in most
organizations--perhaps some of you were not even aware that Oracle has
planned to discontinue commercial support for GlassFish! Regardless,
this is a decision that requires planning and the ability to accept that your
decision will probably be unpopular with some developers. Considering
these factors, we suggest that you take the path of least resistance, be it
TomEE or JBoss.
31
t
Co ntac
Us
Twitter: @RebelLabs
Web: http://zeroturnaround.com/rebellabs
Email: labs@zeroturnaround.com
Estonia
likooli 2, 4th floor
Tartu, Estonia, 51003
Phone: +372 653 6099
USA
399 Boylston Street,
Suite 300, Boston,
MA, USA, 02116
Phone:
All rights reserved. 2014 ZeroTurnaround
O 1(857)277-1199
Czech Republic
Osadn 35 - Building B
Prague, Czech Republic 170 00
Phone: +372 740 4533
Report Authors:
Markus Eisele, Simon Maple, Hildeberto
Mendonca, Oleg Shelajev and Oliver White
Report Designer: Ladislava Bohacova
32