lunes, 27 de agosto de 2007

JSTL taglibs

Desde el java forum:

Your setup/config for JSTL seems ok for the most part.
You shouldn't need c.tld anywhere in the WEB-INF directory.
It is already encapsulated in standard.jar.
All you need to run JSTL are the jar files in the WEB-INF/lib directory. Anything else is unnecessary extra, and can actually hurt rather than help.

>java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/Tag
The class not found is a standard part of the JSP/Servlet API - not actually part of JSTL. The class should already be present via the jsp-api.jar file in [TOMCAT]/common/lib directory.
Sometimes the "classNotFound" error occurs if the class appears twice in the classpath.

Have you got any other jar files in your web-inf/lib directory that might conflict with this? maybe j2ee.jar?
You should NOT have servlet.jar, servlet-api.jar, jsp-api.jar or ANY jar file that has the jsp/servlet classes in your WEB-INF/lib directory, as they confuse the container.
Also check the /shared/lib directory

Maybe try it from scratch with a completely new web app.
Put ONLY jstl.jar and standard.jar in the WEB-INF/lib directory

jueves, 23 de agosto de 2007

Batch in JAR

Para distribuir una clase a correr en batch:

1 - Poner las librerias en el manifest.MF referenciandolas con lib\
2 - Crear el Jar incluyendo el manifest con la main class
3 - Crear un .bat con "java -jar jarname.jar %1 %2" donde %1, %2, etc son los parametros
4 - Crear una carpeta lib con todas la librerías referenciadas en el manifest y log4j.xml
6 - Distribuir (posible ZIP) Jar, carpeta lib, .bat y configuration files (like appctx.xml)
|-- jarname.jar
|-- applicationContext.xml
|-- batname.bat
`-- lib
|-- lib1.jar
|-- lib2.jar
|-- lib3.jar
`-- log4j.xm

martes, 14 de agosto de 2007

MIME type from file

Para obtener el mime type de un file usar la clase javax.activation.MimetypesFileTypeMapde activation.jar de sun.

jueves, 9 de agosto de 2007

Log4j logging

Buen quick start de logging con log4j http://www.developer.com/open/article.php/10930_3097221_1
y el manual oficial http://logging.apache.org/log4j/docs/manual.html

Basico:
1 - poner el jar en el path
2 - poner log4j.properties en la source folder
3 - en el properties agregar log4j.logger.com.matanga = DEBUG
4 - en el codigo loguear Logger.getLogger("com.matanga").debug("logueando matanga");


Defino un nuevo appender de tipo FileAppender, pero se loguea también al appender de root (stdout)..... como lo restrinjo?

miércoles, 1 de agosto de 2007

Web Project Model

Modelo Maven http://maven.apache.org/

Modelo Candy (Candy for AppFuse) para integrar con Eclipse.