Act now and download your Oracle 1Z0-895 test today! Do not waste time for the worthless Oracle 1Z0-895 tutorials. Download Updated Oracle Java Platform, Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Exam exam with real questions and answers and begin to learn Oracle 1Z0-895 with a classic professional.


♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1Z0-895 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1Z0-895 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1Z0-895-exam-dumps.html

Q21. Which two are true about the client view of a message-driven bean? (Choose two.) 

A. References to message destinations can be infected. 

B. References to message destinations cannot be looked up in the client's JNDI namespace. 

C. Clients of a message destination need to know that the destination is listened to by a pool of message consumers, 

D. Clients of a message destination do NOT need to know that the destination is listened to by a message-driven bean. 

Answer: BC 

Explanation: Client components do not locate message-driven beans and invoke methods directly on them. Instead, a client accesses a message-driven bean through, for example, JMS by sending messages to the message destination for which the message-driven bean class is the MessageListener. 

Reference: The Java EE 6 Tutorial, What is a Message-Driven Bean? 


Q22. You are writing a client that sends a message to a JMS queue. 

What two statements are true? 

A. You cannot use resource injection to access a JMS destination from a Java EE application client. 

B. You can use resource injection to access a JMS destination from a servlet. 

C. You must use a JNDI lookup to access a JMS destination from a standalone Java class. 

D. You cannot use a JNDI lookup to access a JMS destination from a session bean. 

Answer: BC 

Explanation: B: In addition to injecting a connection factory resource into a client program, you usually inject a destination resource. Unlike connection factories, destinations are specific to one domain or the other. 

Note: 

* A destination is the object a client uses to specify the target of messages it produces and the source of messages it consumes. In the PTP messaging domain, destinations are called queues. In the pub/sub messaging domain, destinations are called topics. 

* In addition to looking up a connection factory in a client program, you usually look up a destination. Unlike connection factories, destinations are specific to one domain or the other. To create an application that allows you to use the same code for both topics and queues, you cast and assign the destination to a Destination object. To preserve the semantics of queues and topics, however, you cast and assign the object to a destination of the appropriate type. 

For example, the following line of code performs a JNDI lookup of the previously created topic 

jms/MyTopic and casts and assigns it to a Destination object: 

Destination myDest = (Destination) ctx.lookup("jms/MyTopic"); 

The following line of code looks up a queue named jms/MyQueue and casts and assigns it to a 

Queue object: 

Queue myQueue = (Queue) ctx.lookup("jms/MyQueue"); 


Q23. Which is a valid use of the EJB 3.x TimerHandle object? 

A. To retrieve all active timers associated with this bean 

B. To adapt EJB 3.x timers to EJB 2.1 and earlier timers 

C. To obtain a seralizable timer handle that may be persisted 

D. To be implemented by EJB classes that are to be registered with the timer service 

Answer:

Explanation: The TimerHandle interface allows the bean provider to obtain a serializable timer handle that may be persisted. 

Since timers are local objects, a timer handle must not be passed through a bean's remote business interface, remote interface or web service interface. 

Reference: javax.ejb, Interface TimerHandle 


Q24. Which statement is correct about a Java EF client of a message driven bean? 

A. The client can use JNDI to obtain a reference to a message destination. 

B. The client can use JNDI to obtain a reference to a dependency injection. 

C. The client can use JNDI to obtain a reference to a message-driven bean instance. 

D. The client can use JNDI to look up a reference to the message-driven bean's home interface. 

Answer:


Q25. A Java EE application server has four different security realms for user management. One of the security realms is custom made. This realm supports only individual user entries, no grouping of users, and is used by the application. Which two statements are true? (Choose two.) 

A. EJB developers cannot use the isCallerInRole method. 

B. The annotation @RunAs(“AAA”) can still be used for this application. 

C. All security roles need a role-link entry in the deployment descriptor. 

D. All security roles can be mapped successfully to individual users in the realm. 

Answer: BD 

Explanation: 

Not A, not C: A.security role reference.defines a mapping between the name of a role that is called from a web component using.isUserInRole(String role).and the name of a security role that has been defined for the application. If no.security-role-ref.element is declared in a deployment descriptor and the.isUserInRole.method is called, the container defaults to checking the provided role name against the list of all security roles defined for the web application. Using the default method instead of using the.security-role-ref.element limits your flexibility to change role names in an application without also recompiling the servlet making the call. 

For example, to map the security role reference cust to the security role with role name bankCustomer, the syntax would be: 

<servlet> 

<security-role-ref> <role-name>cust</role-name> <role-link>bankCustomer</role-link> </security-role-ref> 

