Showing newest posts with label glassfish. Show older posts
Showing newest posts with label glassfish. Show older posts

Tuesday, July 27, 2010

Updating GlassFish Server Adapter with Eclipse 3.5 (Galileo) and 3.6 (Helios)

A coworker asked for this recently. If he tries to download the additional server adapter for GlassFish Java EE 5, Java EE 6 1.0.54 with his 3.5 Eclipse he gets the following error:
[... truncated to the relevant parts ;)]
Cannot complete the install because of a conflicting dependency.
Only one of the following can be installed at once:
Sun Application Servers and GlassFish Servers support 1.0.52
GlassFish Java EE 5, Java EE 6 1.0.54

He tried "check for updates" on the complete distribution but this does not work. Even downloading the packages and replacing them directly within Eclipse does not work. After some research, I believed I found a solution:

If you try to simply "install the 1.0.54 as a "new extension", you will get the above error because of the already installed .52.
What you really need is an update. Lets give it a try:

1) Start Eclipse 3.5.x. or 3.6.Mx (Make sure that the WTP (Web Tools Platform) plugins are installed.)
2) Start the installation procedure : select the Help>Software Updates>Find and Install... menu item.
3) Select "Search for new features to install" option and click Next.
4) Click New Remote Site...
5) Give a name (ie GlassFish Eclipse Site), enter the URL: https://ajax.dev.java.net/eclipse
6) Select this new site in the Sites to include in search list and click Next.
7) Select "GlassFish v2.x Java EE 5 and v3 Java EE 6 support" in the "Select the features to install" list and click Next.
8) Review the "Your original request has been modified." window and click Next.
9) Accept the terms of the license agreements and click Finish.
10) Wait for the installation to complete

This should be everything to do. But unfortunatualy this update fails due to a missing Manifest.mf within com.sun.enterprise.jst.server.sunappsrv_1.0.54.jar.
[...]
An error occurred while loading the manifest D:\Program Files\eclipse-jee-galileo-win32\plugins\com.sun.enterprise.jst.server.sunappsrv_1.0.54.jar.
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:114)
[...]

And: btw. This even does not work with 3.6. :(

If you are running Helios (3.6) you can make a new try. All the above steps with a different URL: http://download.java.net/glassfish/eclipse/helios.
The 11th step is to confirm that you are willing to install unsigned content. if you choose yes, you are asked to restart Eclipse. This works and you are done.

You are now able to create new Server Runtimes:
  • GlassFish 2.1 Java EE 5
  • GlassFish Server Open Source Edition 3 (Java EE 6)
  • Sailfin v2

I did not manage to get all this working with 3.5 :( Seems as if the whole server adaptor plugins situation is a mess at the moment. I hope, that this will be resolved shortly. Mainly because the GlassFish Plugins will move to the Oracle Enterprise Pack for Eclipse (OEPE) (compare this bug entry) and will be available at this url http://download.oracle.com/otn_software/oepe/helios/wtp in the future. This will happen with the next OEPE release (which is expected to arrive shortly). At the moment this page is not available.

Oracle: if you are reading this: Please provide updates for 3.5 also. Don't expect anybody to
a) use OEPE or
b) always update to the latest environments

If anybody knows a solution to this .. let me know ..

Sunday, July 18, 2010

Review "GlassFish Security" by Masoud Kalali (PACKT Publishing)

The last weeks were full of work. But my evenings were dedicated to a newly published book.
Book: GlassFish Security
Language : English
Paperback : 296 pages [ 235mm x 191mm ]
Release Date : May 2010
ISBN : 1847199380
ISBN 13 : 978-1-847199-38-6
Author(s) : Masoud Kalali

The author
It's title promises to tell you everything about GlassFish security in detail. Beginning from secure GlassFish installations to secure enterprise Java applications (Web, EJB, Clients) including audits and measures. That was motivation enough to take the time working through the nearly 300 pages. It is written by Masoud Kalali. He has a software engineering degree and has been working on software development projects since 1998. He has experience with a variety of technologies (.NET, J2EE, CORBA, and COM+) on diverse platforms (Solaris, Linux, and Windows). His experience is in software architecture, design, and server-side development, high throughput and large scale software systems. Masoud has published several articles at Java.net and Dzone. He has authored multiple refcards, published by Dzone, including but not limited to Using XML in Java, Java EE Security and GlassFish v3 refcardz. He is one of the founder members of NetBeans Dream Team and a GlassFish community spotlighted developer.
Altogether this proofs for a good read and that was what I expected.

The content
The book has eight chapters. After a short introduction to the Java EE security model in chapter one it moves on to GlassFish security realms. Another twenty something pages tell you about designing and developing secure Java EE applications. Chapter four dives into secure GlassFish environments followed by the fifth chapter caring for a secure GlassFish itself. Done with those, you are half through at page 146. The second half of the book is dedicated to two other products from the former Sun stack. Open Directory Services (OpenDS) is introduced in Chapter six. Followed by an introduction to OpenSSO (Open Single Sign-On) in chapter seven. Chapter eight describes how to secure Java EE applications using OpenSSO. The last chapter nine is dedicated to Web Service security with Open SSO. Each chapter is finished by a separate summary. The book closes with an index. Makes 275 content pages.

Writing and style
The book is an easy read. Not to complicated even for non native speakers like me. The author takes the time and space needed to describe most basic concepts and contexts. Very frequent links and tips in separate boxes help the reader to find out more about most of the topics. I also like the paperback and the format. It is easy to carry around and to use it as a compendium.

My expectations
To be honest, I expected to read more about GlassFish and security as the title promised. Half the book the author is working with OpenDS and OpenSSO. Both not part of the GlassFish family and not necessarily related to Enterprise Java development. For sure, both products address problems developers face working. But every enterprise has it's own solution for this. And I personally do meet commercial products far more often.
The Java EE security basics are suitable for beginners. Nothing new to me and quite surprising, because I was looking for GlassFish specific content. It was there but only in between and not too prominent.
The most valuable to me are the GlassFish specific chapters about secure environments, realms and security administration.
I was disappointed not to see any personal tips and best practices from the author. As already said, he has quite some experience and you can even feel this reading the chapters. But the details are missing.

Conclusion and recommendation
After all my criticism: This is a good book worth reading. Not only for experts but especially for beginners. The experts might like it as reference book. Beginners get a most complete introduction to all security related issues around Java EE with GlassFish 2 and 3. Even if you should know Java EE and GlassFish prior to reading.

Friday, May 21, 2010

DOAG News 02/10: GlassFish and Java EE 6 at Oracle

Some self promotion again. The latest DOAG News, which is the quarterly magazin from the German Oracle users Group DOAG e.V. published an article of mine. This is about GlassFish and Java EE 6 at Oracle and is ment as a guide to Java EE 6 and the "new" Oracle product. Beside this I wrote about some things seen along the road from Sun to Oracle.

All DOAG members get the magazin as part of their membership for free. You can also have it, if you like. Check the german DOAG publications website for more details.

Tuesday, May 4, 2010

Java EE 5 or 6 - which to choose today

Companys are starting new Java EE projects over and over again these days. It still is one of the widely used enterprise technologies today. If you find youself in the situation of having to kick off a new project you keep asking yourself the question for the right technology and product. The time between the launch of a new specification and the first commercial implementations could be hard, cause you have to decide what you are going to do. Stick to whatever spec is available through your current vendors implementation or move on with a new product or choose from the already available parts of the new spec and mix them up with old versions. The basic question behind this is: What Java EE version should I start over with today?
I was asked this frequently since the new specification came out. And I always find it difficult to answer. Today I will try to summarize my thoughts on this and post a decision helper for you to find your own answers.

Status quo
Java EE 6 is out since December 2009. Up to now the GlassFish Server Open Source Edition 3 is available as the reference implementation. The Oracle GlassFish Server 3 offers a supported distribution. The Other vendors are missing support for Java EE 6. You may rest assured that first vendors come out with complying versions earliest in Q4/10. Some milestone builds for first servers are already out there (e.g. JBoss). You also can find implementations of separate specifications (JSF 2.0, JPA 2.0) but most of them miss commercial vendors support in current Java EE 5 servers up to now.

The basic decision
The basic decision you have to make ist, whether you are going to give the current GlassFish v3 a timely try or not. This seems easy at first. But if you try to make this decision from an enterprise point of view you have to keep some things in mind. This is what the following flowchart is trying to demonstrate. You basically have three options:
- Stick to Java EE 5 on whatever platform or server you are using
- Use Java EE 6 with one of the GlassFish 3 distributions
- Develop for Java EE 6 with GlassFish 3 and switch to your vendors distribution later


Things misfiting the chart
Of course, this is a simple black and white approach. As usual there are some greys in it, too. If you already are a "GlassFish company" this is much simpler, as the chart indicates. You probably even would stick to the version 3 if you need (some kind of) clustering or failover.
- and if you are running JBoss you could think about using the latest milestone builds.
- and you can also give the recently released WebLogic Server 10.3.3.0 a try if you are only interested in JSF 2.0.
- and you can try to use EclipseLink 2.0 or Hibernate 3.5 for JPA 2.0 support
- and you could decide that it's worth doing some educational projects to skill up your developers
- and ... and ... and

Your development project and the future
Nothing prevents you from thinking about the future of your development project. But you should keep in mind, that it is always some kind of risk, if you mix development and productive platforms. If you are striving for a GlassFish 3 development environment and planning to run on any other vendor's server, you should respect this in your plans. The most safe way here could come true for the interaction between GlassFish and Oracle WebLogic. Not knowing in detail what the future holds for both but I am still expecting some kind of utilities that support transition from one to the other.

Links and readings
GlassFish.org
hibernate.org
EclipseLink
JPA 2.0
JSF 2.0
JBoss AS 6.0.0.M3
Oracle WebLogic

Thursday, March 25, 2010

GlassFish Product Roadmap Updates - Versions 2.1.2, 3.0.1, 3.1, 3.2, 4.0

As announced a few days ago, EclipseCon delivers details about the future directions of GlassFish. After the first details came up yesterday, there was a more detailed session today. As always, this is only second hand information, as I am not affiliated to Oracle. If you are looking for authoritative answers there are other places to look at (see links and readings below). You will find the following information there too in the next few days ;)

Changes to GlassFish in general
First: It's easy to talk about the changes, because most things will not change. GlassFish will stay Open Source (mostly GPL/CDDL). It will have non-Oracle commiters and a (more) transparent development process in general. And you will be able to download the GlassFish Open Source Binaries from the places you are used to.
The available AddOns will remain closed source. And this is the future way of delivering any integration works for other Oracle products. In short: You will not have to care of any Oracle specific middleware or features if your are staying with the Open Source distribution.
The glassfish.org environment will stay the same. You will have all the mailinglists, forums and wikis in place, as you are used to. Same for the source and binary distributions.
There will be an additional oracle.com site about Oracle GlassFish where your will find additional information about the commercial offerings. This includes the formal documentation, support and the licensed versions you can use for production.
UPDATE (3/28/10)
The Oracle GlassFish (commercial distribution) licenses WILL change. It will be available under the Oracle Technology Network Developer License and under a productive deployment license. Pricing will change, too. As usual for Oracle this will be a per processor pricing. Details will become available during the next weeks. If you are unshure what to do, contact your sales rep.

