Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Could not find satisfiable constructor in codesnippetapp.views.SearchDialog(InjectionException for example in Instant Eclipse book)
Could not find satisfiable constructor in codesnippetapp.views.SearchDialog [message #1365933] Mon, 19 May 2014 05:04 Go to next message
Forumer Forumer is currently offline Forumer ForumerFriend
Messages: 3
Registered: May 2014
Junior Member
I'd appreciate your help!

Using Eclipse Kepler: As a way to learn e4 and RCP, I am working through the exercises in the book "Instant Eclipse 4 RCP Development" by Ram Kulkarni.

In the chapter on "Creating Custom object using DI" I am getting the following exception:

org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in codesnippetapp.views.SearchDialog

I have the following code in handler:

	@Execute
	public void executeFind(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
			IEclipseContext ctx) {
		
		SearchDialog dlg = ContextInjectionFactory
				.make(SearchDialog.class, ctx);

		if (dlg.open() != Dialog.OK)
			return;
	}


SearchDialog constructor is as follows:

	@Inject
	public SearchDialog(Shell parentShell, SnippetRepository repository) {
		super(parentShell);
		this.repository = repository;
	}



Little more of the exception:

Caused by: org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in codesnippetapp.views.SearchDialog
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:342)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at codesnippetapp.handlers.FindHandler.executeFind(FindHandler.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)

Re: Could not find satisfiable constructor in codesnippetapp.views.SearchDialog [message #1371794 is a reply to message #1365933] Wed, 21 May 2014 14:49 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member
Since your constructor needs 'SnippetRepository' there must be an instance of that class in the Context 'ctx', is there ? If not then at some point you'll need to add one to the context that you're 'make'ing from...if you only have one instance you could place it into the MApplication's context and it'll be available from anywhere...
Re: Could not find satisfiable constructor in codesnippetapp.views.SearchDialog [message #1372835 is a reply to message #1371794] Thu, 22 May 2014 00:53 Go to previous messageGo to next message
Forumer Forumer is currently offline Forumer ForumerFriend
Messages: 3
Registered: May 2014
Junior Member
Thanks for your reply!

The Activator.java has the following. If this qualifies, what else could be wrong?

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext bundleContext) throws Exception {
		Activator.context = bundleContext;
		IEclipseContext ctx = E4Workbench.getServiceContext();
		SnippetRepository repository = new SnippetRepository();
		ctx.set(SnippetRepository.class, repository);
	}

Re: Could not find satisfiable constructor in codesnippetapp.views.SearchDialog [message #1373168 is a reply to message #1372835] Thu, 22 May 2014 04:18 Go to previous messageGo to next message
Forumer Forumer is currently offline Forumer ForumerFriend
Messages: 3
Registered: May 2014
Junior Member
Having said that, I am wondering if Activator is being invoked at all! A debug session is not stopping at a breakpoint I put on the "start" method!

Any suggestions?
Re: Could not find satisfiable constructor in codesnippetapp.views.SearchDialog [message #1711411 is a reply to message #1373168] Thu, 15 October 2015 17:28 Go to previous message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
I deleted my message. Posted to the wrong topic. Sorry.

[Updated on: Thu, 15 October 2015 17:30]

Report message to a moderator

Previous Topic:Mixing Eclipse DI with Google Guice?
Next Topic:E4 Perspective not persisted
Goto Forum:
  


Current Time: Fri Apr 26 10:35:21 GMT 2024

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

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

Back to the top