Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Spring Hello world is not running in Eclipse

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
 
Ranch Hand
Posts: 1871
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your Tomcat running at the background? If so, you can shut it down and see.
 
Himai Minh
Ranch Hand
Posts: 1871
12
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I tried stopping the tomcat still its showing the same error
 
Himai Minh
Ranch Hand
Posts: 1871
12
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I tried with restarting the Eclipse still getting same nothing changed in error part
 
Saloon Keeper
Posts: 11881
253
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Did you miss me? Did you miss this tiny ad?
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic