Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Java Programming

Does J2EE Live Up To Its Promise? 18

Rayooz asks: "With all the hype around the J2EE specification, I'm wondering if it truly lives up to its promise of "server independence" in the real world. Has anyone had experience developing/deploying a J2EE application on one application server and then moving it to another server without any modification?"
This discussion has been archived. No new comments can be posted.

Does J2EE Live Up To Its Promise?

Comments Filter:
  • by Orville ( 104680 ) on Thursday October 05, 2000 @04:26AM (#730042) Journal
    You need to be careful of how you address "hype" I suppose.

    When Sun released the J2EE along with all of the various specifications (i.e. the EJB spec), it was largely left up to the vendors as to *how* those specifications were met.

    Business code is largely portable across vendor products, as long as you follow the specifications yourself. That is, keep your naming standards consistent with Java RMI, etc. I have seen a lot of cases where a developer tried to be "clever" and screwed themselves in the end. Good design saves the day.

    Vendor-specific protocols are typically implemented during deployments, etc. For example, the Inprise Application Server has an Inprise-Specific XML descriptor file that specifies the JNDI names for object naming. Not a big deal, but a slight headache nonetheless.

    If you choose the same application server across different platforms (ex. IAS running on NT, Linux, and Solaris), you should have no problems with code portability whatsoever. (Again, as long as you avoid platform-specific bugaboos)

    In the end, here's the deal: Do not jump into writing server systems in Java if platform independence is your only goal. Use Java if you are willing to invest the time in designing and developing a clean, object-oriented middle tier that is understandable and flexible. If you can accomplish this, platform independence is a great secondary feature. Java also contains many features that are great for quickly developing complicated systems. (Java Network Programming *rocks*)

    If you just want to slap code together and gripe when it doesn't deploy on FooBar app server, just give up and start writing your whole transactional system in Python. Enjoy maintaining *that* system for a few years....

  • I've used entity beans pretty successfully. They take care of a lot of database-persistance issues.

    The only thing I do tend to stay away from is container-managed persistance. In dealing with relational databases, sometimes the table structure is a little more complicated than a simple table-to-bean like a lot of the current AppServers are set up to handle. (Even the Raefel-Monson book has pretty simplified business scenarios)

    Some of the newer app servers seem to be incorporating more complicated container managed queries, etc.

  • Well, we used JSP & our own class library to build a generic file-sharing extranet system (called Cointelligence - http://www.webprofusion.com/cointelligence [webprofusion.com]), I have to say that I find the best thing (apart from being able to seperate your db/logic code from the presentation) is that you have a wealth of app servers to choose from (resin from www.caucho.com being a good example) and the portability is excellent ('port' from NT to Unix in the time it takes to tranfer the files across).

    At the end of the day your only going to use the 'Enterprise' stuff if your running multiple application servers, which some people do and the choice of application server is important there. ASP is still the easiest way to write a dynamic solution (java is a little wordy..) but then basic is the easiest way to write a program etc..
  • With regard to EJBs:

    The only really bad thing about EJBs is that you lose a lot of object-oriented features by using them. (Like polymorphism, inheritance, etc.) You can get around this with some design tricks (using Entities as 'wrappers', etc.) but it would be nice if I could represent a heirarchy of related EJB "objects". (Usually, I've used EJBs as very course-grained objects..)

  • I have always found JAVA code to be portable, between varuous servers. (NT, Win95, Solaris, AIX, Linux, OS/390, VMS -- I can all vouch for).

    I have also got java to run quite nively on my Palm with WABA, even though the code is not portable.

    The biggest pain I have found with java is classpath files. Vendors just will not aggree on a common directory for Java classes. On my NT box I have nearly 20 directories and Jar files in my CLASSPATH.

    JAR files are particulary annoying as most JVMs will only recognise a JAR file if it specifically included in the CLASSPATH, so what should have been a neat idea for packaging sets of classes, becomes a configuration nightmare.

    Why can't we just have one root directory and have the JVM search everything (including jar files).

  • J2EE is nice - certainly an improvement over traditional languages. I'm still nervous about the overhead of the jvm, but I haven't found anywhere where it's been a real problem.

    Regarding portability, we once had a piece of middleware that was a bit of a resource hog and it needed to be moved around a lot. We moved it at various stages between NT, 2k, Solaris and Linux with no changes required or problems whatsoever. Very impressive.

    FWIW I'm liking the XML/XSLT more and more. JSP is sooo '99 ;-).

  • The simplest approach to entity beans has one entity bean per row in a result set. This is pretty expensive, when you have a large result set, or more generally, a middle tier that has to work with lots of data from the database. The overhead of being able to access an entity bean remotely is simply not that important for every bit of data retrieved from a database.

    Some app server vendors advise against this pure approach, and the resulting methodology ends up looking a lot like session beans anyway.

    I prefer to use session beans to query the database and create lighter-weight, serializable objects encapsulating database state, (e.g. application specific objects or beans, or Maps). Then, instead of accessing entity beans remotely (using more bandwidth), I just pass the objects where needed. Having access to objects passed by value can save lots of round-trips to get data remotely.

  • Just last week, I ported our multi-tier web-based application server from Windows NT to Windows 2000 ;-)

    But seriously, I did copy the [Java classes] files over to my Linux laptop and was able to get the system up and running just fine. The only porting problems were file paths in config files (unrelated to Java, which doesn't care about forward-vs-backward slashes) and the registration of servlets (which was a major pain).
  • This comment has nothing to do with J2EE, which has specific ways of dealing with JARs.
  • In addition to Orville's comments:
    • Entity beans should probably be avoided. Stick with session beans.
    • Stateful session beans should probably be avoided. Stick with stateless if possible.
    • Given the above, I wouldn't even consider container-managed persistence.
    With these guidelines, it is quite simple to write fast, portable 3-tier applications. The tool situation is also rapidly improving.

    So, to answer the question, yes, J2EE has lived up to it's promise. I can't imagine doing any serious (maintainable!) middle-tier work in alternatives such as Perl, PHP, etc. It's reached critical mass, having lots of serious, deployed applications, good and improving tool support, and lots of developers who know J2EE and the products supporting it.

  • Quick question: are you accessing entity beans directly from a client app? I've never used entity beans outside of representing "large" objects (like a shopping cart) and accessing that via stateless session beans.

    There are also plenty of times where you need to do something as simple as "get a list", where our teams have just accessed the database 'directly' (through a connection pool) as it were...

  • I'm currently building a multitier web application using Weblogic 5.1 as the application server - EJBs for the business logic and db persistence, and JSP for the presentation layer.

    In terms of portability across app servers, most of your problems will be with deployment descriptors (the XML files) and entity bean finder methods. The representation of this data has not been standardized. EJB 2.0 spec will fix this.

    I second the comments about entity bean to DB tables - it's difficult to express any but the simplest object-relational mappings. Again, EJB 2.0 promises to fix this and add a lot more, such as mapping Entity beans to arbitrary data sources (LDAP, anyone?)
  • I've been doing a lot of research in J2EE adoption at work. My colleagues and I have spoken to dozens of people, and what we've found is this:

    • Many large companies started getting into server-side Java about a year and half ago, primarily using servlets and helper classes. At the time, the app servers weren't very mature so most companies wrote their own app servers (or hired consultants to do so). Now that app servers have matured, they're currently re-writing the existing systems to work with a commercial app server so that they need only worry about the business logic, and that they can take advantage of the J2EE spec.

      Very few companies are using EJBs yet -- the level of J2EE adoption seems to stop at servlets. That's partly because of using homegrown servers, and partly because many companies are waiting for app server EJB-support to fully mature. Most are looking to migrate into EJBs within a year.

      Finally, the majority of companies seem to be in the development/test stage for their server-side Java apps. They aren't looking to deploy for another month or two, and they may not be in full scale production for 6 months.

    So basically, while many have bought into the J2EE hype already, very few are really using the full spec, although they plan to get into that in about a year. At that point, you'll probably start hearing a lot more about how well (or how poorly) J2EE has lived up to its hype.

  • by jfrisby ( 21563 ) on Thursday October 05, 2000 @01:19PM (#730055) Homepage
    (Java Network Programming *rocks*)

    Not quite. With things like CORBA and RMI, it's very good. But if you're talking sockets there are some serious problems.

    Fundamentally, Java I/O is very limited -- and intentionally so -- by the need for 2 threads to handle bi-directional communication. This is of course because of a lack of asynchronous I/O support. Add the lack of support for multiplexing I/O and you're basically screwed.

    Just *try* writing a server in Java that can handle 100,000 simultaneous connections. 200,000 threads is going to break pretty much any server. Yeah, you can resort to clustering and have your servers communicate but that adds a *lot* of complexity in some instances.

    A chat server with featues like rooms and private messages and all those goodies that can handle tens of thousands of simultaneous connections on a single machine would be relatively simple to write if one had multiplexing and asynchronous I/O. But without it you have to add your clustering system and implement things like message routing/forwarding and all other sorts of ickiness.

    But for simpler stuff, Java makes network programming VERY simple and straight-forward unlike other languages -- and that's a VERY good thing.

    -JF

  • What is the problem with Entity beans? Those are pretty much fundamental to J2EE. I can understand your concerns about container-managed persistence, but I find that there are a number of containers out there that do an OK job for a lot of applications.
  • Apparently, support for a new, async-capable socket API will be included in an upcoming JDK release.

    http://java.sun.com/aboutJava/communityprocess/j sr/jsr_051_ioapis.html
  • And when you learn how to use WARs, you'll avoid the servlet registration too. Jesse
  • I've seen customers (of my former company's defunct app server) access entity beans from client GUI apps. Passing objects by value led to much improved performance.

    If you have one middle-tier JVM and the EJBs and all JSPs and servlets and session beans live in it, then entity beans aren't that bad.

    But the same problems creep in again when you have multiple JVMs in the middle tier, e.g. with clustering. You might have a servlet communicating with lots of entity beans in different JVM located on different boxes.

Only God can make random selections.

Working...