Can't inject entity into the service bean

I tried to inject the metadata and entity-UDC into the service bean. I can assemble project successfully in CUBA studio. But when I run the program, the login screen never show in chrome. If I remarked these four lines, it works fine. Isn’t it supported by CUBA?

public class CitServiceBean implements CitService {
    //Remark from here.
    private Metadata metadata;

    private UDC udc;
    //Remark to here.

    public void GetCITItem() {



What behavior you expect, when you are trying to inject an Entity? It doesn’t make sense. Entity can have lots of instances, and you can load them from database, using DataManager or Persistence. You also can create it through the Metadata.create(UDC.class).

If you want to have single instance of the entity per application, I’d advise you to manually add it in database and load it after application initialization.

I think I can’t inject Metadata.

I don’t think there is a problem with metadata.

Look at tomcat/logs/app.log file. You can find an exception there. Can you attach it?

Thank you. There’s no error in app.log. I changed to another way to solve the issue.