Eclipse
Debugging WebSphere Applications with IBM Rational Application Developer
by Frank Kim on Apr.26, 2010, under Eclipse
IBM Rational Application Developer (RAD) is basically a typically IBM heavy version of Eclipse. WebSphere is a typically IBM heavy version of a J2EE server. Therefore you would think you could debug web applications using RAD fairly easily like you can on JBoss or ATG DAS using Eclipse.
However I could not find anyone on my latest project who knew how to do this. Fortunately after much Googling I found this PDF document, Debugging Applications in IBM Rational Application Developer, and on page 12 are instructions on how to do this.
The instructions seem to be a little out of date so here are my instructions.
- Log into your Integrated Solutions Console. The default URL is http://localhost:9060/ibm/console/login.do.
- Navigate using the left side column to Servers –> Application Servers.
- Select the Application server you want to debug from the list of Application servers.
- Under the Configuration tab select the Debugging Service link which is near the bottom right in the Additional Properties section.
- Select the “Enable service at server startup” checkbox. Note the JVM debug port.
- Press the Apply button.
- In the Messages box, which appeared at the top after pressing the Apply button, click on the Save link.
- Stop and start your Application Server. It should now be running in Debug mode.
- In RAD go to the project for the web application you want to debug.
- From the menu select Run –> Debug Configurations.
- Select Remote Java Application and press the New button (it’s the top left button). For the port set it to the JVM debug port (default is 7777).
- Press Apply. Then press Debug. It should connect to WebSphere’s JVM.
Now you can set breakpoints and even change small amounts of code which will be deployed automatically to WebSphere. No more waiting 15 minutes to test every change you make because builds are so brutally long.
Duplicating and Modifying Eclipse User Libraries
by Frank Kim on Aug.19, 2009, under Eclipse
Eclipse user libraries are wonderfully convenient ways of packaging together related JAR files. In my Eclipse I create user libraries for each ATG version I install. As a consultant I am always installing different versions and today I installed ATG 9.0.
Normally I use the GUI to create the user library for the latest ATG server. However I thought this is quite inefficient because I already have user libraries for previous versions of the ATG server. I just need to duplicate one of the other ATG user libraries and then tweak the duplicate to have the right path to the JAR files.
Unfortunately the Eclipse GUI does not provide a way to duplicate a library. So I searched in my workspace files and found in my .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs file the settings for all my user libraries.
I then edited that file and copied an entry for an older ATG library, org.eclipse.jdt.core.userLibrary.ATG\ 2007.1. I renamed it org.eclipse.jdt.core.userLibrary.ATG\ 9.0 and updated the paths to where ATG 9.0 is installed and I was done!
Spaces, not Tabs
by Frank Kim on Aug.01, 2008, under Eclipse
The holy war about spaces or tabs continues and you can see all sorts of arguments for each side raging around the internet.
I prefer spaces because it’s a consistent format that remains the same no matter what you are using. With tabs things appear differently depending on how your editor or other program is configured. Plus the worst thing is when spaces and tabs get intermixed.
Arguments for tabs such as they take up less room or it’s easier to move around are in my mind weak. In this day of terabyte disk drive, file size differences between tabs and spaces are trivial and most of your disk space is taken up by images and binary files anyway. And being able to move around and format quickly is not an issue either with modern editors.
The two editors I use most are XEmacs and Eclipse. Below I describe how to use spaces for indents for each program.
In Emacs:
(setq-default indent-tabs-mode nil) ; Use spaces for indents except
; in buffers that already have
; their own local values for the
; variable.
In Eclipse:

