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...

No comments: