New ONess releases

I have released almost all the ONess modules, they are available for download. It’s also available the first 0.1 version of the order module.

From now the ONess project will be a core architecture integrating latest technologies (Spring, Hibernate, AspectJ, …) with useful tips for developers, and some sample real world apps (party management, inventory management, orders), unless more developers get involved. I’ll use it as test for new releases and technologies, I’m planning to take a look at Hibernate3 and add JSF as soon as posible.

Showing latest comments in roller

Some time ago I found they way to show the latest weblog comments in roller. I found it a very cool feature for both writers, as jroller doesn’t email comments, and readers to check comments in all entries.

You can check the sources for the two files needed:

You can also add #showRecentCommentsListWidth(20 75) to show the titles of the recent comments

Thanks to Lance

Java open source CMS

After following some links my Java open source CMS list has grown:

Lenya seems a good option, maybe I’m too fan of Apache Foundation.

I’ll make a comparison between them, checking

  • Support of standard portlets JSR-168
  • Internationalization (content and administration)
  • Search of web and documents
  • Performance and cluster support
  • License style and price (GPL may be inappropiate)
  • Support available
  • More to come…

It’ll be a good boost for the project chosen by my company because we develop CMS for major enterprises and government institutions.

Update: Added Magnolia

My new job

As many people lately I have started a new job. The enterprise is working hard with CMS systems as Vignette. I’m starting looking for open source alternatives, I’ve heard about exoPlatform, Jetspeed, LifeRay Portal and OpenCMS. A good resorce is OSCOM, although I don’t know why exoPlatform nor Jetspeed are not in the CMS Matrix, I think it’s because they are focused to developers, not end users. The matrix also lacks the language of the projects (PHP, Phyton, Java,…). I prefer Java solutions but maybe I’m biased.

Any comments are appreciated ;).

Maven2

As I’m getting involved in the Maven2 core development, I’ll be writing down my experiencies, so they can be useful for other people.

Features of Maven2:

  • Transitive dependency resolution, say projectA depends on projectB and projectB depends on projectC, then you just need to declare projectB dependency in projectA and projectC will be automatically discovered
  • No more Jelly, you can use POJOs, they’re called MOJOs ;), it’s a funny name in spanish, also used in Austin Powers movie
  • Promotes a standarised directory layout
  • Allows a better repository layout, more scalable, and based on internet domain names

Resources of interest are:

To build it you need to run the bootstrapping process, typing java -jar mboot.jar in the maven-components dir, after creating a ~/.m2/override.xml file that must contain the following entries:

<local>
  <repository>/path/to/m2/repository</repository> (required)
  <online>true</online> (optional)
</local>

Alternatively, you can specify -Dmaven.repo.local=/path/to/m2/repository. Maven2 will be installed in ~/m2.

Hidding stack traces to users in Struts

When an error happens in a web application a stack trace is shown to the user. How to avoid this and show a beautiful error page while logging internally the error that happened? Use the Struts exception handler.

Add the following code to your struts-config.xml. If you don’t want to show different error messages you only need that exception with type=”java.lang.Exception”. The other ones are to show different error messages using Spring exception hierarchy.

  <global-exceptions>
    <exception key="errors.optimistic.locking.failure" path=".error"
               type="org.springframework.dao.OptimisticLockingFailureException"/>
    <exception key="errors.data.access.resource.failure" path=".error"
               type="org.springframework.dao.DataAccessResourceFailureException"/>
    <exception key="errors.data.retrieval.failure" path=".error"
               type="org.springframework.dao.DataRetrievalFailureException"/>
    <exception key="errors.data.access" path=".error"
               type="org.springframework.dao.DataAccessException"/>
    <exception key="errors.transaction" path=".error"
               type="org.springframework.transaction.TransactionException"/>
    <exception key="errors.unknown" path=".error"
               type="java.lang.Exception"/>
  </global-exceptions>

  • errors.optimistic.locking.failure=The object was already modified
  • errors.data.access.resource.failure=Can’t connect to the database
  • errors.data.retrieval.failure=The object you try to access doesn’t exist
  • errors.data.access=Data access error
  • errors.transaction=Transaction error
  • errors.unknown=Unknown error

If you’re using log4j for logging add to your log4j.properties

log4j.rootLogger=ERROR, stdout
log4j.logger.org.apache.struts.action.ExceptionHandler=DEBUG, stdout

# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

This way the stack traces are logged to standard output (in Tomcat this is logged to logs/stdout.txt)