Cuba 7 Service Bean doesn't work

Hello,

I have a Cuba 6 project imported in Cuba 7.
Also I used a RemaiderMailCheckBean that worked in Cuba 6 but now is not working anymore.
I made no changes only import project.

In JMX Console I tested emailer and is ok but if I (force) execute a schedule task nothing happens.
Also I cannot see log.info status.

Is there any changes in Cuba 7 related to (Service)Beans?
I have one Bean_Interface and a ReminderMailCheckBean class placed under modules/core/src/com/company/core.

Hi,

Have you tried to debug the code?

2 Likes

I’ve put a logger but unfortunately the Bean is not called so I don’t see nothing in logs.
Usually I called the Bean from here with Execute.

image

In Cuba 6 I’ve created two files (Bean and Interface) placed under core folder and it works well.
Is mandatory to create a service (In Cuba 7)?

You should attach a debugger from your IDE to a locally running application
and put a breakpoint to your ReminderMailCheckBean bean’s method.
Then you will be able to go along with your code flow, view variables and method results and understand why the code isn’t working as intended.

These links can help you if debugging is a new topic:
https://doc.cuba-platform.com/manual-6.10/debug_setup.html

1 Like

@neutrino,

Your scheduled task is inactive (see 1). Tap button 2 to activate it :slight_smile:.

image

Regards,
Aleksey

Is inactive because I want to test it (Execute Button).
Even if I activate it doesn’t work. Mail history is empty.
I know how to debug in Cuba. The problem is if I put a breakpoint or use a logger and (manually) execute the bean, nothing happens. The bean is not triggered.
However my question is if it’s ok to use Bean under core directory or in Cuba 7 is mandatory to have a Service?
image

However my question is if it’s ok to use Bean under core directory or in Cuba 7 is mandatory to have a Service?

Having interface is not mandatory. A lot of Spring beans in Platform itself do not implement interfaces. However there are some corner cases (e.g. for beans which are exposed to JMX).

Have you tried to change your ReminderMailCheckBean to implement an interface, would it make it work?

is if I put a breakpoint or use a logger and (manually) execute the bean, nothing happens. The bean is not triggered.

Manual Execute button (in scheduled task browser) calls this method:
com.haulmont.cuba.core.app.scheduling.SchedulingServiceBean#runOnce

You can put breakpoint there and see why code execution does not reach your bean’s code.

1 Like