Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Spring NoSuchBeanDefinitionException when tried to get bean using Eclipse RCP user interface (Sprig NoSuchBeanDefinitionException when tried to get bean using Eclipse RCP user interface )
Spring NoSuchBeanDefinitionException when tried to get bean using Eclipse RCP user interface [message #1018177] Wed, 13 March 2013 10:12
Akshay Lokur is currently offline Akshay LokurFriend
Messages: 2
Registered: March 2013
Junior Member

I am having applicationContext with one bean definition like below:

	<bean id="test" name="test" class=""></bean>

When I try to get bean using Eclipse RCP UI, though applicationContext.xml is getting loaded, I am getting "NoSuchBeanDefinitionException" when I try to get bean through this applicationContext.
Giving below the stack trace:
Mar 13, 2013 2:32:52 PM prepareRefresh
INFO: Refreshing display name []; startup date [Wed Mar 13 14:32:52 IST 2013]; root of context hierarchy
Mar 13, 2013 2:32:52 PM obtainFreshBeanFactory
INFO: Bean factory for application context []:
Mar 13, 2013 2:32:52 PM preInstantiateSingletons
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'test' is defined
INFO: Pre-instantiating singletons in defining beans []; root of factory hierarchy
	at org.eclipse.swt.widgets.TypedListener.handleEvent(
	at org.eclipse.swt.widgets.EventTable.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendEvent(
	at org.eclipse.swt.widgets.Display.runDeferredEvents(
	at org.eclipse.swt.widgets.Display.readAndDispatch(
	at org.eclipse.ui.internal.Workbench.runEventLoop(
	at org.eclipse.ui.internal.Workbench.runUI(
	at org.eclipse.ui.internal.Workbench.access$4(
	at org.eclipse.ui.internal.Workbench$
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.eclipse.equinox.launcher.Main.invokeFramework(
	at org.eclipse.equinox.launcher.Main.basicRun(
	at org.eclipse.equinox.launcher.Main.main(

The RCP code to load applicationContext is written in its as shown below:
// RCP start method
public void start(BundleContext context) throws Exception {
		plugin = this;

		if (appContext == null) {
			try {
				// appContext = new FileSystemXmlApplicationContext("classpath*:applicationContext.xml");
				appContext = new ClassPathXmlApplicationContext("classpath*:applicationContext.xml");

			} catch (Exception e) {


// Sample getter method
public ApplicationContext getApplicationContext() {
		return appContext;

I have added required spring jar and commons-logging in RCP plug-in dependencies.

Now, when I click on submit button from RCP screen and try to get bean defined in applicationContext (like shown below), I am getting above mentioned error.

public void myBusinessMethodWhichGetsCalledOnClickOfRCPButton() {
		ApplicationContext appContext = Activator.getDefault().getApplicationContext();
                Test t = appContext.getBean("test"); /* getting NoSuchBeanDefinitionException here */

Then why am I getting above exception?

Any help would be extremely helpful.

P.S.: When I run and try to get bean using simple public static void main() method, I am getting it w/o any error.


[Updated on: Wed, 13 March 2013 10:13]

Report message to a moderator

Previous Topic:Smart Save Plugin - Testers Needed
Next Topic:Platform coverage for eclipse Juno SR2
Goto Forum:

Current Time: Thu Oct 22 13:15:40 GMT 2020

Powered by FUDForum. Page generated in 0.01423 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top