Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

my first spring program for learning purpose...not working

Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my first spring program for learning purpose...but its not working....this program is from website.
if you have any problem you can check it from this lets come to my problem

step 1 - new --->dynamic web project ----->project name (SpringFirst) ------>finish
step 2 = right click on project --->go to myeclipse--------->add spring capablity
step 3=
package akki;

public class Student {
private String name;

public String getName() {
return name;

public void setName(String name) { = name;

public void displayInfo() {
System.out.println("Hello: " + name);
package akki;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;

public class Test {
public static void main(String[] args) {
Resource resource = new ClassPathResource("applicationContext.xml");
BeanFactory factory = new XmlBeanFactory(resource);

Student student = (Student) factory.getBean("studentbean");

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="";
xmlns:xsi=""; xmlns:p="";

<bean id="studentbean" class="akki.Student">
<property name="name" value="Vimal Jaiswal"></property>

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi=""; xmlns=""; xmlns:web=""; xsi:schemaLocation=""; id="WebApp_ID" version="2.5">

[Thumbnail for folder.JPG]
folder structure
[Thumbnail for error.JPG]
author & internet detective
Posts: 40035
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even though you put that code in a web application, it isn't really one. There's no Spring MVC code. If you re-read step 1 in the tutorial this code is from, it says to create a Java project, not a web project.

What do you have a main method though. Try running the class using Run as > Java application in Eclipse.

akashkum singh
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

please suggest me some good website to learn spring and struts...both looks dificult to learn
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic