Sunday, January 13, 2008

Java Web Development with Eclipse 3.3

Hi all,
Blogging after a long....break. I was travelling a lot for the last 1 month or so. I went to Singapore, Putrajaya, Malacca to name a few. And as a result, very little time for blogging.

If you are following my blogs, i blogged sometime back about core java development using netbeans 6.0 and eclipse 3.3.

Both are excellent open source IDEs that have their own strength and weakness.
I've been using both netbeans and eclipse and i'm pleased with both of them generally.

Before the advent of version 6.0, netbeans was not on par with eclipse for core java development. The responsive editor, fast code completion, incremental compiling etc, etc.. were some of the trademark eclipse strongholds which netbeans never managed to enter, leave alone capturing.

But with 6.0, netbeans has made really a very huge stride in the areas which where it's traditional letoffs.

Eclipse 3.3 has also made some huge improvements in many areas, like it's support for Java EE 5 development, etc.
I also heard that the WTP project in eclipse has improved a lot over these days, so i thought of giving it a try.

My environment:
Eclipse 3.3 Europa
JDK 1.6.0_03
Tomcat 6.0

So i thought of refreshing my servlet/jsp/jsp-el/jstl skills in the above mentioned environment.

One thing that impressed me is that eclipse, by default, supports many popular application servers/web containers than netbeans does.
There is support for all versions of tomcat, jboss (even for 5.0), websphere (ofcourse dude) and also JOnAS server.
But how come they can leave out glassfish, which is the reference app server for java ee 5?
(I heard that glassfish team has released an eclipse plugin. But i expected more from the number one java ide)

One thing i missed though, is a separate menu item to configure "servers". That's ok.

Then i started churning out a few servlets and jsps in my sample app. I changed the web.xml a few times (to configure servlet init parameters etc)
All was going well until i got an "out of memory exception". The IDE displayed a window which suggested me to close the workspace.


Click the image to enlarge






This is what is i saw in the task manager, when the ide ran out of memory



That was ok with me. I was changing the web app many times and was redeploying it often. Occasionally, i restarted the tomcat server from within eclipse. So i thought that might have overloaded the ide.

I closed eclipse and then started it again. It started up smoothly, but some of the changes i made were not saved. That's ok. But eclipse reported that the tomcat server is "stopped".


Then when i deployed my web app, i got an error which said that
"Several ports (8005, 8080, 8009) required by Tomcat v6.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
".




I was quickly able to reckon that tomcat might not have been stopped properly because of the ide crash.
So i attempted to start/restart the server from eclipse, but couldn't.
Then i went to the task manager and closed the tomcat process manually.

I didn't expect this though. I expected the IDE to recognize correctly whether tomcat is running or not and should not ask the user to manually close the process.

After closing the tomcat process i was able to deploy my webapp.

But as time went, eclipse threw more and more such errors, which frustrated me, as i have to go through the process of not only restarting eclipse but also stop the tomcat process manually.

May be, i need to increase the maximum heap space allocated. But whatsoever, i don't want my IDE to crash. It should rather advice me to start the application with increased heap space.

To be honest, i haven't reported this as an issue yet to the eclipse team. I'll be doing that shortly.
I'm sure they can fix these issues quickly and give us an update.

Other things i really appreciate is the nice xml editor, which really save a lot of time. I find the eclipse xml editor marginally better than that of netbeans.

More on the complaints, i feel the code completion needs to be improved for jsp-el and jstl.
I found virtually no code completion for jsp-el.
Also, creating a new servlet is not as easy as creating a jsp, atleast in eclipse.
I need to select various nodes to create a servlet. Eclipse needs improvement here.

So by the current standing, eclipse 3.3 provides good if not great support for java web development. I haven't explored the struts/jsf support in eclipse yet.
Eclipse needs to improve in the web development area, if it want to pose a strong fight to other IDEs out there.

10 comments:

Anonymous said...

I use eclipse for java webapp development for a project which uses JEE 5, Tomcat 5, and JSF.

Eclipse crashes for me at least twice daily, so I am starting to shop around for another IDE.

Tomáš Kramár said...

Your problems with OutOfMemoryExceptions can be solved rather easy, by setting the PermGen space size. Read more about it at http://tkramar.blogspot.com/2007/10/effective-eclipse-i-setup.html

I don't understand why it is not set up more generously out-of-the-box, 64Mb is not much nowadays..

Jim Lombardo said...

I have to say I've never been a Netbeans fan until v6.0 came out ... wow! I really like it. However, to be fair, the inexpensive commercial distribution of Eclipse, called MyEclipseIDE (www.myelcipseide.com) is very, very good. I'd call it a draw with Netbeans 6 (not counting the fee of course!). However, there is one really important issue that nobody ever brings up when comparing these tools ... plugin availability. Eclipse simply blows Netbeans away here. For example, you cannot get a Netbeans plugin for JUnitFactory, which is awesome. That's just one example. Anyone else bothered by this? I'd be a total Netbeans convert if I could get all the plugins I want.

James Selvakumar said...

Netbeans 6.0 have very good support for junit out of the box. It supports both junit 3.x and 4.x versions.

James Selvakumar said...

Thanks tomas kramar.
Your tips were very useful.

Jim Lombardo said...

Yes, james, I know Netbeans has good support for JUnit ... but that's not what I was complaining about. Many 3rd party plugins are not available for Netbeans because the developers have concluded Eclipse has the market share lead. The one I mentioned specifically is JUnitFacotry (http://www.junitfactory.com/). But there are many, many others. I love Netbeans, but plugin support is not as widespread as Eclipse.

James Selvakumar said...

You are right, Jim. Eclipse as the market leader has a plugin ecosystem which is very huge.

Even Google released an eclipse plugin for their "Android" development.

Netbeans and other ide's have to play catchup in this area.

yonkul said...

www.turksohbetim.net

Anonymous said...

Can anyone recommend the best Remote Management & Monitoring software for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central remote pc software
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

Web Development Services said...

Thanks for sharing your effective knowledge about web development services. This types of info is too much imp for visitors

website development are given due importance as they form the first impression and a long lasting one.