Eclipse Ganymede
by Frank Kim on Jul.18, 2008, under Eclipse
I was about to write a post about how much I was starting to dislike Eclipse. Two years ago I was singing the praises of Eclipse but Eclipse Europa (version 3.3) in my opinion has been a disaster. It is incredibly slow, crashes often, runs out of memory, etc. I found myself at times using XEmacs instead because it was faster.
But today I installed Eclipse Ganymede (version 3.4) and so far life has been much better. It is much more responsive, it is not crashing, things are running smoothly. You can read about what is New and Noteworthy in Ganymede. The most exciting new feature to me is the Retain case of match when replacing, just like XEmacs.
Also I noticed that in my JBoss project, hot swapping of code is again working. I am not sure if this is because I upgraded to Ganymede or because I turned on “Build Automatically”. I suspect it might be the latter.
Maven Integration for Eclipse
by Frank Kim on Jul.18, 2008, under Eclipse, Maven
Previously I was using an old Maven integration for Eclipse, version 0.0.11, which I got from http://m2eclipse.codehaus.org/update. The plugin was horribly slow and seemed to sometimes interfere with my builds.
Today I upgraded to the latest, version 0.9.4, from http://m2eclipse.sonatype.org/update/ and things are moving much more smoothly. You can learn more at Maven Integration for Eclipse.
In Windows > Preferences > Maven I only turned on Download Artifact Sources and Download Artifiact JavaDoc. Download repository index updates on startup is on by default but I turned it off after receiving this advice from a fellow developer, Bill Crook.
It’s unclear to me how the m2 plugin uses the indexes so I don’t think I can answer you.
Enabling it causes the plugin to rescan the entire repository if i remember correctly. I personally am not willing to have Eclipse do a full file scan of the local repository each time i start for unknown reasons. if you don’t mind the incurred overhead, go ahead and enable it!
The Maven plugin has a nice dependency feature which Bill Crook explains well.
There will come a time when you need to work on two projects simultaneously. Additionally, there will probably be a dependency from one project to another. The key to doing this effectively is understanding workspace resolution. Workspace resolution is a concept of the m2eclipse plugin. The way this works is that the plugin scans all projects in your workspace and analyzes the poms. Based on group and artifact ID’s the plugin will know if there are interdependencies between your projects. Once the plugin has successfully detected the dependency between projects, you can jump from one project source into another when jumping into methods (via control-click or F3).
There is one important caveat to this, versions. In addition to looking at group and artifact ID’s, the m2eclipse plugin will look at versions to determine if the project for a dependency is in the current workspace. Because of this you must make sure the versions match. Let’s take the example of projects A and B in your workspace. Assume A has a dependency on version 2.0.0.1 of B. Now, if the version of project B in your workspace is 3.0-SNAPSHOT, workspace resolution will NOT work. Can you figure out how to make this work? If you guessed, update the pom of project A to depend on 3.0-SNAPSHOT, you are correct. The moral of the story is be aware of versions when trying to get workspace resolution working.
You will know that workspace resolution is not functioning properly if you see duplicates of the same class when doing searches with control-shift-t. This behavior makes sense when you think about it as Eclipse sees two of these classes in your workspace. For example, continuing with projects A and B as above, let’s assume there is a class Foo in project B. Eclipse would find class Foo in project B source (as java source in your workspace) as well as in version 2.0.0.1 of B (as a class file in jar dependency).
Now if someone would improve the Perforce plugin…
Eclipse memory settings
by Frank Kim on Jun.13, 2008, under Eclipse
Recently I have been having problems with Eclipse running out of memory.
Previously I had as my command line argument for Eclipse.
eclipse.exe -vmargs --Xmx512m
The double dashes were a problem, preventing Eclipse to properly load the correct memory settings from eclipse.ini.
I then removed the -vmargs –Xmx512m from the command line argument and instead modified eclipse.ini which is in the top level of the Eclipse installation. This blog article, Eclipse and memory settings, explains how you should put each argument on a separate line and that you can go to Help > About Eclipse Platform and then click on the Configuration Details button to check that Eclipse is running with the correct settings.
I changed this:
-Xms40m -Xmx512m
to:
-Xms120m -Xmx1024m
but I reverted back when I realized it was my original command line argument that was the problem.
I tried to use these settings as recommended in this forum, [news.eclipse.tools.jdt] Re: How to prevent out of memory errors?
-Xms120m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M
But for some reason that kept crashing the Eclipse startup.
Maven Assembly Convert Shell Scripts to use UNIX LF’s
by Frank Kim on May.09, 2008, under Cygwin, Eclipse, Maven, Perforce
In a previous post, Shell Scripts with Windows LF’s Fail in Latest Cygwin, I wrote about how to use Perforce to check out all files in UNIX format. However if you use Eclipse then this solution will not work because Eclipse always inserts Windows LF’s in any line you insert into a file leading to a mess with files that have both UNIX and Windows LF’s.
However if you happen to use Maven to generate / copy your shell scripts to their target directories you can take advantage of the lineEnding property in the Assembly Director. If you specify the lineEnding property to be “unix” then the outputted shell scripts will be in UNIX format. For example:
<file> <source>src/main/scripts/foo.sh</source> <outputDirectory>bin</outputDirectory> <lineEnding>unix</lineEnding> </file>
Eclipse does not understand MAVEN2_CLASSPATH_CONTAINER
by Frank Kim on Apr.22, 2008, under Eclipse, Maven
Eclipse was complaining in its Java Build Path panel that it did not know what MAVEN2_CLASSPATH_CONTAINER was. Searching around I realized that it was because I had not installed the Maven plugin.
After installing and restarting I went to Project > Update All Maven Dependencies to pull down all the dependencies.
Eclipse won’t start after Windows shutdown
by Frank Kim on Apr.13, 2007, under Eclipse, Perforce
My laptop unexpectedly shutdown when I had Eclipse open. After rebooting I could not start Eclipse. Instead it kept crashing with the message “An error has occurred. See the log file …” Looking at the log file I saw errors related to the Perforce plugin.
java.lang.NoClassDefFoundError
at org.eclipse.ui.internal.themes.ThemeElementHelper.installFont(ThemeElementHelper.java:101)org.osgi.framework.BundleException: Exception in org.eclipse.core.internal.compatibility.PluginActivator.start() of bundle com.perforce.team.ui.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1010)
Caused by: java.lang.ExceptionInInitializerError
at com.perforce.team.ui.PerforceUIPlugin.initializeDefaultPreferences(PerforceUIPlugin.java:284)
I saw a post about this problem which referred to another post for a solution. Basically the post suggests that stale plugin cache information is causing the problem and suggests starting Eclipse with the -clean argument. After doing this I was successfully able to launch Eclipse.
Eclipse Serial Version UID Bug
by Frank Kim on Aug.22, 2006, under Eclipse
Currently there is a bug with Eclipse and generating the serial version UID. When attempting to generate a serial version UID you will see a dialogue window which says “Computing serial version ID….” and “Starting virtual machine…”. Unfortunately this hangs and you are forced to kill your Eclipse IDE. I started seeing this bug after installing some JDBC plugins and the GEF plugin, I’m not sure if it’s related to that. I tried disabling the plugins but I still see the problem. Before I wasn’t having this problem.
I noticed that I haven’t encountered this problem on other installations of Eclipse, even w/ the JDBC plugins, so could just be that I have a bad build of Eclipse.
