Recent Notes

Displaying keyword search results 11 - 19
Created by Dr. Xi on January 31, 2011 16:14:06    Last update: January 31, 2011 16:14:06
Sometimes ClassCastException happens when apprently a class is casted to the same class or a parent class. The exception looks like this: java.lang.ClassCastException: X cannot be cast to ... where Y may be the same as X , or a parent class of X . The cause of this error is that X and Y are loaded by different class loaders. You can use the FindClass utility to find all occurances of X and Y in the deployment tree. If there's no duplication of X and Y in the deployment tree, JNDI lookups may be the culprit. Suppose X is loaded by class loader LX and registered under name jndi/Resource . In the context of another loader LY , your code may be looking up...
Created by Dr. Xi on June 01, 2010 16:44:12    Last update: June 01, 2010 16:45:52
I installed JDK 1.6 under C:\jdk1.6.0_20 and unpacked Eclipse GALILEO in C:\local\eclipse . When I launched Eclipse with eclipse.exe , it simply displayed a splash page and shutdown. Running eclipsec.exe displayed some vague errors: C:\local\eclipse>eclipsec Error occurred during... Turning on debug: C:\local\eclipse>eclipsec -debug Start VM: -Dos... The Solution: add -vm option to eclipse.ini : -startup plugins/org.eclipse.equinox.launcher_1...
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 13, 2010 22:52:18    Last update: February 13, 2010 22:52:18
This runtime error happens when the Sun EL implementation is not available. Look for the class com.sun.el.ExpressionFactoryImpl in your deployment package, you probably won't find it, or you'll find a version that can't be loaded in your deployment environment. If you are using Maven to build, you can add the following repository and dependency in pom.xml : <!-- Project dependencies --> <dependencies...
Created by Dr. Xi on February 11, 2010 05:07:48    Last update: February 11, 2010 05:08:20
On Linux, you can use the fuser command to find out who has a file open, or is using a port. For example, if you start Tomcat and get the error "Address already in use: 8080", you want to know which process is already binding to port 8080. # list processes on port 8080 fuser 8080/tcp ...
Created by Dr. Xi on May 05, 2009 19:59:21    Last update: May 05, 2009 19:59:21
Delete a single file: >>> import os >>> file = 'myfile' >>> os.rem... Delete a directory and contents: >>> import shutil >>> dir(shutil) ['Error', ...
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...
Created by Dr. Xi on August 10, 2007 19:53:32    Last update: August 10, 2007 19:53:32
As a Java developer, I often need to find out which Jar file to include on my classpath in order to fix some compilation error (undefined package, class etc). This is a little Perl script I wrote to facilitate this task. #!/bin/perl # find jar containing specified...
Previous  1 2 Next