Sonntag Sep 14, 2008
Debugging Glassfish with Eclipse
To use remote debugging in eclipse in conjunction with Glassfish there only two configuration steps necessary:
1.) enable the Debugging in the Glassfish Server Configuration
- Open the Web Console and choose menu "Application Server".
- go to the Tab "JVM Settings"
- enable the Debug mode
2.) In your Eclipse you need a extra Debug Program Configuration
- Choose in your Eclipse the Menu "Run -> Debug..."
- create a new "Remote Java Application" for example "Glassfish Debuger"
there you cann edit the Projekt and also the remote Port of the System. you need to change form 8000 to 9009.
Now you can start the Debug Mode from your eclipse by running "Debug->Glassfish Debugger"
See also the following blog
http://www.diotalevi.com/weblog/2007/02/17/debugging-glassfish-with-eclipse-reloaded/
Samstag Aug 23, 2008
Turbo Eclipse
These days I started a new Eclipse Project: Turbo Eclipse
The idea behind turbo eclipse is to provide a small and easy to use eclipse distribution for maven developers based on Eclipse Ganymede.
The goals of Turbo Eclipse are
- minimum amount of Plugins
- Full Maven support using Maven IDE Plugin
- Full Subversion support using subclipse
- Facelets Support using the Eclipse Facelets Project
The Project is hosted at dev.java.net:
https://turbo-eclipse.dev.java.net/
Feedback and Tips are welcome. If you would like to join the project contact me or request a project role on dev.java.net
Samstag Aug 16, 2008
Eclipse Ganymede - Maven2 - Facelets
I invested a lot of hours to find out how to configure Eclipse Ganymede in a way where it works well in a JEE Facelets Project. Currently development of Facelets Web apps is not supported by the Eclipse IDE and WebToolPlattform (WTP). I am not sure but maybe the Eclipse WTP Team did not like Facelets developers. It is not easy to get things like code completion for xhtml files to run out of the box.
So this is my story how I configure a Eclipse Workspace to work with a JEE facelets web project.
I am using Eclipse Ganymede, Glassfish V2 and Maven2. These are the steps I go through:
1.) Install the Eclipse Facelets Plugin
The Eclipse Facelets Plugin is the key to develop xhtml files in eclipse. But it is brand new and - in the moment - not available trough the eclipse update manager.
The Plugin allows you to work in xhtml files like in JSP files. You got code completion and also some nice template wizzards. This plugin is very useful if you want to develop a JEE Web Facelets Application.
If you are interessted in the project - this is the project homepage:
http://wiki.eclipse.org/JSF_Facelets_Tools_Project
And in this webinar you can see the cool features of the plugin:
http://live.eclipse.org/node/225
But in the moment it is very difficult to get the plugin. If you are not familiar with plugin development, checkout plugin source code from eclipse, compile and export plugins it become very hard.... :-(
So I download the sources and compiled the plugin code with the eclipse IDE. If you don't want to go this way you can download the plugin from here.
Extract the file and copy the jars into your /plugin folder of your Eclipse Ganymede. Next restart Eclipse!
2.) Setup Workplace for JSF Support
Now you need to do some configurations to support Eclipse with the necessary Server Environment and JSF Libraries. This is not a project specific configuration but a workspace specific! So if you start in a new Workspace you need to repeat these steps.
First add your Glassfish Server to the Server list. Switch to the Server View and add a Glassfish V2 Server. You need this server environment (target runtime) later in your web project.
Next stp is to add the JSF Implementation form Glassfish to your Web JSF Configuration. This is explained also by Cay Horstmann's Blog:
http://weblogs.java.net/blog/cayhorstmann/archive/2007/07/jsf_support_in.html
So open the Eclipse preferences dialog and go to Web->JavaServer Faces->Libraries.
Create a new JSF library and name the library "GlassfishJSF-impl". Add only the jsf-impl.jar file. This file is located in the /glassfish/lib folder from your glassfish installation.

Now Restart you Eclipse! (I beleve this is a important step).
3.) Setup your Web Project
Now this is the most critical part. And I am not sure if every step is really necessary but it seems to work for me.
So open your Web Project (or create a new one) and open the project properties. Go to "Project Facets".
Here you can now add the "JSF 1.2" and also the new "Facelets 1.0" support:
You will see a link "Further configuration required". Click on it and configure the dialog like this using the server configuration from Glassfish:

You will not see this configuration page again after you close the property dialog! So be carefull. The only way is to disable the Faclets and JSP Support - apply the settings - and re enable the settings again! (It seems to me that this is a plan from the WTP Developers to craze JEE Developers)
Next check the "Java Build Path" settings of your Web Project. You need to add two libraries to your project.
The Server Runtime Library of Glassfish (automatical created during adding the Glassish Server to the Server list before)
Click "Add Library..." and select "Server Runtime"

Choose the Glassfish Server from the Server Runime list. Click finish.
Next you need to add the JSF Library created before. So click again "Add library..." and add a JSF Library and select you GlassfishJSF-Impl created before:

Finaly your project library settings should look like this (Maven Dependencies is only visible if you work in Maven2 project as I do)

Next check the Order of the Libs! This seems also to be very important:

Make sure that the Maven Entry is at the end of the list!
Now restart your Eclipse! If you are lucky you can now edit xhtml files with code completion support :-)

If it did not work...
But! When you work with Maven2 Projects and your xhtml files did not support code completion you need to check some things. I did not know while the project settings will not work after first configuration. I followed these additional steps:
1.) update you maven configuration of your web project
->maven->update project configuration
2.) check the order of the libraries
3.) check if you have added the a target runtime for glassfish and also the glassfish JSF-Impl. You can select the glassfish Server as your project target.
3.) Restart Eclipse and wait as long as all background jobs are finished before you test you xhtml editor.
So I hope this will helpe someones - every comments are wellcome!
Freitag Jul 25, 2008
Eclipse Ganymede - UML2 Tools
Eclipse Ganymede supports the "UML2 Tools" which allows you to create UML diagrams. The Plugins are a contribution form Borland to the Eclipse community and they are very nice.
A good article about the UML2 Tools can be found here:
http://www.vogella.de/articles/UML/article.html
A problem for me was the installation of these plugins. If you follow the instructions :
http://wiki.eclipse.org/MDT-UML2Tools#How_can_I_start_with_UML2Tools.3F
you maybe can not see the new diagram types in your New-File wizzard.

This happens to me. The problem is that the new Eclipse Update Manager dose not show you missing plugins after you select the UML2 Tools from the Update Manager Category
"Ganymede -> Models and Model Development -> UML2 Tools"
As some people suggest it is not necessary to select the hole "Models and Model Development" Category.
In my case I get the UML2 run in Eclipse Ganymede after I added the following plugins form the section "Models and Model Development" :
- EMF - Eclipse Modeling Framework Runtime and Tools
- Graphical Modeling Framework Runtime
- UML2 Diagram Search Features
- UML2 Search
- UML2Tools
After adding these plugins UML2 Tools works fine!
I did not understand the new Update Manager in Eclipse Ganymede. It seems that the Updatemanager exames plugin dependencies but maybe this will not work in all situations.
Mittwoch Jul 09, 2008
Eclipse Ganymede - Maven
Today I installed new Eclipse version Ganymede. The Update Center have changed and I need Subversion Team support and also maven2 for my projects.
So these are the steps I go through plugin installation:
Subversion Team Support
Eclipse supports now subversion integration ”subversive”. You can install this additional plugins using the update manager