</servlet> 

Note: 

* A realm is a security policy domain defined for a web or application server. A realm contains a collection of users, who may or may not be assigned to a group. 

* The protected resources on a server can be partitioned into a set of protection spaces, each with its own authentication scheme and/or authorization database containing a collection of users and groups. A realm is a complete database of users and groups identified as valid users of one or more applications and controlled by the same authentication policy. 

* In some applications, authorized users are assigned to roles. In this situation, the role assigned to the user in the application must be mapped to a principal or group defined on the application server. 

* A role is an abstract name for the permission to access a particular set of resources in an application. A role can be compared to a key that can open a lock. Many people might have a copy of the key. The lock doesn’t care who you are, only that you have the right key. 

Reference: The Java EE 6 Tutorial, Declaring and Linking Role References 


Q26. A developer examines a list of potential enterprise applications and selects the most appropriate technologies to use for each application. 

For which two applications is EJB an appropriate solution? (Choose two.) 

A. To render a GUI for mobile clients. 

B. As a container for web-tier components including JSP. 

C. As a Web service endpoint accessed by non-Java clients. 

D. To receive and respond to HTTP Post requests directly from a web browser. 

E. As an online shopping cart which can persist across multiple sessions with a single client. 

Answer: CE 


Q27. Assume an EJB application is comprised of the following EJB fragment: 

You have been asked to convert the type of InventoryReportBean into a singleton session bean. How would you achieve this task? 

Exhibit C: 

Exhibit D: 

A. Keep InventoryReportBean as it is, modifying the internal structure to function as a singleton 

B. Change the @Stateless annotation of InventoryReportBean to @Singleton 

C. Create an ejb-jar.xml file, and override the annotation configuration information as in exhibit C above. 

D. Create an ejb-jar.xml file, and override the annotation configuration information as in exhibit D above. 

Answer:

Explanation: Note the line with <override-type> 


Q28. Suppose developer wants to create an EJB component that performs data validation every hour. Given the following Stateless session bean: 

What is the minimum modification you would need to make to the bean to support notification from the TimerService once the timer expires? 

A. Modify the verify external orders method to look like this: 

@TimedOut 

private void verifyExternalOrders () { 

/ / do something 

B. Modify the verify external orders method to look like this: 

@EjbTimeOut 

private void verifyExternalOrders () { 

/ / do something 

C. Modify the verify external orders method to look like this: @ejbTimeOut private void verifyExternalOrders () { / / do something } 

D. Modify the verify external orders method to look like this: @TimeOut private void verifyExternalOrders () { / / do something } 

Answer:

Explanation: Programmatic Timers 

When a programmatic timer expires (goes off), the container calls the method annotated 

@Timeout in the bean’s implementation class. The @Timeout method contains the business logic that handles the timed event. 

The @Timeout Method 

Methods annotated @Timeout in the enterprise bean class must return void and optionally take a 

javax.ejb.Timer object as the only parameter. They may not throw application exceptions. 

@Timeout 

public void timeout(Timer timer) { 

System.out.println("TimerBean: timeout occurred"); 

Reference: The Java EE 6 Tutorial, Using the Timer Service 


Q29. A developer writes an interceptor class called FooInterceptor containing the following AroundInvoke method: 

11. @AroundInvoke 

12. public Object intercept (InvocationContext ctx) { 

13. return “intercepted”; 

14. } 

FooInterceptor is applied to a business method in a stateless session bean: 

11. @Interceptors (FooInterceptor.class) 

12. public String testzero(int i) { 

13. return (i = = 0) ? “zero”: “not zero” 

14. } 

Which describes the result when a client invokes the testzero method with a value of 1? 

A. The interceptor method is NEVER invoked. 

B. The client receives a return value of “zero”. 

C. The client receives a return value of “not zero”. 

D. The client receives a return value of “intercepted”. 

Answer:


Q30. A developer creates a stateful session bean that is used by many concurrent clients. The clients are written by other development team; and it is assumed that these clients might not remove the bean when ending their session. The number of concurrent sessions will be greater than the defined bean cache size. 

The developer must consider that the state of the session bean can be influenced by either passivation or timeout. 

Which three actions should the developer take to make the bean behave correctly in passivation and timeout situations? (Choose three.) 

A. Release references to resources in a @Remove annotated method. 

B. Re-establish references to resources in an @Init annotated method. 

C. Release references to resources in a @PreDestroy annotated method. 

D. Release references to resources in a @PrePassivate annotated method. 

E. Re-establish references to resources in a @PostActivate annotated method. 

Answer: CDE