Naming changes
You have to adjust the names you were used to. The two basic offerings will be called:
- Oracle GlassFish Server (this is the commercial distribution)
- GlassFish Server Open Source Edition (the OSS licensed version)
No v2 or v3 anymore. Just the numbers.

Upcomming Releases
We are going to see two kind of releases in the next time. First are the so called 100day Releases. They will basically cover the products as they are and put a new branding in place. I also expect the supported environments to extend to at last the popular ones for Oracle. There will be a 100day release for GlassFish 2.x and 3.x. The 2.1.2 will contain patches and the new branding, and will be released this summer. The 3.0.1 also contains the new branding, patches but will also deliver a multi-language release and provides basic interoperability features with WebLogic Server. It will be available this year summer, too.

Those two will be followed by the normal feature releases; at last for GlassFish 3.x. All 2.x will go to maintainance mode after the 100day release.
Actually the following represents the basic timeline that is know up to now:

GlassFish 3.1 (2010 H2)
- Centralized Administration / Clustering
- High Availability / State Replication
- More value added features (e.g. Coherence support)

GlassFish 3.2 (2011 H1)
- Improved Cluster / High Availability administration
- Integration with Oracle Fusion Middleware
- Virtualization Support
- Some Java EE 6 spec updates
- Some Java EE 7 EA

GlassFish 4 (2012 H2)
- Common Server Plattform - sharing best of breed components with WebLogic Server
- Java EE 7 RI

Comments
After the first rumors around this is not a big surprise at all. GlassFish will stay the reference implementation for Java EE and will survive. But much more beyond this we will see both Oracle Java EE Servers growing together. There are no further details around about the plans for GlassFish 4.x and up to now this is only speculation again. But it seems to me that "sharing components" between both could mean more than simply running the same codebase for selected features. I believe this could lead to a general server platform which allows for only a few components/services to be different from each other. I am very excited to see both systems moving into a common direction.
The provided roadmap only applies to the GlassFish server. There are a couple of things around it. One to mention is the GlassFish Tools Bundle For Eclipse. Nothing special has been announced for it so far. But Oracle also has the Oracle Enterprise Pack for Eclipse (OEPE) in place. The situation seems quite similar to the two servers. But I expect a near-term solution here.


Further Links and Readings

https://glassfish.dev.java.net/roadmap/
http://www.oracle.com/technology/products/glassfish/

UPDATE 3/25/10
The first link refers to the PDF slides of the presentation done by the GlassFish gang yesterday evening at EclipseCon.

Wednesday, February 10, 2010

Java EE Development Environment - Rollout for large teams

Everybody comes across this issue from time to time. You have a fresh and exciting project with a couple of developers. The skills of the team members are different and you have to deliver a complete setup of the development environment for all of them. This is probably no big deal if you have up to five members. You just decide, what components to use and write a small howto which everybody can follow. Running around solves the rest of the open issues. But this is getting much harder if the team grows beyond this. And this is a setting you can still find. Even if more and more projects get smaller and use agile methods ;)
If you are not willing to spend weeks in team internal support for setup and configuration you have to find the right approach. I am going to summarize some thoughts about this in the following parts.

Basic Requirements
Let's look at what is needed for a minimal developer setup.

- Applicationserver (Binaries and Configuration)
- Database (Binaries and Configuration)
- Build Tool (Binaries and Configuration)
- CVS/SVN/Whatever Client (Binaries)
- Integrated Development Environment incl. Plugins (Binaries) - Basic Project Setup (Configuration)

For almost any single part in this hopefully not too incomplete list, you have some kind of binary that needs to be installed on a developers desktop and some kind of configuration. It is highly recommended to keep any project specific configurations within your source code repository. The following thoughts only apply to the binary installs.

Preliminary work
The bigger the teams get, the more you are in need of a detailed plan for what you are going to do and use. This does include everything. Beginning from the basic decision about the Java EE Appserver up to the single plugins for the IDE used by the developers. Basic rules are:
- Be as near as possible to the future production environment. If this is not possible, think about staging and possibly arising problems and how to avoid them.
- Find the right balance between the number of plugins for your IDE and make shure, they work together smoothly.
- Find the right build tool. Even if already commodity, I still like Maven. But this adds more infrastructure to your projects. (e.g., proxy, company repository)
- Think about the software design and architecture up front. You have to have an idea about which modules you will need and which parts of the team should work on them. (There is much more in/behind the team issues in a project. But I am not going to cover them here and now;))

If all  this is done, you can think about the rollout. It highly depends on the basic setting. Are you using Windows based systems for development or Unix/Linux? Do your project have special infrastructural dependencies (e.g, SSO, Host) that cannot be mocked? Make a complete list of all things that could influence the development and choose one or even combine the following approaches.
And by the way, it is always good to catch up with the most experienced members in your team to discuss your prefered solution:

The "all-in-one-solution" Rookie's Workplace
I love to call it this way. The name stands for a single image of the complete environment. Could be achieved using any kind of VM solution out there. We experiment with VMWare but there are a lot of other products available. The only task here is to setup the virual machine and install everything the way, you would like it as a developer.
After this, you have to rollout the VM runtime to the dev PCs and ship the image.

Implementation cost: probably some days
Rollout cost: should be around half a day per team member
Advantages: Very easy rollout. Highly predetermined setup.
Disadvantages: VM performance (?), no easy incremental update, cost of the VM solution

The "bit-by-bit-solution" Hacker's Workplace
The complete opposite of the previous. You define all used parts and rollout a document containing the install and setup instructions. Place the binaries in any kind of network share or provide download links and version information.

Implementation cost: probably one day
Rollout cost: easily more than a day per team member
Advantages: hardly any rollout, Highly configurable, Easy to update
Disadvantages: Cost of setup within the team, error-prone, learning curve

The "best-of-bread-solution" Developer's Workplace
If you don't like one of the above, you are in need of a combination. Such combinations are most often called the "best-of-bread" solutions, derived from a couple of projects. This is, where you start to cut the problem into pieces. Which parts of your setup is project related? Which parts change often? Which parts are common in your company? Depending on this, you have a much broader range of options to choose from. Some examples:

Software distribution for common software
IDE, build tools and source control clients are good examples of common software you could probably put into the (already in place) software distribution system of your company. This reduces the complexity in your rollout to basically two components. The appserver and the db.

Implementation cost: not your budget :-)
Rollout cost: not your budget :-)
Advantages: stable and standardized
Disadvantages: probably not the software version you like to have.

Option central server
This is a unusual but valid solution. You set up a central server instance and enable it for multiple developers. This could be done in different ways and is highly dependend on the application/db server you are going to use. You could for example
a) have separate domains for each developer (something like a multi project server)
b) use individual application deployments (beware of naming problems)
c) have separate databases or schemas
d) have separate tablenames

To get an idea what this is all about, I recommend you read "Gone fishing for Glassfish" by Sidsel Jensen

Implementation cost: Depending on your org. probably not your budget :-)
Rollout cost: none
Advantages: stable and standardized. Garanteed operation, SLA, central infrastructure, capable of big deployments with lot of data
Disadvantages: Depending on your org (hardware cost, monthly cost), hardly any flexibility

Option de-central server
The most common setting. Every developer gets his own db and appserver on his local hdd. How easy this is, depends on the used products. If you are going to use websphere and db2 you probaply have to have bigger hardware at hand and it takes slightly more time than using mysql and tomcat :-D But this should be no problem at all. The biggest issu is to rollout the project specific configuration. In most cases it is promissing to think about a scripting approach. Nearly all appserver have any kind of command line interface you can use. Or you can even use a scripting environment. Arun Gupta posted an example for the GlassFish v2 in his blog.
The database should not need any special setup or configuration for the development environment at all. You can thing about moving it to the central software distribution or try to find the silent install option.

Implementation cost: Probably some days
Rollout cost: highly dependent on the products you use. One to five days per developer.
Advantages: stable and standardized but flexible
Disadvantages: Bigger hardware required, cost of setup within the team, error-prone, learning curve

Option embedded server
To be honest, I don't like the central approach. And having some three blue character company's software stack on my notebook is also something I realy don't even want to dream of ;) If you have the time to prepare it, you could thing about using the embedded server approach. There are some containers out there, that could be run in embedded mode. If you think about H2 DB, OpenJPA or GlassFish it is definitely an option to have a local startup class for all needed containers. In most of the cases you are forced to develop on components far way from the productive environment. Therefore you have to strictly stick to the Java EE standards your container provides. If you even have different DB this gets even more complex.

Implementation cost: Probably some days
Rollout cost: should be around half a day per team member
Advantages: stable and standardized but very flexible
Disadvantages: learning curve, staging problems

Thursday, February 4, 2010

GlassFish vs. WebLogic - 10 visions for the future

The Sun/Oracle merger raised some questions about the future of different components. One of interest to me is the GlassFish Application Server. Beside the Oracle WebLogic it is the next Java EE Application Server in Oracle's portfolio.
Not really much concrete has been said about the future coexistence of both. But some postings, slides and webcasts are around. Time to summarize them and draw some conclustions. To be honest: Non of the thoughts here are confirmed by anybody. Especially not by Oracle! I don't know if the described things will happen and I don't have any detailed insights in both products timelines or roadmaps. Happy to discuss everything and read about your thoughts.

1) "GlassFish continues as the Java EE reference implementation and as an open source project"
This is a statement, that is totally clear. Nothing will change. It will continue as an Open Source project and you will have a new RI for any of the comming Java EE versions.

2) GlassFish software licensing
Most of the components of the GlassFish plattform are available under a Dual License consisting of the Common Development and Distribution License (CDDL) v1.0 and GNU Public License (GPL) v2. Details for GFv2 kann be found on the GF Wiki. This will stay the same for most of the modules. Except for those, making the way into WebLogic Server. I expect this to be at least the following three: Metro, Jersey, Grizzly

3) Equinox will NOT be the OSGI platform for the Weblogic DM Server
As presented on last years OOW (WebLogic Server Architecture, OSGi and Java Enterprise Edition, Adam Leftik and Jeff Trent), the Equinix Platform has some drawbacks (Lacks a Generic Application Framework, Application Isolation, RFC-133 Context Class Loader). Therefore I expect the Weblogic DM server to use something else. I don't know if this will have any effect on GF. It is possible that the OSGI platform of GF will change, too.

4) There will be NO GlassFish v3 with clustering capabilities
The slide #15 of the Oracle + Sun: Application Server webcast states, that GF will be for productive and agile development. WLS is the availabillity and scalability solution. Therefore the v2 was the last GF with clustering facilities.

5) Metro, Jersey and Grizzly will make it to the WebLogic 11g
As mentioned by Thomas Kurian in the strategy webcast. These are great assets from the GF family and I believe that those three projects will make it to WLS.

6) There will be tool support for migrating GF Apps to WLS
The complete development to production staging process will be adressed by upcomming Oracle solutions. JDeveloper and/or OEPE will have plugins/support for automatic migration of GF apps to WLS. The WLS split deployment directory structure will also be enhanced with staging features. There will probably also be new maven plugins supporting dev and productive builds with GF and WLS.

7) Embedded GlassFish will be bundled with the OEPE
Beeing the development platform of the future, it is obvious that OEPE will bundle an embedded GF in the future.

8) JDeveloper will get support for GF
Beeing the development platform of Oracle could lead to having build in support for GF development in JDeveloper.

9) NetBeans will become the Java ME IDE
Having more and more GF support in JDeveloper and OEPE leads to a further specialization of NetBeans. It will become the Java ME IDE of the Future.

10) There will be a complete ADF implementation for GF
ADF will become available on GF, too.

Thursday, January 28, 2010

Oracle + Sun: Application Server Strategy

The facts from the software strategy application server webcast (12:55 minutes):

0) Complete.Open.Integrated. set of products
From Hardware, to Database, to Middleware up to Applications.

0.1) Application Grid is the relevant part of Fusion Middleware
It's the plattform that powers the Oracle Applications.
Supports all your application environments.
Contains: Weblogic, Coherence, JRockit, Tuxedo, Enterprise Manager

0.2) Sun portfolio:
GlassFish Enterprise Server, Java System WebServer, GlassFish Web Space Server, GlassFish Web Stack

1) Combined Oracle-Sun Solution Focus (transcript)
  • GlassFish continues as the Java EE reference implementation and as an open source project
  • Oracle's strategic application server Oracle WebLogic Server, together with GlassFish, provide world class Java EE infrastructure
  • GlassFish Enterprise Server and WebLogic Server expected to share core components
  • Oracle plans to add GlassFish Enterprise Server to all WebLogic offerings
  • HotSpot and JRockit become OracleÄs strategic JVMs
  • Java System Web Server part of new Oracle Web Tier offering
  • GlassFish Web Stack maintained for existing customers
  • GlassFish Message Queue remains as the GlassFIsh messaging infrastructure

2) Licensing, Support and Maintenance (transcript)
  • Oracle plans to license GlassFish Server and Java System Web Server with all WebLogic Server offerings
  • GlassFIsh also available as standalone offering
  • GlassFish will continue to be supported and maintained for an extended time period for customers current on support
  • GlassFish v2.1 Premier Support up to Jan 2013, Extended support up to Jan 2015)
  • GlassFish v3.0 Premier Support up to Jan 2014, Extended support up to Jan 2017)
  • Full details for support will be published next weeks.

3) Engaging with Oracle
  • GlassFish open source projects thrive. Ongoing commitment by Oracle to java.net and other open source projects that make-up GlassFish
  • Continued collaboration, Blogs (The Aquarium), Enhancements (java.net) and the GlassFish Wiki
  • More information: Oracle.com/AppServer

Monday, January 11, 2010

Running Mojarra 2.0.2 on GlassFish v2.1.1

First of all: Happy new year to all of my readers. I had a quite busy time during the start of the new year. But now, everything seems back to normal operation and I can start over blogging about my fav topics.

A few days ago, a co-worker asked me, about running JSF 2.0 on GlassFish v2.x. I realy was not shure about this first. The JSF 2.0 spec is part of JEE 6 and should work with JDK 1.6. But what about JEE 5 and JDK 1.5? Reading the spec clearly states that it is based on Java 2 Platform, Standard Edition, version 5.0. Ok. This should work according to the spec.

Let's start.
Grep the latest Mojarra 2.0 Download from the projects websites. If you are there already, also get the sources. We will need them later ;)
Extract the binary distribution (mojarra-2.0.2-FCS-binary.zip/.tar) and setup the example build. I was trying to get the "guessNumber" example (mojarra-2.0.2-FCS\samples\guessNumber) working and will use this further on, too.
If you have everything in place, switch to your favorite JDK 1.5 version (I was using the latest 1.5.0_22) and give it a try (mvn clean install).
Without chaning anything, you will notice, that this will not work:

[INFO] Compilation failure
X:\mojarra-2.0.2-FCS\samples\guessNumber
\src\main\java\guessnumber\ClientSideValidatorHandler.java:[42,-1] cannot access
javax.faces.component.UIComponent
bad class file: ~.m2\repository\javax\faces\jsf
-api\2.0\jsf-api-2.0.jar(javax/faces/component/UIComponent.class)
class file has wrong version 50.0, should be 49.0

What does this version thing mean? It states, that the UIComponent.class was compiled with JDK 1.6 and you are trying to use it with JDK 1.5. Fail :|

Lets correct this.
Next is to extract the sources from the download (mojarra-2.0.2-FCS-source.zip/.tar) and compile a JDK 1.5 compliant jsf-api project. Thank god, the JSF guys know how to setup a build. Copy the build.properties.glassfish.orig to a build.properties file and add your jsf.build.home. Beeing behind a corp firewall forces you to add the needed proxy configurations to your ~/.m2/settings.xml file next. Now call ant and build Mojarra 2.0.2.

Now we are going to use our two new jar files. Find
the jsf-api.jar in \mojarra-2.0.2-FCS-source\jsf-api\build\lib and the
the jsf-impl.jar in mojarra-2.0.2-FCS-source\jsf-ri\lib and install them to your local maven repository. I was using other version numbers but same group and artifact ids for testing.

mvn install:install-file -DgroupId=javax.faces -DartifactId=jsf-api -Dversion=2.0.2 -Dpackaging=jar -Dfile=jsf-api.jar

mvn install:install-file -DgroupId=javax.faces -DartifactId=jsf-impl -Dversion=2.0.2 -Dpackaging=jar -Dfile=jsf-impl.jar

Now you have to change the pom.xml of your guessNumber example to reflect the changes. If you are not using a JEE5 SDK, you also have to add the javax.annotation dependency.

<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
</dependency>


<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.2</version>
</dependency>

Almost finished now. Next step is to add a sun-web.xml to the webapp (guessNumber\src\main\webapp\WEB-INF). It should contain:

<class-loader delegate="false"/>
<property name="useBundledJsf" value="true" />

Now you are ready to go. Call mvn clean install and deploy your guessNumber\target\guessNumber.war to your GlassFish v2.1.1 domain. And you are done!

Thursday, December 10, 2009

Celebrating GlassFish v3 final

Roberto Chinnici wrote about this on his blog a few days ago.

The final release will happen on December 10, when GlassFish v3 will be available.

Today finaly is the day! What we all have been waiting for since so long is there.
Download GlassFish v3 (the Java EE 6 referenz implementation)

About Java EE 6:
Java EE provides a standard for portable, robust, multi-tiered server side applications. Java EE 6, improves on the Java EE 5 developer productivity features, breaks the "one size fits all" approach with Web Profiles, adds extensibility, and more. GlassFish v3 delivers the modularity, extensibility and rightsizing capabilities of the new Java EE 6 platform and provides a lightweight, modular, and extensible platform for your Web and Enterprise applications.

Major new features:
  • Profiles
  • Pruning
  • Pluggability/Extensibility
  • Continuing push for ease of development

My Java EE 6 Articles:
Watch out for the german iX magazin issue no.1/2010. It will contain my introductionary article about Java EE 6. Available from the 17.12.09.


Further links:

Monday, November 23, 2009

The GlassFish Experience (german)

Here are the slides from my doag conference session about Sun's GlassFish.
Only available in german:



Opening Slide CC:

Thursday, October 29, 2009

Loadbalancing with fail-over through Apache 2.2 and GlassFish v2.1.1

One of the top posts on my blog is about installing and configuring the BEA/Oracle Apache Plugins for WebLogic Server. This inspired me to write a similar howto about how to achieve the same effect with Apache and GlassFish Server. To be honest, I recently came across some projects working with a clustered GlassFish domain behind an Apache Webserver. And there was definitely a need to understand, what is going on ;)

Let's start.

Prerequisites:
- GlassFish v2.1.1
- Apache Webserver 2.2.14

Setup GlassFish Domain,Nodeagent,Cluster and Nodes:
1) Download and install GlassFish (java -Xmx256m -jar glassfish-installer-v2.1.1-b31g-windows.jar)
2) Build a Cluster domain ( $GLASSFISH_ROOT/lib/ant/bin/ant -f setup-cluster.xml)
3) Start GlassFish ($GLASSFISH_ROOT/bin/asadmin start-domain)
4) Create a Nodeagent ($GLASSFISH_ROOT/bin/asadmin create-node-agent --host localhost --port 4848 nodeagent1
5) Start the Nodeagent ($GLASSFISH_ROOT/bin/asadmin start-node-agent nodeagent1)
6) Login to your admin server (http://localhost:4848/)
7) Create a cluster (name it, whatever you like, I like cluster1)
8) Create two nodes (same here, I like instance1, instance2)
9) Start the cluster
10) Add a property to the clusterwide jvm configuration (-DjvmRoute=${INSTANCE_ROUTE} )
11) Add an instance specific property to instance1 (INSTANCE_ROUTE = w1)
12) Add an instance specific property to instance2 (INSTANCE_ROUTE = w2)
13) deploy clusterjsp example app ($GLASSFISH_ROOT/glassfish/samples/quickstart/clusterjsp)

Setup Apache, mod_proxy, mod_status and mod_proxy_balancer:
1) Download and install Apache HTTPD Server (e.g apache_2.2.14-win32-x86-no_ssl.msi for windows )
2) Edit the httpd.conf:
Change Listen Port to whatever you like. If you run on a single maschine, you should change it to anything but the already blocked GF ports. I use Listen 6666 in this example
3) Uncomment the modules:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule status_module modules/mod_status.so
4) Add the rewriting configuration to the end of the file:

# Enable the rewriting engine
RewriteEngine On

# Enable Reverse Proxy functions
ProxyRequests Off

# Preserve the proxy host-name
ProxyPreserveHost On

# Set access permissions to anyone
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

# Enable balance-manager (http://localhost:port/balancer-manager)
<Location /balancer-manager>
SetHandler balancer-manager
</Location>

# balancer configuration with two nodes
<Proxy balancer://mycluster>
BalancerMember http://127.0.0.1:38080 route=w1
BalancerMember http://127.0.0.1:38081 route=w2
ProxySet lbmethod=byrequests stickysession=JSESSIONID|jsessionid nofailover=Off
</Proxy>

# define the proxy rules for your application

ProxyPassMatch ^(.*\.do)$ balancer://mycluster$1
ProxyPassMatch ^(.*\.jsp)$ balancer://mycluster$1
ProxyPassMatch ^(.*\/clusterjsp\/.*)$ balancer://mycluster$1

# define the reverse proxy rule
ProxyPassReverse / balancer://mycluster/

# Enable extended server status
ExtendedStatus On

# enable server-status location (http://localhost:port/server-status)
<Location /server-status>
SetHandler server-status

# Set access permissions to anyone (not suitable for production !!!)
Allow from all
</Location>

5) Test the configuration and start the apache instance
6) Access your application (http://localhost:6666/clusterjsp/)

Thats all. Finaly, this installation behaves like the oracle apache plugins. You can define dispatching rules für dynamic content or whole directories.

Not needed for the cluster funcionality is the server-status. But this is quite helpful if you like to know, what your apache is doing. Give it a shot and have a look at http://localhost:6666/server-status. Don't forget to disable this in production environment.
Another great thing is the balancer-manager. You can define weight based routings and see the status of the server nodes and the LoadBalancer status in general.

Wednesday, October 28, 2009

Oracle Updates Sun Merger FAQ

Oracle has updated their page on Oracle and Sun and it now includes a PDF entitled "Oracle and Sun Overview and FAQ".

For the first time, it contains some brief answers to some of the hottest JEE community questions around. I copied the relevant sections from the statement in the following. Refer to the PDF for the comple FAQ. I highlighted some interesting parts in italic and commented on the sections. Disclaimer: I know nothing about the Deal at the moment! This are my personal thoughts. Like them, or not!

What are Oracle’s plans for the GlassFish Enterprise (Java EE) Server after the transaction closes?
Oracle plans to continue evolving GlassFish Enterprise Server, delivering it as the open source reference implementation (RI) of the Java Enterprise Edition (Java EE) specifications, and actively supporting the large GlassFish community. Additionally, Oracle plans to invest in aligning common infrastructure components and innovations from Oracle WebLogic Server and GlassFish Enterprise Server to benefit both Oracle WebLogic Server and GlassFish Enterprise Server customers.
To me, this sounds like a commitment to the actual JCP process. As I have written earlier in my "Is Oracle good for Java?" posting, I believe, that the JCP needs a new setup after the merger. If this is done, I could imagine that GF will exist and grow. What I am still not shure about is the support offering around GF. Does it make sense, to fully support two application servers?

What are Oracle’s plans for NetBeans?
Oracle has a strong track record of demonstrating commitment to choice for Java developers. As such, NetBeans is expected to provide an additional open source option and complement to the two free tools Oracle already offers for enterprise Java development: Oracle JDeveloper and Oracle Enterprise Pack for Eclipse. While Oracle JDeveloper remains Oracle’s strategic development tool for the broad portfolio of Oracle Fusion Middleware products and for Oracle’s next generation of enterprise applications, developers will be able to use whichever free tool they are most comfortable with for pure Java and Java EE development: JDeveloper, Enterprise Pack for Eclipse, or NetBeans.
To be honest. I liked NetBeans, years ago. And I never liked JDeveloper. And this probably will never change ;) As a eclipse developer I stands in second row behind the JDev users. This will happen to NetBeans users, too. Know what? Does not feel too bad. I expect Oracle to hand NetBeans over to the community and not investing into the core plattform. They will deliver integration points up to the OEPE level. But that will be all.

What are Oracle’s plans for MySQL?
Oracle plans to spend more money developing MySQL than Sun does now. Oracle expects to continue to develop and provide the open source MySQL database after the transaction closes. Oracle plans to add MySQL to Oracle’s existing suite of database products, which already includes Berkeley DB, an open source database. Oracle also currently offers InnoDB, an open source transactional storage engine and the most important and popular transaction engine under MySQL. Oracle already distributes MySQL as part of our Enterprise Linux offering.
I am pretty unshure about MySQL at the moment. Does it really matter in the enterprise? It never hit my road at customers. Anyway, it could be a smart solution for some Exadata variants for small customers. And it has a great distribution among many non commercial and open source products. It is a strong brand and could work for Oracle as it is. I am not affraid about it's future at all.

How does Oracle support open source?
Oracle has long been committed to developing, supporting, and promoting open source. Oracle has been, and continues to be, committed to offering choice, flexibility, and a lower cost of computing for end users. Oracle has invested significant resources in developing, testing, optimizing and supporting open source technologies such as Linux, PHP, Apache, Eclipse, Berkeley DB, and InnoDB. Oracle continues to embrace and offer open source solutions as a viable choice for development and deployment. More information about Oracle’s support of open source can be found at oracle.com/opensource.
They do. As Mike Lehmann states in my recent email interview:
We believe we have the best open standards server implementation on the planet and agressively are standards compliant. We are also strong believers in open source and actively participate in numerous communities supporting open source development.
(Mike Lehmann, Senior Director of Product Management, Fusion Middleware Oracle Weblogic Server and Java Plattform, Oracle)

Monday, October 26, 2009

Optimize GlassFish Performance in a Production Environment

I recently came across some projects, that in fact needed some performance tunings. Doing so, I was also looking for some best practices and white papers around.
Found this one: Optimize GlassFish Performance in a Production Environment, Performance White Paper, February 2009 (Sun)

It is designed for users requiring general guidance for initial tuning values in order to improve the application performance on the Sun GlassFish application server v2.

This paper provides the Introductory Steps to achieving better performance for the Sun GlassFish application server v2 application with descriptions of the Eleven tuning parameters; General Recommendations, which can be used to optimize the performance of the application server; and Data from a benchmarking exercise that demonstrates the effectiveness of the tuning changes.

Contents
Tip 1: Java Version
Obious .. change to latest JVM if possible.

Tip 2: JVM Mode
GF runs with -client ootb. change to -server

Tip 3: Java Heap Size
Give your server, hat it needs.
By default, the GlassFish application server is set to 512 MB
and the limit for a 32 bit JVM version- is approximately 3.5GB on Solaris, and 1.5
GB on Windows without any operating system tweaks.
Further information is available in this JVM Tunin White Paper!

Tip 4: Tune Java Garbage Collection
A deeper understanding is necessary when tinkering with GC tuning options and it is strongly recommended to read Tuning Garbage Collection with the Java Virtual
Machine
for more details and GC strategies.

Tip 5: HTTP acceptor threads
HTTP acceptor threads accept new incoming connections and schedule new
requests for the existing connections. The default number of acceptor threads is one! It is recommended to have 1 thread per 1-4 core.

Tip 6: HTTP request processing threads
This pool of threads retrieve and process incoming HTTP requests. The default
number of request processing threads is 5 but a starting rule of thumb is to tune
the number of HTTP request processing threads to the number of CPUs.

Tip 7: Optimize Keep Alive subsystem
This subsystem prevents the server from being overloaded with connections. A
waiting keep alive connection has completed processing the previous request,
and is waiting for a new request to arrive on the same connection.
Three factors describe the Keep-Alive behavior. Keep-Alive timeout, Keep-Alive max connections and thread-count. Performance tuning in this subsystem highly depends on your applications needs.

Tip 8: Optimize static content delivery
If your application contains static files, it is recommended to enable HTTP file
cache to optimize performance. This should not be relevant for clusters running httpd with mod_proxy or similar in front.

Tip 9: Use default-web.xml to disable dev features
The default-web.xml file defines features such as filters and security constraints
that apply to all web applications. You should use it, to define some common constraints that are performance critic to all deployed applications. Most common two are this:

<init-param>
<param-name>development</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>genStrAsCharArray</param-name>
<param-value>true</param-value>
</init-param>

Tip 10: JDBC Tuning
Tune the steady-pool-size and the max-pool-size, and set them to the same
value. This will avoid unnecessary resizing of the pool. A general
rule of thumb is to tune the value for max-pool-size and steady-pool-size to the
same number of HTTP request processing threads.

Tip 11: Disable Access Logging
To avoid unnecessary I/O activity, disable the access
logging.

Further readings:
Sun Java System Application Server 9.1 Performance Tuning Guide

Thursday, September 3, 2009

Rumor: EC could delay Oracle-Sun deal

Reuters reports on rumors on Oracle/Sun/EU.


The commission antitrust authority is debating whether to approve the deal by Thursday's deadline, amid concern about Oracle getting its hands on Sun's MySQL database, the sources told Reuters.


Update: Matt Perez wrote a nice article about MySQL and GlassFish: Open Source in Oracle-land.


BTW, the value of the acquisition is not primarily in the technology Oracle is getting, but rather in the people that come along with it. These are world-class, talented and innovative engineers, product managers, etc., who understand the OSS space really, really well. I hope Oracle listens to them, carefully, and take their message to heart. It will be good for all involved.

Thursday, August 13, 2009

DOAG Conference Sessions approved

Got two sessions approved for the DOAG Conference (17.-19.11.09) in Nürnberg.

DOAG Conference 2009

First will be about clustering basics with Oracle Weblogic Server.
Second is about Sun (Oracle) Glassfish Server.

Have a look at the complete conference program as pdf.

Monday, May 4, 2009

Article about Suns Glassfish v3 Prelude

The fresh issue of the german iX Magazin (05/2009) published a new article of me. It takes a first look at Suns/Oracles Glassfish v3 prelude.
See more about my publications on my website.

Monday, January 19, 2009

Grails with Glassfish v3 Prelude

I got the change to take a deeper look at the new GlassFish v3 Prelude. Nazrul Islam published a personal top 10 of the biggest features in v3. One among others is the "Support for dynamic languages such as Ruby and Groovy". Have a look at the official OnePager or a presentation.

In this short howto I want to provide a brief step by step guide, on how to setup a sample Grails application and start it with the embedded GlassFish server.

#1 Download GlassFish v3 prelude from the official website (choose the distribution ,you like)
#2 Install or extract the archive to a suitable location
#3 Add your JDK/bin folder to the path variable (export with unix/linux)
#4 Start the server with <as-install>/bin/asadmin start-domain
#5 Access the admin console http://localhost:4848/
#6 Click on Update Tool, choose "Available AddOns", choose "Grails Scripting" (version 1.0.4-1.0 at the time of writing)
#7 Stop the server with <as-install>/bin/asadmin stop-domain
#8 Set/export GRAILS_HOME=<as-install>/glassfish/grails
#9 Execute GRAILS_HOME/bin/grails create-app <your_app_name>
#10 Change to the newly created directory <your_app_name>
#11 Execute GRAILS_HOME/bin/grails run-app
#12 Open your favorite browser and point it to: http://localhost:8080/<your_app_name>/

Congratulations! You are done!