1 . Application Exception myException can automatically mark transaction for roll back?
- ApplicationException is applied to the myException class
- <exception-class>myException</exception-class> is used inside <application-exception> element in deployment descriptor
- Constructor of myException class calls EJBContext.setRollbackOnly()
- ApplicationException is applied to myException class, and rollback subelement of application-exception is specified as true
2 . If message driven bean allocate resources in PostConstruct lifecycle callback, and releases these resources in PostDestroy, these resources will always be automatically release by container when instance is discarded?
3 . Choose the correct statements of the below?
- Methods of business interface may throw java.rmi.RemoteException
- Methods of local and local home interface may throw java.rmi.RemoteException
- Methods of web service end points interface may throw java.rmi.RemoteException
- Methods of remote and remote home interface must not throw application exception
4 . If client receives application exception?
- Instance is discarded, so client should repeat all operations again
- Client can continue calling the enterprise bean and recover
5 . Local and Remote clients that are enterprise beans, and use BMT can use EJBContext.getRollbackOnly to test whether the transaction has been marked for transaction or not?
6 . if client receives javax.ejb.EJBException then?
- The client knows for sure that the EJB method it invoked has not been completed
- The client does not know if the EJB method it invoked has completed or not
- If the client executes in context of transaction,the transaction is marked for roll back
- If client executes in context of transaction,the client’s transaction,may or may not have been marked for roll back
7 . A method of business interface of CMT bean throws non-application exception, then the client will receive?
- Javax.ejb.EJBTransactionRolledbackexception if bean executes within caller’s transaction and with required transaction attribute
- Javax.ejb.EJBException if bean executes within transaction started by container, and with requiresNew transaction attribute
- Java.rmi.RemoteException if bean executes within caller’s transaction and with required transaction attribute
- Javax.ejb.EJBException if bean executes within caller’s transaction and with Mandatory transaction attribute
8 . Methods that are not assigned to any security role,not annotated with DenyAll, and not included in the exclude-list, are treated by container as —-?
9 . Security roles declared by bean provider\assembler using security-role-ref correspond to users, groups or principals in the operational environment?
10 . Suppose principals of operational environment are mapped to security-role payroll-department, then what element should be used to implicitly map these principals to the logical role payroll?
Choose the one below:
- <security-role>payroll-department</security-role>
- <security-role>payroll</security-role>
- <security-role-ref><role-name>payroll</role-name><role-link>payroll-department</role-link></security-role-ref>
- <security-role-ref name=”payroll-department”><security-role>payroll</security-role></security-role-ref>
Answers
1 : 4 is correct.
ApplicationException is applied to myException class, and rollback subelement of application-exception is specified as true
2 : false.
3 : 3 is correct.
Methods of web service end points interface may throw java.rmi.RemoteException
4 : 2 is correct.
Client can continue calling the enterprise bean and recover
5 : false.
6 : 2 & 4 is correct.
2 . The client does not know if the EJB method it invoked has completed or not
4 . If client executes in context of transaction, the client’s transaction, may or may not have been marked for roll back
7 : 1 & 2 is correct.
1 . Javax.ejb.EJBTransactionRolledbackexception if bean executes within caller’s transaction and with required transaction attribute
2 . Javax.ejb.EJBException if bean executes within transaction started by container,and with requiresNew transaction attribute
8 : unchecked.
9 : false.
They represent logical security view
10 : 3 is correct.
<security-role-ref><role-name>payroll</role-name><role-link>payroll-department</role-link></security-role-ref>