[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Application Frameworks » Other Application Frameworks
 
RSS feed
 
New topic
Author

spring inside eclipse

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Messages: 455

Hi,
I have downloaded and installed eclipse.I want to work in spring framework.But i am very new to spring and eclipse too.I have installed the spring ide(spring-ide_updatesite_2.0.0_v200706271108.zip) inside the eclipse through update manager site.Then i have tried a sample program in the new spring project.First i had selected the interface and typed the GreetingService.java in src folder in the NewSpringProject.

Then i had typed the class file GreetingServiceImpl.java in src folder

After that I had selected an xml file and typed the following code

Finally i have typed the class file HelloApp.java
.
here I am getting the following errors:

BeanFactory cannot be resolved to a type
The import org.springframework cannot be resolved
XmlBeanFactory cannot be resolved to a type
.please guide me why i am getting the following errors and please anyone gude me how to work in spring initially.How to start a program basically in spring.

Thanks
Christophe Verré
Bartender

Joined: Nov 24, 2005
Messages: 11133

In Eclipse, in your project settings, did you set the spring.jar library ? Right-click your project, select Properties... In Java Build Path/Library, you need to add spring.jar.

How to start a program basically in spring.

By using an IDE you are comfortable with !

[SCWCD Wall of Fame] [SCBCD Wall of Fame]
All roads lead to JavaRanch
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Messages: 455

Thankyou.I have added the spring.jar. Now i am getting only one error.

The constructor XmlBeanFactory(FileInputStream) is undefined

Why is it so?

Is it tough working with an ide in initial stage?Then how should i start to work in spring.please do help me.I dont know anything about spring framework.
Christophe Verré
Bartender

Joined: Nov 24, 2005
Messages: 11133

Why is it so?

Because if you look at Spring's API, you'll see that there is no such constructor in XmlBeanFactory. Maybe you wanted to write it like this :


It's ok to use an IDE if you're not going to wasted hours trying to figure out how to configure something Well, it's compiling now, so you should be ok.

[SCWCD Wall of Fame] [SCBCD Wall of Fame]
All roads lead to JavaRanch
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Messages: 455

Hi,
Thanks for your reply.It is working fine.But when i give like this:

I am getting the following error:

May 3, 2008 12:48:58 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [hello.xml]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [hello.xml]; nested exception is java.io.FileNotFoundException: class path resource [hello.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at HelloApp.main(HelloApp.java:14)
Caused by: java.io.FileNotFoundException: class path resource [hello.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:142)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
... 4 more

Sp sunil
Greenhorn

Joined: Jan 20, 2010
Messages: 1

just change the location of hello.xml file

like currently i assume your file should me in root directory of the application but you have to put this file in src folder , in my case i got same error so i changed the location and it is working fine.

Please let us know if you have any issue further.
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Application Frameworks » Other Application Frameworks
 
RSS feed
 
New topic
MyEclipse Enterprise Workbench