Friday, 3 August 2007

about Log4j repositoryselector ?

Jboss feedback as launching xtrans.ear,

15:46:19,482 INFO [STDOUT] Log4j repositoryselector set to JNDIRepositorySelector.15:46:19,482 INFO [STDOUT] Log4j property: log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout15:46:19,779 INFO [STDOUT] Log4j property: log4j.appender.FILE.Append = false15:46:19,779 INFO [STDOUT] Log4j property: log4j.appender.CONSOLE.Threshold = INFO15:46:19,779 INFO [STDOUT] Log4j property: log4j.appender.FILE.layout = org.apache.log4j.PatternLayout15:46:19,779 INFO [STDOUT] Log4j property: log4j.appender.CONSOLE.Target = System.out15:46:19,779 INFO [STDOUT] Log4j property: log4j.appender.CONSOLE.layout.ConversionPattern = %d{ABSOLUTE} %-5p [%c{1}] %m%n15:46:19,779 INFO [STDOUT] Log4j property: log4j.appender.FILE = org.jboss.logging.appender.FileAppender15:46:20,279 INFO [STDOUT] Log4j property: log4j.appender.FILE.layout.ConversionPattern = %d{ABSOLUTE} %-5p [%c{1}] %m%n15:46:20,279 INFO [STDOUT] Log4j property: log4j.rootCategory = DEBUG, FILE, CONSOLE15:46:20,279 INFO [STDOUT] Log4j property: log4j.appender.CONSOLE = org.apache.log4j.ConsoleAppender15:46:20,279 INFO [STDOUT] Log4j property: log4j.appender.FILE.File = ${jboss.server.log.dir}/boot.log15:46:20,295 INFO [STDOUT] 15:46:20,295 INFO [XMLServlet] Initialized ApplicationLookup (nameserver_application=Hades, nameserver_url=http://tm003.telia.dk:8080/hades/webservice, application_lookup_min_time_to_live_mins=15, application_lookup_timeout_millis=30000)15:46:20,795 INFO [STDOUT] 15:46:20,795 INFO [XMLServlet] Initialized RequestSender (request_sender_max_connections_per_host=15, request_sender_max_total_connections=30)15:46:20,889 INFO [TomcatDeployer] deploy, ctxPath=/xtrans-web, warUrl=.../tmp/deploy/tmp12278xtrans-EAR-0.1.3.ear-contents/xtrans-web-exp.war/15:46:22,279 ERROR [STDERR] log4j:WARN No appenders could be found for logger (javax.faces.webapp.FacesServlet).15:46:22,279 ERROR [STDERR] log4j:WARN Please initialize the log4j system properly.

What's this Log4j repositoryselector set to JNDIRepositorySelector?

A good example of log4j.properties file

#log4j.rootLogger = DEBUG, File
log4j.rootLogger = DEBUG, Console
#Console -- Console Appender
# Pattern: level, category, message
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.Target=System.out
#Console -- layout for Console appender
# Pattern: level, category, message
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.conversionPattern=[%-5p]: %c.%M %m%n
#File--4 File Appender
log4j.appender.File=org.apache.log4j.FileAppender
log4j.appender.File.File=./log.out
log4j.appender.File.Append=false
#File -- layout for File appender
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.conversionPattern=%n%d{yyyy-MM-dd,HH:mm:ss,SSS} %-5p: %c.%M%m
log4j.appender.FIle.layout.TreadPrinting=true
log4j.appender.FIle.layout.ContextPrinting=false
log4j.appender.FIle.layout.CategoryPrefixing=false

Remove Servlet.class

During starting jboss and launching xtrans-EAR-0.1.3.ear, Jboss Application Server gave ERROR

[WebappClassLoader] validateJarFile(C:\java\jboss-4.0.5.GA\server\default\.\tmp\deploy\tmp25436xtrans-EAR-0.1.3.ear-contents\xtrans-web-exp.war\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

The reason:
This indicates that the SERVLET.JAR file included within xtrans-web.war is unnecessary. This is because the file can be found elsewhere in the JAVA CLASSPATH.

So I just removed it from the /web-inf/lib directory, then error msg disappear.

Wednesday, 18 July 2007

Ant Syntax

Projects
1) name: project name
2)default: the default target to use when no target is supplied.
3)basedir: the base directory from which all path calculation are done.

Targets
A target is a set of tasks that you want to be executed.
A Target can depend on other targets.

It should be noted that Ant's depends attributes only specifies the order in which targets should be executed, it does not affect whether the target that specifies the dependency gets executed if the dependent target did not run. Keep in mind that a target can get executed earlier when an earlier target depends on it.


Path-like Structures:
1)Path-type reference have attributes path and location
2)ClassPath reference have attributes classpath and location

Tasks
A task is a piece of code that can be executed, which may have multiple attributes (or arguments). The value of an attribute might contain reference to a property. properties should be defined prior to tasks.

Property
A property has a name and a value; the name is case-sensitive. Properties may be used in the value of task attributes. This is done by placing the property name between "${" amd "}" in the attribute value.

Static imports in Java 5

Java 5 added an import static option that allows static variables (typically constants) to be referenced without qualifying them with a class name. For example, after import static java.awt.Color;
It would then be possible to write Color background = RED;
instead of Color background = Color.RED;
Adding this "feature" wasn't the best idea because it leads to name pollution and confusion about which class constants come from. Even Sun (see References below) basically advises not to use it!

Can Jackson Deserialize Java Time ZonedDateTime

Yes, but must include JSR310. Thus ZonedDateTime can be deserialized directly from JSON response to POJO field. <dependency> <g...