Recent Notes

Displaying keyword search results 1 - 12
Created by Fang on May 15, 2012 13:04:24    Last update: May 15, 2012 13:04:44
Set the warnLogCategory attribute to log uncaught exception stacktrace: <bean class="org.springframework.web.servl...
Created by Fang on January 10, 2010 00:19:30    Last update: January 31, 2012 16:28:42
Maven is a powerful yet complex tool. When I started learning Maven, the first obstacle was, of course, its complexity. The second, was the lack of documentation that can get me off the ground quickly. This tutorial is an attempt to create a pragmatic guide that aims to get you familiar with Maven in the quickest way possible. The main theme is to get you on some hands on experience to start out and lead you through the creation of a simple Java EE project as quickly as possible. Instead of trying to give you a good read, I try to get you on the journey right away. The topics are roughly ordered by the logical sequence but you can jump around in any way...
Created by nogeek on December 30, 2011 13:54:04    Last update: December 30, 2011 13:54:04
Tomcat 7.0 failed with a SEVERE error without printing a stack trace: Dec 30, 2011 1:21:09 PM org.apache.catalina.core.S... Now it's hard to figure out what's wrong without knowing where things went wrong. Why is Tomcat not logging anything? Tomcat logging is configured by class loader. Logging behaves differently depending on which class loader loaded the logger. You'll need to look at both $CATALINA_BASE/conf/logging.properties and WEB-INF/classes/logging.properties to figure out why the stack trace is not logged. In my case, the web app specific WEB-INF/classes/logging.properties overshadowed the system $CATALINA_BASE/conf/logging.properties and suppressed the stack trace.
Created by nogeek on November 03, 2010 20:52:49    Last update: November 23, 2011 08:54:44
My problem is simple: in my XML data, a timestamp is provided as a long integer (number of milliseconds since the "the epoch"). When I do XSLT, I want to display it as a readable string, such as "Mon Nov 01 18:08:48 CDT 2010". After hours of struggle, I found: It's not so easy to get the job done with JDK 1.6 There are tons of garbage on the web in this space (suggestions, code snippets that simply don't work) Simple Xalan extension functions was the only resource that's somewhat informative. Even there some of the examples don't work. Below is a list of what worked and what didn't. This works: <xsl:stylesheet version="1.0" xmlns:xsl="h... This does not (providing long value to Date constructor): <xsl:stylesheet version="1.0" xmlns:xsl="h......
Created by Fang on November 08, 2011 14:40:57    Last update: November 08, 2011 14:40:57
This error happened when I loaded a JSF page, using Apache MyFaces. From the stack trace it looked like the XML parser failed, but in reality the runtime was not able to load the class specified in the handler-class element - a typo in the class name! That's the price you pay for wiring together components with XML! This was the stack trace: Caused by: org.xml.sax.SAXException: Error Handlin...
Created by nogeek on February 03, 2011 13:08:38    Last update: February 03, 2011 13:14:10
The log line was like this: 2011-01-19 15:16:34,842 INFO [STDOUT] (HDScanne... Note that INFO and timestamp were printed twice. Based on my configuration, I was expecting something like this: 2011-01-19 15:16:34,842 INFO [XmlWebApplicationC... i.e., the logger name should have been XmlWebApplicationContext , not STDOUT ! What was the problem? I found this error message in server.log : 2011-01-19 14:34:38,107 ERROR [STDERR] (main) lo... It turned out that org.apache.log4j.Appender was loaded by my web application class loader, whereas org.jboss.logging.appender.FileAppender was loaded by the JBoss bootstrap class loader. Removing the log4j jar from my web application archive fixed the problem (sine log4j is already available in JBoss). Why was the logger changed to STDOUT? JBoss detects that there's a problem with the log4j configuration and routes all...
Created by Fang on July 17, 2010 03:16:53    Last update: July 17, 2010 03:18:25
This error happens when the ordering of elements in web.xml is not correct. For example, in a <servlet> declaration, <servlet-name> should come before <servlet-class> . If you switch the order of <servlet-name> and <servlet-class> , you'll get this error. This was my stack trace in JBoss when I declared <load-on-startup> before <init-param> for a servlet: DEPLOYMENTS IN ERROR: Deployment "vfszip:/C:/...
Created by Dr. Xi on January 07, 2010 22:56:20    Last update: March 22, 2010 01:52:48
If the error reads: java.lang.LinkageError: Class javax/xml/rpc/encodi... then the class javax.xml.rpc.encoding.TypeMappingRegistry is loaded by two or more different class loaders, and the versions are not compatible. For example, one might be under WEB-INF/lib, another might be loaded through an EJB. The solution is to get rid of the duplicate versions .
Created by Dr. Xi on March 22, 2010 01:50:49    Last update: March 22, 2010 01:50:49
The class org.apache.xerces.jaxp.SAXParserFactoryImpl extends javax.xml.parsers.SAXParserFactory , so casting the former to the latter should not be a problem. This error occurs when there are two copies of javax.xml.parsers.SAXParserFactory loaded by two different class loaders, and you are trying to cast one to the other. Normally, you'll be able to find xml-apis.jar under WEB-INF/lib of the WAR file. Deleting the jar will resolve the problem. java.lang.ClassCastException: org.apache.xerces.ja...
Created by Dr. Xi on February 10, 2010 23:39:37    Last update: February 10, 2010 23:39:37
Example web.xml that includes most frequently used elements. This sample is for Servlet Specification 2.4. <?xml version="1.0" encoding="UTF-8"?> <web-ap...
Created by Dr. Xi on December 12, 2007 20:30:01    Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf : LoadModule python_module modules/mod_python.so ... Python script: import time, os from os.path import basename ...
Created by Dr. Xi on August 15, 2007 18:08:34    Last update: November 08, 2007 22:00:01
I had this problem when deploying a J2EE application into Oracle app server. It worked fine with an OC4J container configured in the default group. But it failed to start with an OC4J container I created. Here's a sample stack trace of the initialization exception: 07/08/14 13:32:46.34 10.1.3.3.0 Started 07/08/1... The problem was, the struts ActionServlet loads commons logging LogFactory, the log factory somehow knows that it needs log4j, but it can't load log4j since it's loaded by a different class loader. The solution for Oracle is to omit commons logging from the list of inherited libraries. Add this to META-INF/orion-application.xml solves the problem: <imported-shared-libraries> <remove-inhe... Actually, this is a quite common problem with commons-logging. If you search the web, you'll find that people have...