Search This Blog

2009-07-28

JavaEE with RAD 7.5 and WAS7

Hi guys,

as I promised to post my experiences with RAD7.5 (Rational Application Developer) and WAS7 (Websphere Application Server), I will now show you what I tried to implement during the WAS7 presentation/workshop using the RAD7 wizards and code snippets.

STEP1: I created a WebProject
STEP2: and added a Servlet

--> there was no code skeleton generated for the servlet. Netbeans generates you at least something like this.

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("Servlet Testservlet at " + request.getContextPath ());
out.println("");
out.println("");
*/
} finally {
out.close();
}
}
STEP3: I tried to deploy the WebProject to WAS7
--> RAD only allows you to deploy EAR files, so if you want to deploy only the war or ejb, you have to use the admin console. Very inconvenient. If you try to use the context menu and select run on server on the web project, you get the following exception:
Could not find a valid parent module to add to the server.

STEP4: I created a EJB Project
STEP5: and added a local stateless session bean, with some hello(String name) implementation
--> the wizard asks you to create a class diagram, which is a nice feature.
STEP6: I created a EAR project and added the EJB and the WebProject
STEP7: Invoke the local stateless session bean from the servlet
--> Of course, I could have coded this feature very easily by just adding the @EJB annotation but I wanted to see what the snippet produces, so I used the snippet: CALL a Session Bean Service method. The snippet wants to create an ejb reference and asks you to select the session bean. I selected my local stateless session bean and received the following error: Remote interface cannot be empty. So RAD tells me I can not invoke a local session bean from servlet where both projects are part of the same EAR? Interesting....
If I select remote even if the interface doesn't have a remote interface, RAD finally generates something...some code with compile errors...Welcome back to the world of EJB2.1 :) Feoijesfer is the name of the reference I had to enter... :)

protected FeoijesferRemote createFeoijesferRemote() {
= () ServiceLocatorManager.getRemoteHome(STATIC__REF_NAME, STATIC__CLASS);
try {
if ( != null)
return .create();
}catch (javax.ejb.CreateException ce) {
// TODO Auto-generated catch block
ce.printStackTrace();
} catch (RemoteException re) {
// TODO Auto-generated catch block
re.printStackTrace();
}return null;
}

private final static String STATIC__REF_NAME = "ejb/Feoijesfer_2";
private final static Class STATIC__CLASS = .class;

After this result I didn't want to waste any more time with RAD7.5. Of course it is now possible to create JavaEE applications with IBM products, but don't use the wizards I used. Do it yourself or switch to Netbeans.


2009-07-22

Free Sun webinar: Make Applications Highly Available: Load Balancing GlassFish Clusters

Hi guys,
today I attended at my first SUN webinar. Hopefully it won't be my last one with SUN, because I really liked it. It started very amusing with a hint regarding questions about Oracle. So, if you have questions regarding the Oracle Sun deal, please go to sun.com or oracle.com website. We won't respond on questions about this.

John Clingan, the GlassFish Group Product Manager, started this webinar with a presentation of the benefits of open source and keywords like: productivity focus, community and transparency, annual subscriptions, performance tuned and pay at point of value. Then he introduced the Sun GlassFish portfolio at a high level. The Enterprise Server, the Web Space Server (portal for website development and collaborative workspaces), Web Stack (a complete LAMP stack) and Glassfish ESB.

The main focus of this 1-hour webinar was on High Availability and Load Balancing with GlassFish V2.1. He quickly explained the features of the High Availability Database (HADB) with its 5-9s and the in-memory replication. If you want to have more information, I recommend reading the administration guide or this slideshow. After John, Shreedhar Ganapathy continued with his part about Load Balancing. He answered the question why Load Balancing is so important. If you want to meet business SLA's you have to have scalability to address any growth requirement. Fault tolerance is also very important to prevent any service degradation. Later he explained the GlassFish Load Balancing Plugin, which works with SunWebServer, Apache WebServer and Microsoft IIS.

