• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring Hello world is not running in Eclipse

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My MainApp.java code is below

package com.Springexample;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainApp {
  public static void main(String[] args) {
     ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
     Helloworld obj = (Helloworld) context.getBean("helloWorld");
     obj.getMessage();
  }
}

My Hello World Code is

package com.Springexample;

public class Helloworld {
  private String message;

  public void setMessage(String message){
     this.message  = message;
  }
  public void getMessage(){
     System.out.println("Your Message : " + message);
  }
}

And Bean.xml


<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns = "http://www.springframework.org/schema/beans"
  xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation = "http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

  <bean id = "helloWorld" class = "com.Springexample.HelloWorld">
     <property name = "message" value = "Hello World!"/>
  </bean>

</beans>

While i am trying to run this code i am getting error like

Usage: java javassist.tools.web.Webserver <port number> in my eclipse
 
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your Tomcat running at the background? If so, you can shut it down and see.
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your Tomcat running at the background? If so, you can shut it down and see.
 
Ravisankar Saravanan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried stopping the tomcat still its showing the same error
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about restarting Eclipse?
What else error message do you see ?
 
Ravisankar Saravanan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried with restarting the Eclipse still getting same nothing changed in error part
 
Saloon Keeper
Posts: 14711
331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you running the application? How did you create the project? Can you also post the entire output you get after you try to start the application?
 
Ravisankar Saravanan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you I figured it Out I have done a mistake that XML file was not kept in the source folder. XML file was under the same package now it working fine. Thank you all.
 
reply
    Bookmark Topic Watch Topic
  • New Topic