Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8401639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:51:44+00:00 2026-06-09T21:51:44+00:00

I try to write a simple Spring 3 console application. I Cant get this

  • 0

I try to write a simple Spring 3 console application. I Cant get this application to run, i always get the error, that there is no main method.
My system is an Ubuntu 12.04 with openjdk-7 installed, and the sts 2.9.2-release.
A simple hello world runs without any problems Edit:(i tested a other project to prove a simple hello world would run).

The Project is managed over maven and i got no errors so far.

I try to reproduce an exsample of a book as follow:

XmlConfigWithBeanFactory.java

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

import org.springframework.core.io.FileSystemResource;

public class XmlConfigWithBeanFactory {

public static void main(String[] args) {
    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader rdr = new XmlBeanDefinitionReader(factory);
    rdr.loadBeanDefinitions(new FileSystemResource(
            "src/xmlBeanFactory.xml"));
    Oracle oracle = (Oracle) factory.getBean("oracle");
    System.out.println(oracle.defineMeaningOfLife());
    }
}

Oracle.java

public interface Oracle {

    public String defineMeaningOfLife();
}

BookwormOracle.java

public class BookwormOracle implements Oracle {

    public String defineMeaningOfLife() {
        return "Encyclopedias are a waste of money - use the Internet";
    }

}

xmlBeanFactory.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.1.xsd">
<!-- oracle bean used for a few examples -->
<bean id="oracle" name="wiseworm" class="BookwormOracle"/>
</beans>

If you want i can also post the maven pom.xml, but i think there is no error all packages are loaded and linked.

I am happy for any hint google and other pages cant help me.
Here is a other example what i am trying to do : http://www.devdaily.com/blog/post/java/load-spring-application-context-file-java-swing-application

And even this post Java can't find method main did not help me

Do i have to start this application as Java Application or AspectJ/JavaApplication. Is it not possible to start a console application that way from eclipse ? Do i need to publish my files to a server ( “add to server” but this isnt working too)?

Whats confused me most is, that i see the main method 🙂 and it is the same syntax as any hello world application.

Thanks so far…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:51:45+00:00Added an answer on June 9, 2026 at 9:51 pm

    I used all the java files and XML files and made it run in my system. It’s working perfectly after fixing two errors, Next time when you post the question please do post the exception or the error message which you get.

    I got two error’s when I ran the project

    First Error:

    which was related to not having “commons-logging” jar file.

    I downloaded the jar file and placed it under the build path.

    You can find the solution here. You also need to change your pom.xml

    Which will be now,

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.test.testapp</groupId>
      <artifactId>testapp</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <dependencies>
      <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>
    </dependencies>
    </project>
    

    Second Error:

    The xmlBeanFactory.xml was refering to a different Spring version.
    I changed to Spring-2.5.jar and updated my build path.

    That’s it, now the project runs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm exploring MSMQ services, and I wrote a simple console client-server application that sends
I have a simple console application that runs calculations in several threads (10-20 of
I am trying to write a simple console app that POSTs to a page
i have written a simple console application just to try boost::thread, i am a
i have created a very simple console application in vb.net that emails me some
I try to write a simple user script to enlarge the picture when you
try to write a composite component that allows mutltiple text inputs. I read that
I try to write Activator action for changing current song rating. I now that
I try to write a Facebook app. This app will communicate with a rfid
I try to write a macro in clojure that sets up a namespace and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.