Then it was time for the first demo. John showed us how to install Sun GlassFish Enterprise Server v2.1 with HADB on a Solaris platform. Apparently, it didn't work because of some problems while providing the path of the installed webserver. Therefore, this step was skipped and instead replaced with a demo deployment of a HA JSP Sample Application. The application was deployed on a cluster consisting of 2 instances. It showed us how to keep values in a HTTP session if one instance fails (they stopped one instance manually).

The last 10 minutes of the webinar were dedicated to questions: Here are some examples: I asked what makes GlassFish clustering and Load Balancing better than what IBM Websphere offers? Answer: It is much easier to install and support and administer through a centralized UI. In addition, it is the only Open Source App Server that supports 5 9s availability. Another question was: What will healthchecking actually do? Check if there are any exceptions thrown? Healthchecking checks, whether instances in a cluster are alive, dead or slow. What is a node agent or what is IIOP or even what is EJB ;) ? There were many different questions. As John couldn't answer all of them, he got support from other experts.

As already mentioned, I really enjoyed this webinar. The skill of the speakers is amazing. You can ask questions to the real GlassFish experts. Of course you can't teach a topic like this in only one hour, but the speakers did a great job in giving an overview. I have to admit that I still have to learn a lot about High Availability and clustered environments. Until now, I didn't care much about this topic as it didn't affect my work as a developer that much. But there's lots of great documentation to read....which I will start with....tomorrow..





2009-07-21

Introducing Websphere Application Server V7 (or WAS 7 with RAD 7.5)

Today I took part at a workshop/introduction of Websphere Application Server V7 in Stuttgart, held by 2 very nice guys from Nice, France. As a convinced glassfish user I was very curious about the first IBM Product, which is completely JavaEE compatible. Version 6.1 with fix packs for EJB or JAX-WS had still some missing things, such as the administration of web services. As I have been working with Websphere in some projects I had lots of critical questions, like what about the bad server start up time or the installation size? But maybe it has become better and they did some improvements since WAS6.1? Let's see what they told us.

I have learned that Websphere is not just an Application Server. It's an ESB, a ProcessServer, an XD, a Portal, a Business Modeler... Great news, but what about the licenses? Is it all included :)

The installation of WAS 7 takes about 200-300 Megabyte of your hard disk and a installation time of about 10 Minutes, maybe a bit faster, depending on your machine. If you want to create a profile which takes about 20 MB, you need some additional time for its creation. At lunch i asked how it can take up to 10 Minutes for 200 MB???? The speaker told me he has been asking this question since 10 years.. It's unbelievable.. WAS7 is installable on Windows and Linux/Unix. But let's be honest. Windows, RedHat and AIX.

With the same license for WAS7 you get a RAD Assembly and Deploy version, which provides basic support for creating JavaEE applications, deployment and testing. You have to pay some extra money if you want to have the RAD for Websphere (Rational Application Developer) where you get extra features like Adapters, Portlets, Crystal Reports, RUP, ReqPro, etc.

Then they gave an overview over the new features of JavaEE 5. It was mainly about the changes/improvements between EJB2.1 and EJB3 and JPA. They agreed that the release of WAS7 is pretty late, as we are almost about the new release of JavaEE 6 this year.

The next topic was the first demo. It was about the creation of Jax-WS webservices.
I looked at the time, as I remembered having had some problems with creating webservices with WAS6.x and RAD7. He started at 10.22 am, created a HelloService POJO, and created a webservices from this pojo with the help of the IDE. Within this menue u can can choose to create a client as well, deploy everything and call the test page. At 10.26 he was done. This was pretty good, as he did some explanation in between. He could have been faster ;) After this he attached a policy set through the admin console, added WS-ReliableMessaging, assigned a binding for it and finally exported it (you could choose between WSDL or WS MetadataExchange). After this, the client was configured, using generated policy. This was a very nice demo.

After the demo, they showed us the huge configuration possibilities Websphere provides, like BLAs (I like this expression, Business Level Applications), Filtering Options, Security Settings, Messaging Improvements and Clustering Settings. After lunch they presented the second demo. Also a very nice one. They created a clustered environment with two laptops and two nodes. Then we finally had time on our own to do some labs, which were prepared for us. I took the time for developing some servlets, jsf pages and ejbs, which weren't part of the lab. More about my experiences in the next post.

So, what about my summary?
I was really impressed by the skill of the 2 speakers. I wasn't sure whether it would be a pure marketing event or not? And it was a very technical event, which I really liked. I see that Websphere has its strength in it's admin console, where you can configure like almost everything. They have a strong focus on security and clustering issues and they don't care much about start up time or deployment time. If everything is configured well and you have a well clustered environment, you will have a good running environment in the end. But I am not sure if they focused on how to get there. Server start up time or redeployments is what a developer does every day, and there you have other applications where you can develop much faster. In my opinion, a developer will definitely be happier with Netbeans and glassfish.

2009-07-17

ICEfaces-1.8.1 AND NetBeans-6.7

Hi guys,
for all of you who developed web applications using ICEfaces with Netbeans 6.5.1 and now switched to Netbeans 6.7, you will no longer find the ICE Faces Plugin within 'Plugins - Available Plugins'
Instead you have to download it manually from http://www.icefaces.org/main/downloads/
After downloading go to Netbeans>Plugins>Downloaded>Add Plugins...>
Select both org-icefaces-netbeans-modules-lib.nbm and
org-icefaces-netbeans-modules-web-frameworks.nbm
The first one provides the run-time-libraries whereas the second one is for the netbeans project integration.
And if you are now about to create a new WebProject, Select ICEfaces and under ICEfacesConfiguration, you can now make Netbeans create a welcomeICEfaces.xhmtl (Facelets only). You should focus on using Facelets, as jsp will probably vanish with JSF2.0

So have fun!

For those who don't know ICEfaces (I really love this name..sounds pretty cool :) )
ICEfaces is an open-source Ajax application framework that enables JSF application developers to easily create and deploy thin-client rich Internet applications (RIA) in pure Java.

2009-07-13

Netbeans IDE 6.7 Refcard

Hi guys,
for those of you who don't know Netbeans development environment, there's a nice DZONE refcard available at
http://refcardz.dzone.com/
It gives you a very general overview about
  • What are the buttons for?
  • What does the editor look like?
  • What's new compared to the version before?
  • Some shortcuts for both PC and Mac users
  • and last but not least a list of links
My recommendation is just to download it from www.netbeans.org and test the features.
I switched from Eclipse to Netbeans about 2 years ago and I am completely happy with it.
What I like most is that this IDE gets better and better with every release, even with release candidates or master releases. I think the main difference between Eclipse and Netbeans is, that Netbeans focuses on providing the very basic functionality for a developer. It is very well tested and has a great integration with databases and application servers.
Eclipse, on the other hand, is more configurable and open for a lot of different plugins. The different download bundles indicate this.
I have met developers, who did a bit too much of eclipse customizing, which made their workspace get lots of problems at deploying and even compiling.
Netbeans also offers different bundles, but it's not about basic IDE features which differ, but support for other programming languages, such as PHP, groovy, C++ and some more.

I think there are different kind of developers, those who are happy with things that just work, and those who really love to customize and therefor accept some problems. Maybe comparable with MAC and PC discussions.
So feel free to tell me your opinion about your favorite IDE.

2009-07-10

Top Reasons for Glassfish V3

I have seen so many large Java projects where they used WebSphere Application Server.
Is there a link between the size of a project and the heavyweight of an application server?
The more people that are developing - the longer the server-start-time or deployment time?

Development Roundtrips beginning with cleaning up your workspace, rebuilding and redeploying your application can take more than 5 minutes, even if you just want to see some changes on the front end.

Switching between implementing with Glassfish and Websphere makes me feel like living in two different worlds. Future and Past.
However, I see that it is still difficult to convince a company or the decision makers, to use glassfish. Many times these decisions are not made for the developers sake and though for the success of a project. But if you are one who can choose the application server, consider these benefits, written down in the following blog:
I know, Glassfish V3 is not yet ready for productive use, but i also know how long it takes to make a decision :)


2009-07-05

Real World Java EE Patterns - Rethinking Best Practices

Adam Bien is a Java Champion and a well known author of a number of books and articles in the field of Java technology. In his most recent book, Real World Java EE Patterns - Rethinking Best Practices, Bien describes the development and main concepts of Java EE and introduces several best practices to create an easy and maintainable lean architecture.

The first part of the book covers the history and the Java EE core concepts. It is followed by the biggest part of the book, the patterns, which are divided into three categories: the business tier, the integration tier and infrastructural patterns and utilities. Finally Adam Bien rounds off the book by providing a discussion about pragmatic Java EE architecture, where he compares two approaches: service- and domain driven design styles.

I recommend this book to everyone who develops enterprise applications with Java. It covers the author’s real world experience with both theoretical background and technical examples. The patterns described in this book are published online at Project Kenai and discussed on Adam Bien’s blog.

In the past years J2EE has apparently often led to an unnecessary bloated architecture, consisting of a variety of layers and patterns, which were not only hard to test but also tough to maintain. This book offers the possibility to Rethink. Both experienced J2EE developers/architects and Java EE newbies with basic Java skills will benefit from this book. Due to a brief history on J2EE you get a great summary about the development of Java EE and you understand why some developers don’t talk positive about it. Particular mention deserves the first part, the brief history and the core concepts. Information about Java is virtually everywhere in the world wide web. The challenge is to bundle it and this is something that Adam masters perfectly. The patterns provide guidance for a lightweight architecture. Adam demonstrates the respective problem, the forces which led to this problem and offers different solutions with the help of code samples. I really like the fact that there is a testing example for every pattern, as testing is an inalienable part of software development.

2009-07-04

JavaEE server comparison and statistics

Hi guys,
in my last post I mentioned the great startup and deployment times of glassfish. The following article "JavaEE Containers - Heaven or Hell?" presents some charts.
The following app servers have been compared:
  • Tomcat
  • JBoss
  • Weblogic
  • IBM Websphere
  • Glassfish
  • Jetty
  • Oracle OC4J
  • Coucho Resin
Keep in mind that not every listed application server supports all the features within the JavaEE specification (e.g. EJB 3.0, JPA, etc).
In my opinion I only see JBoss, Weblogic and Websphere as comparable JavaEE products. And compared to them...glassfish made the first place :)
In order to compete with Tomcat, Glassfish V3 Prelude offers a modular, osgi based development and deployment platform. The first server start without any application will only conatin a lightweight webcontainer and takes about 3166ms. (for more details, look at this). If you want to deploy an EJB application, glassfish V3 will automatically add/load the EJB container.
You can already download and work with a V3 prelude version, but in order to use it for production, let's wait for the final release of V3.

GlassFish Clustering In Under 10 Minutes

John Clingon, the glassfish group product manager at Sun Microsystems (sooner or later Oracle, the deal is still pending) did a very nice presentation of how to
  • download glassfish (it is V2 ur2, if you are trying to do the same, i recommend downloading V2.1)
  • install glassfish
  • setup a cluster with two instances on a local macbookpro
  • deploy a sample application
  • and test the application by stopping one instance
He managed all of this in just about 10 minutes. Awesome!


I have been working with glassfish since nearly 2 years, and I can completely recommend it. No other java application server is so close to the latest technical developments. Great startup and deployment times (I will give you some data in another post) and an easy to use web based administration console. If you work with the Netbeans IDE, you will be able to do agile javaEE development at its best.
However, keep in mind that JavaEE development needs some RETHINKING. Forget about your old J2EE habits and patterns and start reading this book.