This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes Runtime error while running a simple spring application - newbie in spring framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Runtime error while running a simple spring application - newbie in spring framework" Watch "Runtime error while running a simple spring application - newbie in spring framework" New topic
Author

Runtime error while running a simple spring application - newbie in spring framework

Abdul Rahman
Ranch Hand

Joined: Jul 04, 2008
Posts: 63
Hi,

I'm trying to run a simple spring application (from developersbook.com) in myeclipse. I'm getting the below error:

May 26, 2009 7:23:49 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@c40c80: display name [org.springframework.context.support.ClassPathXmlApplicationContext@c40c80]; startup date [Tue May 26 19:23:48 IST 2009]; root of context hierarchy
May 26, 2009 7:23:51 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [hello.xml]
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Resource location must not be empty
Offending resource: class path resource [hello.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:72)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:162)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:145)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:130)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:468)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:363)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:173)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:76)
at org.spring.abdul.client.TestClient.main(TestClient.java:16)

I've added spring.jar in my library.
The rest files are fine. The files are very basic and nothing much logic in any of the files.
Can anyone tell me what this error mean ? what and where i'm missing ???

Any help in this regard will be highly appreciated.

Thanks

Abdul
SCJP5, SCWCD5, [scwcd wall of fame]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Resource location must not be empty
Offending resource: class path resource [hello.xml]

So hello.xml looks to be the problem. Please post it here. Thanks. Actually post all your configuration files, if there is more than just the hello.xml

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Abdul Rahman
Ranch Hand

Joined: Jul 04, 2008
Posts: 63
Hi Mark,

I've just one config file (hello.xml).

hello.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" >
<beans default-autowire="no" default-dependency-check="none" default-destroy-method="" default-init-method="" default-lazy-init="false">
<description>Spring hello application</description>
<import resource=""/>

<bean id="helloBean" class="org.spring.abdul.service.HelloService">

<property name="hello">
<ref bean="helloImpl"/>
</property>

<property name="bye">
<ref bean="byeBean"/>
</property>
</bean>

<!-- <bean id="nameBean" class="org.spring.abdul.bean.NameBean" /> -->
<bean id="helloImpl" class="org.spring.abdul.impl.HelloImpl"></bean>
<bean id="byeBean" class="org.spring.abdul.impl.ByeImpl"></bean>


</beans>

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

The problem must come from "<import resource=""/> ". If you don't want to import other resources, remove this tag.


[My Blog]
All roads lead to JavaRanch
Abdul Rahman
Ranch Hand

Joined: Jul 04, 2008
Posts: 63
Hi Christophe,

Thanks...I totally missed that element. ..Your reply made that element visible to my eyes...
It's working now...Thanks a lot...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Runtime error while running a simple spring application - newbie in spring framework
 
Similar Threads
Quartz in spring
Spring 3.0.2 and Active MQ 5.4.1 Issues
Configuration problem:
[beans.xml] cannot be opened because it does not exist
deployment in weblogic 10.1