Switch to the tab "Available Software" and expand the "Ganymede" section. There you will find the "SVN Team Provider Plugin" under "Collaboration Tools"
I need further (maybe as I am using Linux ?) to follow these instructions:
http://blog.punchbarrel.com/2008/06/30/using-the-new-subversion-integration-in-eclipse-ganymede/
So I installed the SVNKit 1.1.7 - this works perfect. I don't think that this step is necessary under Windows.
Maven2 Plugin
The next part for me was to add Maven2 Plugin support into my Eclipse.
General Informations about this Plugin can be read here:
http://m2eclipse.codehaus.org/
As the Maven Plugin Repository is not included in the Update Manager per default you need to add the Update Site manually.
So in the Update Manager switch to the tab "Available Software" and add the following Update Site to the Update Manager using the function "Add site"
http://m2eclipse.sonatype.org/update/

You can now select the following Features from this Update Site:
- Maven Integration
- Maven Integration for Eclipse
- Maven POM XML Edtior
- Maven: The Definitive Guid book
- Maven Project Configurators
- Maven Integration for WTP
- Optional Components
- Nexus index for Centra Maven repository
After that you need a additional plugin to checkout Maven Projects from a Subversion Repository (using the context menu "check out as maven project"). These Subversive Integration is not included in the sonatype upates site. But it can be taken from the following update URL:
http://www.polarion.org/projects/subversive/download/integrations/update-site/
Again you need to add the Update Site manually.
After that you can add the Plugin
- "Subversive Integration for the M2Eclipse Project"
to your eclipse IDE.
After all my new Eclipse Ganymede seems to be very cool. Maven and Subversion works as perfect.
It's a pity that Eclipse Ganymede dos not integrate the Maven Plugin more easily....
Sonntag Jun 22, 2008
Eclipse - JavaServer Faces - Configuration
In some cases it can happen that your Eclipse Web Project did not support code completion in a JSP or JSF page.
This happens to me in a JSF Project with MyFaces and Facelets Support. I build up the project using Maven so the project build was sucessfull and the project works well on my server but typing code with Eclipse JSP Editor war extreamly annoying as Eclipse did not support my with code completion.
The reason was that the project facets for my project where broken and also MyFaces Support was not added to Eclipse correctly. Indeed it is necessary to configure the myfaces support in Eclipse manually and I am not sure if I was not intelligent enough or the Eclipse WTP is not so easy to use as I should be.
So follow these steps if you run into a similar problem :
- create a MyFaces Folder localy on your computer (e.g: /home/user/myfaces)
- move the MyFaces libs and tomahawk libs into a subfolder lib/ (e.g:/home/user/myfaces/lib)
- commons-beanutils-x.x.x.jar
- commons-codec-x.x.x.jar
- commons-collections-x.x.jar
- commons-digester-x.x.jar
- commons-discovery-x.x.jar
- commons-logging-x.x.x.jar
- myfaces-api-x.x.x.jar
- myfaces-impl-x.x.x.jar
- tomahawk-x.x.x.jar
- move the tld Files for myfaces and tomahawk in a /tlds subfolder (e.g./home/user/myfaces/tlds)
- myfaces-impl-x.x.x-tlddoc.jar
- tomahawk-x.x.x-tlddoc.jar
- Edit the JavaServer Faces LIbraries
- open Window->Preferences
- go to Web and XML > JavaServer Faces Tools > Libraries
- add a new library "MyFaces" with all the jar files moved before to your myfaces/lib folder
- add a new library "MyFacesTLD" with all the jar files moved before to myfaces/tlds folder
- Next edit the Project Facets of your Web Project (Select your project and open >Project Properties > click modify )
- if there is allready available a JavaServerFaces Support - remove JavaServerFaces 1.2
- add JavaServerFaces 1.2. support and press "next" button
- select option "Sever supplied JSF Implemenation" and add the component libraries configured before in the right part of the selection. This is the importend part! And I did not found this dialog after clicking on "finish"
After this stepps code competion works for my JSF Project. Notice that I work with maven and Maven integration in Eclipse is currently not the best. But maybe this instruction will help you...