Note that there are some explanatory texts on larger screens.

plurals
  1. POorg.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor
    primarykey
    data
    text
    <p>I'm trying to porting an E3.X application to E4 and following an <a href="http://www.vogella.com/articles/Eclipse4MigrationGuide/article.html" rel="nofollow">tutorial</a> by Lars Vogel. I created a view wrapper which extends the DIViewPart class, the view itself which uses dependency injection on the constructor and referenced the view wrapper in my plugin.xml.</p> <p>However, when firing up the application an exception is thrown:</p> <pre> org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in my.application.views.MyView </pre> <p>I have no idea what is going wrong even after several hours of googling. Maybe I'm just searching for the wrong things, but I'm pretty clueless right now. I would be happy if someone could point me out what I'm missing.</p> <p>Just to be sure I appended the affected views source code below:</p> <pre class="lang-java prettyprint-override"> public class MyViewWrapper extends DIViewPart { public MyViewWrapper() { super(MyView.class); } } </pre> <pre class="lang-java prettyprint-override"> public class MyView { public static final String ID = MyView.class.getCanonicalName(); private Label label; @Inject public MyView(Composite parent) { this.label = new Label(parent, SWT.NONE); this.label.setText("My view"); } } </pre> <p>Any help is appreciated and thanks in advance.</p> <p><strong>Edit:</strong> Stefan pointed out that the issue might be related to the fact that e4 does not know the right composite during the constructor call and that the following code should do the trick:</p> <pre> public class MyView { public static final String ID = MyView.class.getCanonicalName(); private Label label; public MyView() { } @PostConstruct public void createPartControl(Composite parent) { this.label = new Label(parent, SWT.NONE); this.label.setText("Sensor view"); } } </pre> <p>Sadly this was not the case. The exception changed but the cause might still be the same:</p> <pre> org.eclipse.e4.core.di.InjectionException: Unable to find matching method to invoke </pre> <p>My assumption is that dependency injection as a whole is not working correctly, but I have no idea why, since I've done everything exactly as in the tutorials I've found. Do I need to add a .e4xmi or something?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload