Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to implement CRUD operations in an RCP application
How to implement CRUD operations in an RCP application [message #534660] Wed, 19 May 2010 18:43 Go to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: May 2010
Junior Member
i'm working on a RCP project with spring and hibernate, i'm a beginner in a plugin developpemnt, i create an action to inserts some fiels in my database using mysql. And i keep getting this exception:

org.springframework.beans.factory.CannotLoadBeanClassExcepti on: Cannot find class [org.springframework.jdbc.datasource.DriverManagerDataSource ] for bean with name 'dataSource'


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

	<bean id="dataSource"
		<property name="driverClassName"><!-- <value>org.hsqldb.jdbcDriver</value> -->
		<property name="url">
		<property name="username">
		<property name="password">

	<bean id="myHibernateProperties"
		<property name="properties">
				<prop key="hibernate.dialect">
				<prop key="hibernate.show_sql">true</prop>

	<bean id="sessionFactory"
		<property name="annotatedClasses">
		<property name="hibernateProperties">
			<ref bean="myHibernateProperties" />
		<property name="dataSource">
			<ref bean="dataSource" />

	<bean id="jdbcExceptionTranslator"
		<property name="dataSource">
			<ref bean="dataSource" />
	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		<property name="jdbcExceptionTranslator">
			<ref bean="jdbcExceptionTranslator" />

	<bean id="UserDAO" class="model.UserDAO">
		<property name="hibernateTemplate">
			<ref bean="hibernateTemplate" />

package identification;

public class AddUserAction extends Action implements
ISelectionListener, IWorkbenchAction {
	private final IWorkbenchWindow window;
	  public final static String ID = "org.eclipsercp.identification.addUser";
	  private IStructuredSelection selection;

	  public AddUserAction(IWorkbenchWindow window) {
	    this.window = window;
	    setText("&Add User...");
	    setToolTipText("Add a user to your users.");

	public void run() {
	ApplicationContext ctx =(ApplicationContext) new FileSystemXmlApplicationContext("/SpringConfig/applicationContext.xml");
		//ApplicationContext ctx=MonContext.getCtx();
		UserService us = (UserService) ctx.getBean("UserService");
		us.ajoutUser("aaaaaaa", "bbbbbb");


and here is the error

Start RCP Application
May 19, 2010 6:23:47 PM prepareRefresh
INFO: Refreshing startup date [Wed May 19 18:23:47 BST 2010]; root of context hierarchy
May 19, 2010 6:23:47 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [D:\stage fin d'etudes\eclipse-rcp-galileo-win32\eclipse\SpringConfig\applicationContext.xml]
May 19, 2010 6:23:49 PM preInstantiateSingletons
INFO: Pre-instantiating singletons in defining beans [dataSource,myHibernateProperties,sessionFactory,jdbcExceptionTranslator,hibernateTemplate,UserDAO,UserBO,transactionManager,UserService]; root of factory hierarchy
May 19, 2010 6:23:49 PM destroySingletons
INFO: Destroying singletons in defining beans [dataSource,myHibernateProperties,sessionFactory,jdbcExceptionTranslator,hibernateTemplate,UserDAO,UserBO,transactionManager,UserService]; root of factory hierarchy
!SESSION 2010-05-19 18:23:38.232 -----------------------------------------------
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -application Identification.application
Command-line arguments:  -application Identification.application -data C:\Users\H\Desktop\workspaces\workspace\Identification -dev file:C:/Users/H/Desktop/workspaces/workspace/.metadata/.plugins/org.eclipse.pde.core/Identification.application/ -os win32 -ws win32 -arch x86 -consolelog

!ENTRY org.eclipse.ui 4 0 2010-05-19 18:23:49.597
!MESSAGE Unhandled event loop exception
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jdbc.datasource.DriverManagerDataSource] for bean with name 'dataSource' defined in file [D:\stage fin d'etudes\eclipse-rcp-galileo-win32\eclipse\SpringConfig\applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource
	at org.eclipse.jface.action.Action.runWithEvent(
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(
	at org.eclipse.jface.action.ActionContributionItem.access$2(
	at org.eclipse.jface.action.ActionContributionItem$6.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 identification.Application.start(
	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(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(
	at org.eclipse.equinox.launcher.Main.basicRun(
	at org.eclipse.equinox.launcher.Main.main(
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource
	at$ Source)
	at Method)
	at Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.springframework.util.ClassUtils.forName(
	... 38 more

i use the springframework 3.0.2 release librairies
I really need your help guys, or if someone has a simple example for crud operations with eclipse RCP using Spring and hibernate!! i will appreciate it
Re: How to implement CRUD operations in an RCP application [message #537504 is a reply to message #534660] Wed, 02 June 2010 16:34 Go to previous messageGo to next message
alan kemp is currently offline alan kempFriend
Messages: 17
Registered: October 2009
Junior Member
i feel your pain. i tried to implement JPA using eclipselink in a RCP plugin and was not successful. i would still like to be able to do this. good luck Cool

Re: How to implement CRUD operations in an RCP application [message #537675 is a reply to message #534660] Thu, 03 June 2010 10:37 Go to previous messageGo to next message
Fadjer is currently offline FadjerFriend
Messages: 7
Registered: July 2009
Junior Member

I'm working since more than 18 months on a RCP application based en Spring an Hibernate. So it possible to implement CRUD operations in an RCP application Wink

Spring 3.0 introduced Spring DM, Spring Dynamic Module to create a Spring application as plugins. It can be intersting for you to check that also ....

For my experience, I'm using Spring 2.5, and I have a separate plugin to manage CRUD operation. This plugins contains all Spring and Hibernate Jars ...

About your example, you should laod the Spring context only once, at start time for example. I noticed that you use FileSystemXmlApplicationContext, instead you should use ClassPathXmlApplicationContext because the Spring file is loaded in memory ...

Good luck
Re: How to implement CRUD operations in an RCP application [message #538749 is a reply to message #534660] Tue, 08 June 2010 14:29 Go to previous message
Martin Lange is currently offline Martin LangeFriend
Messages: 16
Registered: May 2010
Location: Munich, Germany
Junior Member


for me it looks like you are missing some jars in your class path. (... caused by java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource ...)

Previous Topic:Looking to outsource an ERCP project
Next Topic:Problem with org.apache.commons.logging while exporting RCP product
Goto Forum:

Current Time: Wed Jun 20 23:14:41 GMT 2018

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

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

Back to the top