Friday, August 19, 2005

Debugging Log4j XML Errors

If you've validated your log4j.xml with its DTD (log4j.dtd) and there're still errors spewing out at the console of your application server, you can turn on debugging info using -Dlog4j at command line startup. In Tomcat just specify the following at the beginning of the catalina.bat file (in Windows):

set JAVA_OPTS=-Dlog4j.debug

At startup the console will be full of debugging output. It will show which log4j.xml file is read.

I found the culprit file which was residing in a JAR file :p...so I changed the file and updated the JAR file to make the errors go away.

Tuesday, August 16, 2005

Spring Framework checks URLs upon bean initialisation

Spring Framework (1.1.3) does a checking on the URLs specified as parameters to beans when initialising context.

I use XML files to store screen definitions (similar to the one in J2EE Blueprints Pet Store) for page templating (like Tiles), so I have to get the XML files, parse them and populate a Map for usage.

I used a file URL , e.g.

file:///${admin.webroot}/WEB-INF/xml/screens/screendefs_pfrmk.xml

I have some logic to check if I can't get the resource (XML file) via its URL, but before my bean is initialised Spring throws an exception:

Module Name: raidahadmin, Error: weblogic.management.DeploymentException: Error
creating bean with name 'screenManager' defined in ServletContext resource [/WEB
-INF/xml/spring-context-security.xml]: Instantiation of bean failed; nested exce
ption is org.springframework.beans.FatalBeanException: Could not instantiate cla
ss [com.leadingside.core.view.impl.xml.XMLScreenManagerImpl]; constructor threw
exception; nested exception is com.leadingside.core.view.ViewException: F:\bea\u
ser_projects\domains\mydomain\applications\raidahear\raidahadmin\WEB-INF\xmla\sc
reens\screendefs_pfrmk.xml (The system cannot find the path specified) - with ne
sted exception:
[com.leadingside.core.view.ViewException: F:\bea\user_projects\domains\mydomain\
applications\raidahear\raidahadmin\WEB-INF\xmla\screens\screendefs_pfrmk.xml (Th
e system cannot find the path specified)]
}

Good check, so that any errors can be remedied before QA/customers discover it :p...