Constructor Injection error

20 views
Skip to first unread message

edu0...@gmail.com

unread,
Aug 30, 2014, 1:10:21 PM8/30/14
to google...@googlegroups.com
Hi,

I am using Guice with my GWT web project successfully, after I installed it as explained here:
https://github.com/google/guice/wiki/Servlets

I can bind servlets, filters, etc.
But when I try to do the easiest injection (construction injection), I get an exception. What may I be doing wrong?

SchuelerFormDMIHandler:

public class SchuelerFormDMIHandler
private ElternDMI elternDmi;

    @Inject
    public SchuelerFormDMIHandler(ElternDMI elternDmi) {
        this.elternDmi = elternDmi;
    }

    ........
}

I get this exception:
RPCManager:Instantiation of class: SchuelerFormDMIHandler threw an InstantiationException - most likely cause is the class represents an abstract class, an interface, an array class, a primitive type, or void; or the class has no zero-argument constructor.undefined

If I create a zero-argument constructor, the field "elternDmi" would not be initiated,... so what am I doing wrong?

ElternDMI is a normal class, it is not an interface, so I want to bind it with itself...
Reply all
Reply to author
Forward
0 new messages