Main
|
Next page »
Montag Nov 17, 2008
Ubuntu - MySQL - Glassfish
To install MySQL on Ubuntu to be used in a Glassfish JEE App is very easy.
You can download and install MySQL Server using the Synaptic Tool in Ubuntu. During Setup you will be asked for a root password. this is a password for the user "root" inside the mySQL Server. So its not your Linux root password.
After intalling mysql server you can easily start and stop it with
> sudo /etc/init.d/mysql start
> sudo /etc/init.d/mysql stop
To get into the mysql console use
>mysql -u root -p
There you will be ask for the mysql root password.
To create a new database use the following command form the mysql console:
mysql> create database my_database;
Now you can setup the JDBC Pool inside Glassfish server.
First download the JDBC Driver form mysql download page and put the 'mysql-connecto-java-5.1.x.jar' into glassfish/domains/domain1/lib/ext
use the following Class Name to configure you JDBC Pool: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Use the additional params:
- databaseName : [you_database_name]
- user: root
- password : [you mysql admin password]
Samstag Nov 08, 2008
OpenID Authentification Modul for Glassfish
In the OpenSSO Project on dev.java.net you can find an extension for OpenID. With this OpenID Module which is based on jsr-196 it is easy to use OpenID authentification in a JEE Application running on Glassfish. Additional Informations about the JSR-196 can be found here.
To build the Sources of hte OpenID Authentification Module is very easy as the project is based on maven. So first check out the sources form the jsr-196 project inside cvs code repository
https://opensso.dev.java.net/source/browse/opensso/extensions/jsr196/
The hostname for the cvs repository is : cvs.dev.java.net
Repoistory path is : /cvs
Connection type is: pserver
You just need to check out the jsr-196 project which is found under /opensso/extensions
After you have checked out the sources you can run a maven install directly to build the libary. Information about Maven you find here .
After you run the maven install you have a library called
sam.openid-x.x.x.jar
Copy this jar into your glassfish/lib folder. Thats it.
You can now configure a new HTTP Messaging Provider as described here. The provider class name for the OpenID Autentification Module is : com.sun.security.sam.openid.OpenIDServerAuthModule
Freitag Nov 07, 2008
Generate MS-Word from Servlet will not work in IE ??
Today I spent a very long time to figure out why my JEE Servlet was unable to generate a dynamic MS Word document. - No the servlet dose generate a dynamic MS Word document!. But IE 7.0 in Windows XP with MS Office 2007 was not able to open the generated MS Word document! This was strange because using Firefox on Windows or also using Firefox on Linux Plattform works perfect! So why the hell IE on windows did not open MS Word?
After a long long frustrating period I found out that the solution is to not only set the ContentType to 'application/ms-word' but also set two additional header attributes to get word open on Windows Plattform.
So my servlet output code looks like this - at it works:
public class TestServlet extends javax.servlet.http.HttpServlet {
HttpServletRequest request;
HttpServletResponse response;
protected void doGet(HttpServletRequest arequest,
HttpServletResponse aresponse) throws ServletException, IOException {
this.request = arequest;
this.response = aresponse;
String sEncoding = "utf-8";
response.setCharacterEncoding(sEncoding);
response.setContentLength(5);
response.setContentType("application/msword;charset=utf-8");
response.setHeader("Content-disposition", "attachment; filename"
+ "Example.doc");
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "cache");
response.setHeader("Cache-Control", "must-revalidate");
ServletOutputStream out = response.getOutputStream();
out.println("Hallo");
out.flush();
out.close();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
A helpful thread about this topic can be read here:
http://forums.sun.com/thread.jspa?threadID=586671
I can not understand wy Microsoft always needs so much welfare? "Convention over configuration" seems not be the rule for Microsoft.....
Dienstag Nov 04, 2008
RichFaces - Feature will not work in IE ...?
As I am working with RichFaces I run in a situation where a realy cool Drag&Drop feature supported by RichFaces works fine in Firefox but did not work in Internet Explorer.
First I thougt it was a Bug from RichFaces and opend a new issue in the JBoss RichFacess Issue tracker.
But it is a known issue. Following the issue you can see that my problem is well known in a lot of other situations. Finally the problem occures if a RichFaces/Ajax JavaScript event trigers a page reload. For example after a DropEvent in my case. But it seems it can happen also in a lot of other situations. This is like my code looks that generated the bug in IE:
<rich:dropSupport id="myprojects" acceptedTypes="project"
dropListener="#{myProfileMB.processDropEventAdd}"
reRender="sidebar_menu_id, myprimprojects_menu_id"
action="mydrop_action">
</rich:dropSupport>
The problem was that the action "mydrop_action" seems not to be processed in IE but works fine in Firefox. If you have same problem the solution would be easy. You simply need to change the navigation rule in your faces-config.xml file. You only need to add a <redirect /> tag to the corresponding navigatino rule. So I changed my rule to:
<navigation-case>
<from-outcome>mydrop_action</from-outcome>
<to-view-id>/pages/projects/myprojects.xhtml
</to-view-id>
<redirect/>
</navigation-case>
And this soved the problem. Now the code works in firefox and IE. And RichFaces are really cool!
Sonntag Okt 12, 2008
Glassfish and OpenID
Currently I am working on a solution to authenticate users with an OpenID in a JEE Application running on Glassfish. I need this Integration for a Workflow Application using the IX JEE Worklfow.
After searching for java based OpenID Solutions for Web applications I come to the end that the JRS-196, Java Authentication Service Provider Interface
for Containers is one of the most auspicious solutions for JEE and Glassfish. But its not easy in the moment to find a running modul on this technologie. There is a very important blog about the concepts behind JRS-196 from Ron Monzillo. And also there I started a discussion in the java.net forum about the best way of integration. I will update my results in this blog the next time.
Sonntag Sep 21, 2008
RichFaces - using custom Skinns
The current Version of RichFaces (3.2.1.GA) allows you to use skins in your web application in a much easier way as in the RichFaces versions before.
A detailed documentation about this feature can be found here:
http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/ArchitectureOverview.html#Skinnability
I used this in my own web application and did only two things:
1.) I created a custom skin property file. "myfirstskin.skin.properties" and placed this file into the /src/main/resources folder of my maven project (if you did not use maven put this file in the /META-INF/skins folder or classpath of your webapp)
You can also copy a existing skin property file to start. You will find skins form RichFaces in the richfaces-impl-3.2.1.GA.jar file under /META-INF/skins/.
This is a example for a skin.propertyfile (blueSky.skin.properties)
#Colors
headerBackgroundColor=#BED6F8
headerGradientColor=#F2F7FF
headerTextColor=#000000
headerWeightFont=bold
generalBackgroundColor=#FFFFFF
generalTextColor=#000000
generalSizeFont=11px
generalFamilyFont=Arial, Verdana, sans-serif
controlTextColor=#000000
controlBackgroundColor=#ffffff
additionalBackgroundColor=#ECF4FE
shadowBackgroundColor=#000000
shadowOpacity=1
panelBorderColor=#BED6F8
subBorderColor=#ffffff
tabBackgroundColor=#C6DEFF
tabDisabledTextColor=#8DB7F3
trimColor=#D6E6FB
tipBackgroundColor=#FAE6B0
tipBorderColor=#E5973E
selectControlColor=#E79A00
generalLinkColor=#0078D0
hoverLinkColor=#0090FF
visitedLinkColor=#0090FF
# Fonts
headerSizeFont=11px
headerFamilyFont=Arial, Verdana, sans-serif
tabSizeFont=11
tabFamilyFont=Arial, Verdana, sans-serif
buttonSizeFont=11
buttonFamilyFont=Arial, Verdana, sans-serif
tableBackgroundColor=#FFFFFF
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#C0C0C0
tableBorderWidth=1px
#Calendar colors
calendarWeekBackgroundColor=#F5F5F5
calendarHolidaysBackgroundColor=#FFEBDA
calendarHolidaysTextColor=#FF7800
calendarCurrentBackgroundColor=#FF7800
calendarCurrentTextColor=#FFEBDA
calendarSpecBackgroundColor=#E4F5E2
calendarSpecTextColor=#000000
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
#Gradients
gradientType=plain
2.) next I added two params into my web.xml file:
<!-- ### Richt Faces params deepMarine #### -->
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>deepMarine</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
The first param tells RichFaces to use a predefined or custom skin property file (the name is the first part of your .skin.property file)
And the second param (very important) tells RichFaces also to render standard HTML tags in this skin.
So if you use a standard JSF Tag like
<h:outputLabel value="User name:" />
<h:inputText id="j_username" />
<h:outputLabel value="Password:" />
<h:inputSecret id="j_password" />
these tags will also be renderd in new cool style!
Donnerstag Sep 18, 2008
RichFaces & Maven - easy setup!
The last days I read a lot about RichFaces and saw this cool live demo. RichFaces sparks my interest. As the JSF Framework RichFaces from JBoss supports much more components as other frameworks and also really cool Ajax features, I started to build my first jee web module using RichFaces.
First I read this quick guide which shows how to build a JEE Webmodul using RichFaces in general. But as I planed to integrate my first example into an existing JEE project build on maven I search a lot to find out how to setup a Maven Web module with RichFaces Support.
Here is my personal quick guide to setup a maven web app with RichFaces:
1.) Add the JBoss Maven repository to your Maven Installation:
first you need to add the following repository description into your setup.xml file located in your Maven root directory:
<!-- JBoss RichFaces Repository -->
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>repository.jboss.com</id>
<name>Jboss Repository for Maven</name>
<url>
http://repository.jboss.com/maven2/
</url>
<layout>default</layout>
</repository>
</repositories>
So later maven will be able to download the necessary components. (I don't know why this framework is not included into the standard maven repository)
2.) Add the RichFaces Dependencies
the next (and final) step is to add the RichFaces Dependencies into your Maven Web Module (I assume that you know how to build a web module with maven).
To find out the right dependencies takes me the most time as I did not found an example on the JBoss RichFaces Homepage. But finally I found these dependency configuration which works fine:
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
<version>3.2.1.GA</version>
</dependency>
</dependencies>
So add these three dependencies into your pom.xml.
That's really all!
I completed my first integration test with the Simple Ajax Echo example at it works perfect !
Now I begin to love RichFaces :-)
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/
New Imixs Kenai Project Page
Today I opened a new Project HomePage on Kenai
http://kenai.com/projects/ix-workflow
Kenai is a social network for connected developers. You can find and collaborate with developers of like mind and passion from around
the globe.
Currently its beta but I think this is a cool thing!
http://kenai.com/
Montag Sep 01, 2008
New Version 1.6 of Imixs IX JEE Workflow
Yesterday I stated to work on new Version 1.6 of IX Workflow API and IX JEE Workflow Server. The new release will include a ReportService. This feature will be implemented as a kind of top-level feature. I decided to include the Report functionality directly into the workflow implementation as lot of people ask for a feature to run reports on a workflow management system.
Read more on
http://www-02.imixs.com:8081/roller/imixsworkflow/
or check out source code :
https://ix-workflow.dev.java.net/source/browse/ix-workflow/
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.
Samstag Jul 19, 2008
Eclipse Ganymede - Plugin Update Sites
Today I had a very hard campaign against Eclipse trying to provide a new Version of the Imixs IX Modeler Plugin on my Update site in the internet.
As I am using new Eclipse Ganymede Version 3.4 I was unable to update my Plugin after I deployed it on my UpdateSite. I did everything as before using Eclipse Ganymede. I update my Plugins and Features and Build all the Features into my Update Site Project. Everything looks ok but after I uploaded the Plugin Site into my WebServer location, Eclipse Ganymede itself refused to install the new Plugin Version!. After a very long period of frustrating search for the error I found out what have changed:
Eclipse Ganymede Plugin IDE generates two new files inside the UpdateSite Project. These Files are "content.xml" and "atrifactes.xml".
I did not know what this files are good for. BUT !!NEVER!! copy these files into your Website location used by the UpdateManager. Eclipse 3.3 has no problem with these files. But Eclipse 3.4 makes a lot of problems when these files are provided by the update site. New features will possibly not be installed.
After I removed the files from the UpdateSite location the new IX Modeler Plugin installed perfect on my Ganymede.
Sonntag Jul 13, 2008
Using Tiny MCE with JSF and Glassfish
If you build a web application using the JSF Framework you can use different widgets using the MyFaces / Tomahawk Components. One of these widgets often used is the t:inputHtml Tag which supports a WYSIWYG Editor. The Editor included in the Tomahawk library is buid from the Kupu Editor. This editor is nice. But if you want to customize this editor you will not found much help. Another WYSIWYG Editor often taken in Web Applications is the TinyMCE Editor. This editor is documented well and you will find a lot of examples how to customize this edior for your web application.
Today I found the following link which explains how to integrate the TinyMCE Editor into a MyFaces application: http://wiki.apache.org/myfaces/WYSIWYG_Editor
I integrated the editor today in my glassfish and replaced my kupu widget with TinyMCE. It was realy simple:
- copy the /tiny_mce directory into the Glassfish root
..[glassfish]/domains/domain1/docroot/ - replace the t:inputHtml Tag inside your jsf page with the following code example:
<script src="/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "fullscreen",
theme_advanced_buttons1 : "fullscreen,undo,redo,cleanup,|,formatselect,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,|,link,unlink,|,forecolor",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "none",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
width : "100%",
height : "260"
});
</script>
<h:inputTextarea id="description_id"
value="#{workitemBean.workitem['htmldetail'][0]}"/>
The result is a nice Editor component which can be customized in a lot of ways.