Tapestry, hibernate application (no.5)

A few years ago I was writting some simple tutorials about using hibernate with tapestry to build a simple application. I’ve used Tapestry 3, 4 and I found it reliable to build applications which are still in production. I could consider myself a Tapestry fan and as such I am disappointed a bit to write this article since I was expecting to find no need for it. My goal was to build a simple example of Tapestry – Hibernate application using Tapestry 5....

June 14, 2009 · len

A bit about hibernate cache

One of the common mistakes when using hibernate is to think: “no problem, hibernate handles the cache for me”. Wrong! By default hibernate does not cache anything. Well, as far as I understand it cache things in the session cache, but this is usually not relevant. First here is what cache refers to in hibernate: session cache, enabled by default, but with a lifetime equals to the session second-level cache, controlled by: hibernate....

March 4, 2009 · len

unsupported keyword OID.2.5.4.17

The problem Exception in thread "main" java.io.IOException: unsupported keyword OID.2.5.4.17 at com.sun.net.ssl.internal.ssl.AVA.<init>(DashoA12275(Compiled Code)) at com.sun.net.ssl.internal.ssl.RDN.<init>(DashoA12275(Compiled Code)) at com.sun.net.ssl.internal.ssl.X500Name.a(DashoA12275(Compiled Code)) at com.sun.net.ssl.internal.ssl.X500Name.<init>(DashoA12275) at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a(DashoA12275) at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a(DashoA12275) at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a(DashoA12275) at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.connect(DashoA12275) at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getInputStream(DashoA12275) What’s your fault when a client running your application for more than 5 years is now receiving this error when its security provider finally upgraded it’s certificates to include: OID.2.5.4.17=<9 digit zip> now standard in almost all certificates. Upgrade you might say but this is not simple considering that the client is AIX based:...

February 27, 2009 · len

A bit of hibernate optimization

The context Assume you are dealing with a hibernate operation which requires to copy a lot of objects in the database. For instance you are having 2 objects as described in the diagram bellow: budget and entries and you want to duplicate the budget and all it’s entries for some operation. There are several way to do this. Budget - entries First approach In hibernate usual approach this is done most of the time as something similar to:...

February 10, 2009 · len

Remote java debug

This is something which should be know be every java developer: how to enable remote debugging of your java application. The solution is remarcable simple: export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" and the start your application normally. You can use your IDE of choice for the debugging. Here is a screenshot of the eclipse configuration: Remote java debug

January 10, 2009 · len

Secure JBoss JMX Console

Since JBoss can now be installed from a zip file it comes with a default unsecured jmx-console. This is unacceptable for production so here is the method to secure the jmx-console using http authentication (applies to JBoss 4.2.2.GA). 1. Edit jboss/server/default/deploy/jmx-console.war/WEB-INF/web.xml and uncomment the security-constraint element: <security-constraint> <web-resource-collection> <web-resource-name>HtmlAdaptor</web-resource-name> <description>An example security config that only allows users with the role JBossAdmin to access the HTML JMX console web application </description> <url-pattern>/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>JBossAdmin</role-name> </auth-constraint> </security-constraint> 2....

December 8, 2008 · len

JBPM optimization

I am quite a fan of BPM concepts and since for the time JBPM is the most know implementation which I have used already in several projects I am stuck with it. Yet it’s one of the more complex-inefficient models I have seen. Enough cause to loose a few days. The context The application was tested with a few tens of workflows and works reasonable. Increasing the number of workflows by an order of ten and you have long waiting minutes ahead just for the simple task of finding the TaskInstances....

October 30, 2008 · len

Another way to use Quartz in JBoss

I was explaining here how to create a Quartz job using the standard Quartz-ra service which comes bundled with JBoss. The method is rather limited, or I was not able to find the proper documentation on how to register new jobs on the fly. This is why in this post I will show how to access the quartz scheduler directly. Note: everything here applies to JBoss 4.2.2GA Remove the existing Quartz You need to remove the existing Quartz-ra and quartz....

October 13, 2008 · len

Which server side for a Flex app

Context choose the server-side technology for a flex application java based Randoms flex supports HttpService, WebService or RemoteObject first thought: HttpService -> ServletDispatcher -> Service -> Java -> DB -> XML -> HttpService. NO: we are in the future, something like that must already exist, I would have done that 5 years ago except for Flex which didn’t existed then RemoteObject requires a special server side application such as BlazeDS seems simple enough and I like that you only have a few xml files to define your services which you associate with your java classes seems the only choice if you need real-time messaging which is not the case here RemoteObject communication uses a binary communication protocol which is bad if client technology is going to change and is difficult to sniff/debug and/or test without the server....

April 21, 2008 · len

Which technology for your next webapp?

I am faced with a new web project for which I have to choose the technology to use it. Five years ago I was in the same position and I chose Tapestry. It proved to be a very good choice (1, 2, 3) and I am still able to modify and adapt that code without much difficulty. However now there are so many rich web interfaces which I cannot ignore....

April 8, 2008 · len