Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Abdul Rahman
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Abdul Rahman
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem must come from "<import resource=""/> ". If you don't want to import other resources, remove this tag.
 
Abdul Rahman
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe,

Thanks...I totally missed that element. ..Your reply made that element visible to my eyes...
It's working now...Thanks a lot...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic