snippetjournal

– notes, snippet codes, and my journal

Archive for December 2013

Apache Velocity projects

leave a comment »

Apache Velocity projects

Velocity Engine 

This is the actual templating engine which does all the work. If you came here because you heard about Velocity somewhere on the web, this is probably the right place to start.

Velocity Tools

This project contains tools and other useful infrastructure to build web and non-web application using the Velocity engine. You will find e.g. code for Struts 1.x integration or the standalone VelocityViewServlet here.

Velocity DVSL 

DVSL (Declarative Velocity Style Language) is a tool modeled after XSLT and is intended for general XML transformations using the Velocity Template Language as the transformation language.

Velocity Texen

Texen is a general purpose text generating utility. It is capable of producing almost any sort of text output. Usually used as an Ant Task, Texen uses a control template, an optional set of worker templates, and control context to govern the generated output.

Velocity Anakia

Essentially an XML transformation tool, Anakia uses JDOM and Velocity Engine to transform XML documents into the format of your choice. It provides an alternative to using Ant’s <style> task and XSL to process XML files.

Velocity Docbook Framework

The DocBook Framework is intended to help you create high quality documentation suitable for online viewing and printing.

Written by snippetjournal

December 31, 2013 at 3:22 am

Posted in Uncategorized

Apache Common IO

leave a comment »

Apache Common IO

Commons IO is a library of utilities to assist with developing IO functionality.

There are six main areas included:

  • Utility classes – with static methods to perform common tasks
  • Input – useful Input Stream and Reader implementations
  • Output – useful Output Stream and Writer implementations
  • Filters – various implementations of file filters
  • Comparators – various implementations of java.util.Comparator for files
  • File Monitor – a component for monitoring file system events

Written by snippetjournal

December 30, 2013 at 7:24 am

Posted in Uncategorized

Spring Framework Ilustration ???

leave a comment »

Spring Ilustration ???

found this image in 176 😀

Written by snippetjournal

December 26, 2013 at 4:03 am

Posted in Collection Link

Tagged with

Jasper Report Sub Report

leave a comment »

Written by snippetjournal

December 23, 2013 at 6:25 am

Error Log4j Pada dua Web App yang di deploy pada Tomcat

leave a comment »

Akhir akhir ini sering mendapat error yang tidak umum 😀 (tidak umum menurut saya, maklum biasa nya hanya ngoding crud saja 😀 ), berikut ini akan saya share error yang di akibatkan log4j yang di gunakan oleh 2 Web application yang di deploy dalam satu tomcat.

berikut error nya :


SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener

java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\xx1\] instead of [C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\xx2\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!

Secara default resource webapp.root pada tomcat di gunakan secara bersama sama. Error dia atas terjadi karena ketika xx2 akan di deploy property webapp.root pada tomcat sudah di inisialisasi terlebih dahulu oleh xx1. sehingga xx1 gagal terdeploy. untuk di ketahui pada tomcat webapp.root di gunakan secara global.

example log4j configuration in web app xx1

  • log4j.appender.myfile.File=/WEB-INF/xx1.log

example log4j configuration in web app xx2

  • log4j.appender.myfile.File=/WEB-INF/xx2.log

Sebenarnya configurasi pada log4j tertulis seperti ini :

  • log4j.appender.myfile.File=${webapp.root}/WEB-INF/xx1.log
  • log4j.appender.myfile.File=${webapp.root}/WEB-INF/xx2.log

Kedua project/web app mengambil dua property yang sama yaitu webapp.root, sehingga mengalami error, untuk mengatasi error seperti ini ada dua pilihan.

  • Definisikan masing masing webapp.root untuk setiap project/web app pada tomcat (webapp/web.xml)

<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>webapp.root.cms2</param-value>
</context-param>

  • Menonaktifkan log4jExposeWebAppRoot, (pada kasus saya, opsi ini mengkibatkan file log tidak terupdate ? )

<context-param>
	<param-name>log4jExposeWebAppRoot</param-name>
    <param-value>false</param-value>
</context-param>

referensi :
http://docs.spring.io/spring/docs/1.2.9/api/org/springframework/web/util/Log4jWebConfigurer.html
http://forum.spring.io/forum/spring-projects/container/24012-dual-deployment-hangs-log4jconfiglistener

Written by snippetjournal

December 20, 2013 at 11:34 am

Posted in Programming

Tagged with , ,

BindException, BindingResult Exception Throw on Error Instead on Controller

leave a comment »

BindException Thrown on bind errors (instead of returning errors to controller method

org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors

Ok, I really spend more than an hour to resolve this error LOL. 😀

Saya mengalami kebingungan karena BindingResult pada spring yang seharus nya melakukan validasi tidak “melempar” hasil exception pada controller, tetapi exception yang di munculkan selalu error pada screen jsp BindException, BindingResult.

Kejadian ini di akibatkan karena pada spring untuk melakukan validasi pada model form harus mengikuti urutan dari model yang bersangkutan, begini contoh nya :

Contoh benar :
@Valid ModelForm modelForm, BindingResult bResult

public String save(@ModelAttribute("modelForm") @Valid ModelForm modelForm, BindingResult bResult, Model model) 
{. . . }

Contoh salah :
@Valid ModelForm modelForm, Model model

public String save(@ModelAttribute("modelForm") @Valid ModelForm modelForm, Model model, BindingResult bResult ) 
{. . . }

reference :
http://forum.spring.io/forum/spring-projects/web/78238-bindexception-thrown-on-bind-errors-instead-of-returning-errors-to-controller-method

Written by snippetjournal

December 18, 2013 at 12:24 pm

Java Code Geek : Interview Collection links

leave a comment »

Written by snippetjournal

December 18, 2013 at 6:47 am

Posted in Collection Link, Programming

Tagged with ,