Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.507 :

Posted: Sat Jun 03, 2017 8:38 am
by johnlong
Make Y implement MessageListener instead of MessageDrivenBean.
is marked as correct
Make Y implement MessageListener also.
is marked as incorrect

This means that MDB would be not valid in case if it implements both MessageListener and MessageDrivenBean, which is not correct.
The question does not say what is required, it just asks to fix the code. You can fix it by just adding required MessageListener interface to the current implements clause.

Re: About Question enthuware.oce-ejbd.v6.2.507 :

Posted: Sat Jun 03, 2017 9:53 pm
by admin
Did you read the explanation?
Y does not implement the methods from the MessageDrivenBean interface (ejbRemove and setMessageDrivenContext) so making it implement MessageListener without removing MessageDrivenBean from its implements clause will not solve the problem.

Re: About Question enthuware.oce-ejbd.v6.2.507 :

Posted: Sat Jun 10, 2017 8:51 am
by johnlong
I did, but did not understand. Would you please explain why it is important to remove MessageDrivenBean from its implements clause.

Re: About Question enthuware.oce-ejbd.v6.2.507 :

Posted: Sat Jun 10, 2017 11:56 pm
by admin
If a class says it implements MessageDrivenBean interface, then it would have to implement all its methods (otherwise declare the class abstract). The given class does not contain implementations for ejbRemove and setMessageDrivenContext and is neither declared abstract.

Re: About Question enthuware.oce-ejbd.v6.2.507 :

Posted: Sun Jun 11, 2017 9:17 am
by johnlong
I see, thank you for explanation.