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 4091460
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:22:10+00:00 2026-05-20T19:22:10+00:00

So far I have just used Spring beans that are singletons but now I

  • 0

So far I have just used Spring beans that are singletons but now I want to make it where I have a scope="prototype" bean and instantiate it each time I need a new instance.

In the application context I have:

<bean id="processDoNewDocSearch_Spr" class="org.jadefalcon.demo.server.processes.ProcessDoNewDocSearch_Spr" scope="prototype"/>

The actual test bean class is:

public class ProcessDoNewDocSearch_Spr {

    @Resource(name = "savedsearchesService")
    private SavedSearchesService savedsearchesService;

    public ProcessDoNewDocSearch_Spr () {

    }

    public void Main () {
        SavedSearches ss1 = savedsearchesService.get(3);
        String test= ss1.getSearchname();
        System.out.print( "Search name: " + test);
    }


}

And I am trying to instantiate it like this and call the Main() method:

    ApplicationContext applicationContext = new ClassPathXmlApplicationContext ( "applicationContext.xml" );
    ProcessDoNewDocSearch_Spr processDoNewDocSearch_Spr = ( ProcessDoNewDocSearch_Spr ) applicationContext.getBean ( "processDoNewDocSearch_Spr" );
    processDoNewDocSearch_Spr.Main();

Its not working and I am getting some error about the file WEB-INF/spring.properties not being there, when it is, there is no problem with my application when I remove everything related to the ProcessDoNewDocSearch_Spr class, I am wondering if I am doing this correctly. Thanks

EDIT: Here is the error message I am getting:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [WEB-INF/spring.properties] cannot be opened because it does not exist
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [WEB-INF/spring.properties] cannot be opened because it does not exist
    org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
    org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663)
    org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:638)
    org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)

EDIT: In the root of my application I have a file called .classpath and in it I have, among other entries,

    <classpathentry kind="output" path="target/spring-hibernate-mysql/WEB-INF/applicationContext.xml"/>
<classpathentry kind="output" path="target/spring-hibernate-mysql/WEB-INF/spring.properties"/>
    <classpathentry kind="src" path="src/main/webapp/WEB-INF/spring.properties"/>
    <classpathentry kind="src" path="src/main/webapp/WEB-INF/applicationContext.xml"/>
  • 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-05-20T19:22:11+00:00Added an answer on May 20, 2026 at 7:22 pm

    When you are loading the applicationContext.xml file from the classpath, you must make sure that the applicationContext.xml file is in the runtime classpath for your application. Runtime classpath (as in, after deployment and/or outside of an IDE) is often different than the build time classpath.

    Classpath info

    On windows, your classpath is an environment variable that you set by accessing system advanced stuff. To keep your classpath from getting giant, I suggest that you create C:\lib and c:\classes directories. Add the c:\classes directory to the classpath and drop any classes in that directory. For jars, each jar must be listed on the classpath. I put them in c:\lib so I know where to look for them. then list each jar in the classpath.

    Here is what applies to you. With the setup I described, you can drop your applicationContext.xml file in your c:\classes directory and it will also be in the class path.

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

Sidebar

Related Questions

I have used just Windows for programming so far. Now, I have an internship
I've just switched from radrails to netbeans. So far, so good. But I have
I have a semi-comprehensive KO setup. But so far I have only used KO
I have code blindness, it's like snowblindness, just wth far too much code. I
So far I have the expression: http://[^\.]*\.mydomain\.com/((.*?)) Which matches... http://www.mydomain.com/Images/favicon.ico But I really dont
So far I have been creating Web Portal but recently I had a request
So far I have managed to write some code that should print the source
i have a property editor (descendant of TPropertyEditor) that is used to edit a
I'm new to Spring MVC and Freemarker. So far I've used JSF and I
In one app, I have a task to create files that will be used

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.