JSP Insider - http://www.jspinsider.com

News - Articles/Tutorials/Code/Reviews - JSP/Servlet Hosting Companies - Links

SP Buzz 03/13/2001 - Enterprise Java Beans ( EJB )

***** IN THIS ISSUE ************************************************** 
Rambles 
1:JDOM Beta Version 6 Released
2:Bugs and Things that Go Bump in the Night within the Code

Links 	
1:JSPs or Servlets--Which Architecture Is Right for You?
2:JBoss Review
3:Pseudo Sessions for JSP
4:Toward an XPath API
5:Earthquake as Artist
6:The Holy Grail
7:Handling Memory Leaks in Java Programs
8:Doclet Your Servlet!
8:Servlets in Apache Tomcat and BEA Systems' WebLogic Server

Product Releases
1:Uncovering the Secrets of SE Linux
2:Ant 1.3

Main Topic 
1:The Day It Rained EJBs

Like this newsletter? Tell a friend about the JSP Buzz!


================================================================
                   Rambles by Casey Kochmer
================================================================

**************** JDOM Beta Version 6 Released ***************** 

Plenty is happening at JDOM! The beta version 6 was released last month 
(02.15.2000). Also, JDOM has started the JSR process. 

This is good news as it means JDOM is on its way to becoming
part of the formal Java specifications. This is just awesome for many
different reasons. JDOM is a solid and important tool for working with 
XML within Java code.  The really great news is what this represents 
for Java in general. JDOM started off as a simple idea and as an open 
source project.  A nice Java API was created to help Java code work 
with XML.  Many people saw the value of the tool and now, as a result, 
JDOM is in the process of being incorporated into Java to help make 
Java even better!  This shows the strength of Java -- the willingness 
to work with the community and improve Java for the benefit of all 
involved.  Everyone can help make Java a better product and the Java 
community really does have an impact on improving Java. I am not saying 
the current system is perfect, but it does work and it nice to see Java 
improving through the efforts of the Java programming community.  The 
true strength of Java is the programming community behind it!

<bow>
   JSP Insider would like to say thanks in recognition to everyone 
   who worked to make JDOM an awesome tool! 
</bow>

Oh, if you haven't had the chance to look at JDOM, and you want to begin
using XML, definitely check JDOM out at:

More about the JDOM JSR


*****  Bugs and Things that Go Bump in the Night within the Code  *****
<thanks>
I received a nice email letting us know about a bug on one of code pages. 
This always makes me happy, since so few people take the time to let us 
know when something is wrong on our site. As a result we prize the 
feedback email we do get as a very special commodity. I would like
to take this time to encourage anyone to please send feedback our way - 
good, bad or otherwise.
</thanks>

<insight>
We work hard to put quality material on our site. However, with all 
this hard work I have discovered an interesting fact over the past 
year.  Maintaining an information site is actually more difficult than 
maintaining and building a normal server side application. A site like 
ours has additional layers of work and translation involved with the 
actual publishing of the materials. The end result being that bugs and 
problems have additional avenues of access to creep into the site. 
</insight>

<plea>
JSP Insider needs your feedback. We work hard to bring you high quality, 
accurate information but we still miss things.  It's your feedback that 
helps us be responsive to your needs and maintain the site quality you 
deserve.   
</plea>

<cajole>
Each email of feedback we receive is worth its weight in gold for us.  
OK, OK, OK -- email doesn't weigh anything, but if it did it would be 
as valuable as gold to us since it helps immensely in maintaining the 
quality, accuracy and relevancy of the site for you.
</cajole>

We are proud to have the JSP Insider be a valuable resource to the 
JSP community but we need your help to make it better! If you think 
your feedback isn't important please think again. Your input makes 
the critical difference for us in running the site!

Oh, our email is support@jspinsider.com

Thanks again!
Casey :)
 
================================================================
              Links of Interest
================================================================

[Article] JSPs or Servlets--Which Architecture Is Right for You? 
(Stephen Petschulat 3.2001)
The article reviews the differences between  Model 1 and Model 2 
architectures. If you are looking for a nice overview on what these two 
architectures are then the article is worth reading. If you are already 
comfortable with these concepts then skip this link. 

[Article] JBoss Review  (Humphrey Sheil 12.22.2000)
Since the main topic discusses EJB and J2EE, it is only fair to include 
a review on JBoss. This quick but comprehensive review discusses what 
the JBoss package. Also links to many other resources will 
help you get started. Finally this link also includes some solid 
discussion about JBoss and how it compares to the BEA WebLogic J2EE 
container.

[Article] Pseudo Sessions for JSP  (Budi Kurniawan 3.1.2001)
This detailed look at the session object discusses how HTML and JSP 
interact with each other. More importantly, the article also looks at 
using Pseudo Sessions or server side text files to store user session 
information. This technique is important to compliment the normal 
session object under circumstance when the session object would be a 
poor choice in a project. 

[Article] Toward an XPath API (Leigh Dodds 3.7.2001 )
For XML geeks only, this article ties into all the fun of XSL, XSLT 
and XPath mentioned previously in the Buzz.  Last issue I concluded 
that XSL's greatest weakness is itself.  This article shows a similar 
problem within the XML community.  In summary, this article concludes 
XPath (and consequently XSL) still needs quite a bit of work before 
it becomes a mainstream tool.

[Earthquake] Earthquake as Artist (03.2001)
Well the earthquake was the big news for us here in Olympia. 
Fortunately injuries and damage were limited for such a large
earthquake. One side benefit of the quake, however, was some 
interesting physics.  A sand tracing pendulum created some unusual
results from the quake.  Also, just before the earthquake we had
some Mardi Gras riots in Seattle.  Combining both events in typical
Seattle humor the result is the following link:

[Code Example] The Holy Grail (Eric Costello 3.7.2001)
A nicely done page showing how to use absolute position DIV
statements to layout a HTML page. Very smooth and Eric includes
the code on how to build the page.

[Article] Handling Memory Leaks in Java Programs (Jim Patrick 2.2001)
This article discusses memory management within a Java JVM.

[Article] Doclet Your Servlet! (Jeremy Roschelle 3.2001)
This article reviews how to document servlets and JSP pages using 
JavaDoc. The secret lies within the expandability of the JavaDoc utility. 
The article first reviews the basics of Doclets, the technique
used to expand JavaDoc. Then Jeremy examines how to use Doclets to 
work with servlets.

[Article] Servlets in Apache Tomcat and BEA Systems' WebLogic Server
(Steven Gould 2.2001) 
JSP makes things so easy that we concentrate on JSP when servlets
would also be a valid solution. This article is for newer JSP programmers
who are beginning to explore servlets. The main focus is how to set 
up a servlet to run within a JSP container such as Tomcat.

================================================================
                     Product Releases
================================================================
[Linux] Uncovering the Secrets of SE Linux: Part 1 (Larry Loeb 3.2001)
Wow, the beauty of open source. Even the NSA is in the act now. 
They released a security enhanced version of Linux. This is awesome, 
especially if you are interested in building a secure platform! The 
article is interesting to read even if you are not a Linux user.  More 
importantly, with releases like SE Linux it shows that Linux is truly 
growing as a premiere operating system.  I have reached the point that 
I am convinced it is time to move from NT to Linux as my main JSP 
development platform over the next six months.  Software releases such 
as SE Linux just make me more confident that it is a good time to make 
the switch. 

[Java] Ant 1.3  (3.3.2001)
Ant has just been updated to a new version! Ants great features were
reviewed in the last Buzz. It is a widely used tool for building Java-based 
projects. Ant is flexible, fast and easy to use, especially when a project 
is distributed across many platforms. It might even clean windows.

================================================================
                     MAIN TOPIC by Casey Kochmer
================================================================

**********************  The Day It Rained EJBs   ********************** 

Jayson and I both enjoyed the International Java Conference. An 
interesting trend was the continued hype about EJB-based solutions. This 
is where I shake my head. The hype and the image most people have in 
building web applications are the large multi-server systems. What is 
the reality?  The majority of web applications I know about are small 
ones where EJB (Enterprise Java Beans) would be more of a hindrance 
than a help.

The "Hype Trap" comes from the fact that we like to think of our own 
systems as being bigger than they really are. This is how the EJB hype 
hooks us, since we see the benefits of EJB and automatically in our 
minds we tell ourselves,  "I have this large system so I need EJB."  
The problem is, what constitutes a really large system?  While having 
300 concurrent users might seem like the start of a large system, it 
isn't.  A standard JSP web application can handle the load easily. The 
trouble is the lack of real guidelines (not to mention practical 
experience) to tell us when we have a large system and when J2EE should 
be approached. (Back of the envelope guidelines are presented in a 
moment.) 

The other problem is it seems like the first thing new JSP or Java 
programmers learn about is the term Enterprise Java Bean.  Yes, EJBs 
are really cool.  The only problem is EJB's don't stand alone and they 
must be implemented somewhere.  This leads to confusion.  Some people 
will confuse building a J2EE implementation with using Enterprise Java 
Beans.  For the sake of the uninitiated, let's clarify a point. J2EE 
is a large framework. Just as JSP is a part of the J2EE framework, so 
are Enterprise Java Beans.  However, while JSP can be implemented as 
a stand alone solution, EJB's should be nested within a J2EE application 
framework.  Also, new JSP and Java programmers will make the mistake of 
thinking that when building a J2EE application EJBs must be used.  This 
is not the case.  In fact many programmers are not using EJBs in their 
J2EE applications since currently EJBs don't meet their needs. (See the 
last reference link at the end of the article for more info.)

The fact of the matter is that before using EJBs learn J2EE.  With a 
firm grasp of J2EE it is safe to move on to EJB. OK, this leads us 
back to the question, how do you determine if you need J2EE?

Actually, it is quite simple.  It comes down to the fact that size 
does matter. The larger your system gets, the more likely you need to 
use J2EE.  (Then EJB's are useful for when your J2EE solution grows 
ever larger.)

My simple and rough guidelines for discerning a large system are:

-Does the start up of the system have more than 600 CONCURRENT users?
 How quickly will you have 600+ concurrent users?  If this mark is 
 reached within  a year, then watch out. The actual numbers vary in many 
 conditions,  but 600-800 concurrent users is a solid indicator of 
 traffic load and the possible need to branch out to multiple servers 
 to handle the traffic moving through a site.
  
-Does the system need multiple JSP containers which share information?

-Does the system require failover? In other words, if the server goes 
 down, does service need to continue without interruption?

If the answer is yes to any of these questions consider a J2EE system.

Once a system goes over these guidelines I recommend the using an 
experienced crew of 1 to 3 J2EE programmers to organize the project 
and get things running smoothly.  This is most especially true for 
mission critical systems.  

This leads to the next truth -- the larger the system, the more experi-
ence and staff expertise needed to succeed. This is true of any system, 
not only J2EE based systems. From this vantage point, the J2EE isn't 
expensive, it's the system being built that is expensive! J2EE saves 
money as the system gets larger because it provides a cost effective 
framework to build common components and tools to spread work across 
multiple servers. However, building a large system still requires time, 
staff and training to deploy and maintain. The money saved using J2EE 
doesn't negate the need for a solid staff and project plan!

If, as a system gets bigger, it gets more expensive, why build bigger 
systems?  Many large systems would be better served by a collection 
of smaller JSP applications. In theory this is true. In practice, 
business management enters the picture. Larger systems are easier 
to centrally control from a smaller management team. The sad truth 
is collections of smaller systems are harder to manage.  Over time, 
smaller systems grow in size and internal turf wars over budget and 
staff develop. 

In addition to technical needs, the business environment must also be 
considered.  The best source of wisdom here comes from Dilbert. That 
is, if the work environment seems like it is out of the Dilbert comic 
strip, then go for the single large system.  Otherwise, consider 
breaking a large system into smaller applications.

OK, I strayed from the original EJB topic. The real point of the 
article is to warn new JSP and Java programmers to steer clear of the 
EJB hype. First, learn the JSP and J2EE basics.  With this training 
an understanding of EJB's will naturally shake out and their true 
place in the scheme of things will become clear.

The other issue is that EJBs are still relatively new. The EJB 
technology still needs some shaking out. EJB 2.0 goes a long way, but 
it is still too early tell conclusively. Personally, I think it is 
worth it to let others work out the bugs and get the system working 
well. In about a year I think things will be settled enough to really 
take EJB seriously.  For now, however, I'll be happy implementing 
quick and simple JSP applications.

However, if you are ready to jump into J2EE you are in luck. Sun just 
released a solid resource to help people use J2EE called the 
Sun Java Center J2EE Patterns. 

This document is a description of the typical problems found in building 
web applications and how to solve these problems using J2EE. To read the 
free material register at the Sun site. 

Richard Baldwin has a series of tutorials to help programmers get started 
with EJBs.  

Finally read some more at the The ServerSide for some additional feedback on EJB's.


================================================================
                           SUBSCRIPTION
================================================================
You may unsubscribe from or subscribe to this newsletter by going to:
http://www.jspinsider.com/jspbuzz/index.view

Browse all of the JSP Insider source-code.

Questions or comments? Contact support@jspinsider.com.