Apache ODE and CLOB issue
I took-over some responsibilities from a recently departed collegue, and with it, i was kinda forced to turn back to JEE world. Not exactly the same technologies and frameworks i am used to, but once you hate some part of something it is likely that you won’t enjoy the other parts.
Anyways, first assignment was to move some WS-BPEL processes from glassfish to Apache ODE. It sounds like it should be easy since WS-BPEL is a standardized and well-acknowledged specification but only an inexperienced and/or naive developer believes that. Standards are never that standard. Only the simplest hello-world can be deployed to more than one (two at most) container without a problem, your JPA application will never port from hibernate to toplink and your standards-compliant webpage will never look like the same in IE. Without some unknown hours/days of hard work, that is.
But for that instance, i got lucky. The hard part was already done and documented (1|2|3) by Hilal Tarakci (still not twitting!), whom i’ve been working closer now. The last problem was the easiest one but helped me steal all the credits. ODE, by default, works using a derby database which doesn’t like CLOBs larger than some size and barfs like this when it encounters one:
java.sql.SQLException: An unexpected exception was thrown ... Caused by: java.sql.SQLException: An unexpected exception was thrown ... Caused by: java.sql.SQLException: Java exception: 'A truncation error was encountered trying to shrink CLOB '' to length 1048576.: org.apache.derby.iapi.services.io.DerbyIOException'. ... Caused by: org.apache.derby.iapi.services.io.DerbyIOException: A truncation error was encountered trying to shrink CLOB '' to length 1048576.
I guess this was somewhat expected because there is a small tutorial in the installation docs of ode, showing how to configure it work on a mysql db. Distribution package also contains DDLs for Oracle, but if you’re already running a postgresql server and don’t want another link in the chain, you’re (not) alone. Without further ado, here are the things you should do.
- Create the database you wish to use on the server (you wish to use).
- Get this SQL piece and execute on it.
- Take this context snippet and place it into your $TOMCAT_HOME/conf/server.xml in <Host> part after modifying as necessary.
- Get a jdbc jar from postgre and place it into $TOMCAT_HOME/lib
- Get this properties file and place it into $TOMCAT_HOME/webapps/ode/WEB-INF/conf
- Start tomcat.
And yes, i mostly got this from the original tutorial. Only thing i did was to edit SQL into the form that postgre would understand. For those of you running something bigger than tomcat, it should be easier to define a JDBC connection on JNDI.