geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul.newp...@targetgroup.net
Subject Possible class path class loader problem when using Spring ClassPathXmlApplicationContext class
Date Wed, 21 Sep 2005 10:52:13 GMT
I have an application that uses Spring to interface with Hibernate, which 
in turn accesses data via JDBC.

In Spring you can define a configuration file (applicationContext.xm) and 
embed it in your class structure, at the package level, like so

net/targetgroup/broker/hibernate/applicationContext.xml

I have a class that loads up this configuration file, using the Spring 
ClassPathXmlApplicationContext class:

static final ApplicationContext springApplicationContext = new 
ClassPathXmlApplicationContext(
"net/targetgroup/broker/hibernate/applicationContext.xml");

This code effectivley loads the application context from the classpath, 
and as my class that calls the above line of code is in the package 

net.targetgroup.broker.hibernate

then by rights the applicationContext.xml should be in the classpath as 
well, as its at the same level in the package hierarchy as the class 
trying to load it.

The javadoc for the Spring class is here 

http://www.springframework.org/docs/api/org/springframework/context/support/ClassPathXmlApplicationContext.html


This all works fine in Websphere 5.1. When I export my EAR from WSAD and 
try and deploy it into Geronimo I get the stack trace below. This implies 
to me that the classpath is somehow different to what it shuld be, but how 
can this be ? If the class running is 

net.targetgroup.broker.hibernate.HibernateAttributes

then how come it cannot find the resource

net/targetgroup/broker/hibernate/applicationContext.xml

in the class path ? Is there some difference in how classpaths or 
classlaoding is handled between Websphere 5.1 and Geronimo ?


Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: 
IOException parsing XML document from class path resource 
[net/targetgroup/broker/hibernate/applicationContext.xml]; nested 
exception is java.io.FileNotFoundException: class path resource 
[net/targetgroup/broker/hibernate/applicationContext.xml] cannot be opened 
because it does not exist
        at 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:176)
        at 
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:125)
        at 
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:141)
        at 
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
        at 
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81)
        at 
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268)
        at 
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81)
        at 
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
        at 
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:57)
        at 
net.targetgroup.broker.hibernate.HibernateAttributes.<clinit>(HibernateAttributes.java:26)
        ... 7

Paul Newport
Systems Consultant
Tel:  +44  (0) 117 917 0600
Fax: +44 (0) 117 917 0660

Target
www.targetgroup.net

**********************************************************************
DISCLAIMER.
This message is intended only for the use of the Addressee and may
contain information that is PRIVILEGED and CONFIDENTIAL. 
If you are not the intended recipient you must not copy, 
distribute or take any action or reliance upon it. 
The content of this message may also contain personal 
views of an employee of this company and does
not necessarily represent the view of the company.
**********************************************************************
This message has been scanned by Norton Anti-Virus. 
It has also been scanned by MAILsweeper to enforce our e-mail 
policy. If you have any concerns or comments about the content 
of this message, please  e-mail support@targetgroup.net.
**********************************************************************



_____________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
Mime
View raw message