Thursday, September 22, 2005

Tips: Making Hibernate 3.0 work with Sun App Server 8.1

I am struglling a bit recently on making a J2EE references architecture
(JSF 1.1 + Hibernate 3.0) work for our Sun App Server 8.1. for a local
project here. It work finally, here what I have learn:

1. Always catch runtime exception
Remember to catch the runtime exception in your java program whenever
you calling any hibernate functions. Most of Hibernate exceptions are
runtime, which mean by default most of programmer, including myself
will “forgot” to catch it, and issue printStackTrace( ) to find out the
actual cause of the problem.

2. Hibernate require few reflection
permissions for data mapping and reflection, adds the following
permissions to your appserver server.policy, which is
located at $AppServer8InstallDir/domains/domain1/config.

grant {
permission java.util.PropertyPermission "*", "read";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.RuntimePermission "getProtectionDomain";

and finally

3. Copy Hibernate libraries (together with the runtime libraries, such as
your JDBC driver) to the Sun Java Application Server Class Path. For
Sun App Server 8.1, this will be at
Restart your application server.. that's all

No comments: