GridPulse

as stimulating as black coffee and just as hard to sleep after.

Archive for June, 2008

Some tips on porting Spring web applications to OC4J

2 comments

As OC4J has some drawbacks, here are some tips on porting Spring Framework 2+ web applications.

1. Forget about XML Schema, use DTD’s

As I was about to touch the first base, after throwing my exploded WAR in j2ee applications, OC4J started complaining about XML issues. This is what I mean:


javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [oracle.xml.jaxp.JXDocumentBuilderFactory@1571dff] does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.

Yea, …nasty. As you don’t want to place Xerces and Xalan in your JRE/JDK lib, all you must do is strip the XML Schema related information and use Spring DTD’s.

2. Use ContextLoaderServlet, bootstrap listeners are for smart containers!

Oracle IAS Logo

Don’t use ContextLoaderListener. It won’t work, as OC4J is Servlet 2.3 compliant and does not enforce loading of Listeners before load-on-startup Servlets. So, to escape the bean not found hell, use ContextLoaderServlet.


<servlet>
<servlet-name>context</servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

Read more about it in the Spring Framework ContextLoaderServlet javadoc.

3. Specify UTF-8 encoding

No encoding filters needed, as oposed to the Tomcat crowd. All you need to do is edit global-web-application.xml and make sure that you specify default-charset. Read more about it in the web module configuration files documentation at Oracle.

Example:

<orion-web-app
jsp-cache-directory="./persistence"
servlet-webdir="/servlet"
development="false" jsp-timeout="0"
default-charset="UTF-8" >

Written by Bogdan

June 17th, 2008 at 7:51 pm

Posted in Development,Java

Looking forward to eLiberatica 2009

leave a comment

eLiberatica 2008 is over, long live eLiberatica.

It’s been a great conference, with wonderful speakers and just as wonderful participants, you really should take a look at the conference website.

eLiberatica 2008 Speakers

The eLiberatica 2008 speakers

The main topics of the conference have been open source adoption in the enterprise, open source business models and licensing. Conferences like eLiberatica raise awareness and promote open source in a fun and extremely interactive way.

Oh yeah, Microsoft came, and they were incredibly friendly and sincere and proved the community one more time that they are not evil, they just want to sell stuff in this new world.

For me, the most interesting parts were the presentations made by Mozilla’s David Ascher, ActiveState’s Shane Caraveo, Navarik’s Bill Dobie and surprisingly the talk given by Constantin Teodorescu, part of the Romanian Ministry of Communications and Information Technology.

img_0520.JPG

I got some new ideas, confirmed some old ones, met some interesting people and generally had a lot of fun.

At the end of the conference, the O’Reilly rep did something that I extremely liked. They donated all the books that weren’t sold to the four universities present at the conference, quietly, the kind of thing that makes you respect them even more.

Written by Bogdan

June 1st, 2008 at 8:10 am

Posted in Open Source