[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-895 Dumps with VCE and PDF 51-60

By | January 25, 2018

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-895
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-895.html

Java EE 6 Enterprise JavaBeans Developer Certified Expert Exam

Question No: 51

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

Ensurepass 2018 PDF and VCE

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

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

    @TimedOut

    private void verifyExternalOrders () {

    / / do something

    }

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

    @EjbTimeOut

    private void verifyExternalOrders () {

    / / do something

    }

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

    @ejbTimeOut

    private void verifyExternalOrders () {

    / / do something

    }

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

@TimeOut

private void verifyExternalOrders () {

/ / do something

}

Answer: D

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(quot;TimerBean: timeout occurredquot;);

}

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

Question No: 52

An enterprise developer needs to modify the order of interceptor method execution specified by the Bean Provider, but does NOT have access to the bean#39;s source code. No deployment descriptor was provided in the EJB jar delivered by the Bean Provider.

Which represents the solution to this problem?

  1. No solution is possible under these conditions.

  2. The Deployer can add metadata annotations to the ejb-jar.

  3. The Application Assembler can add metadata annotations to the ejb-jar.

  4. The System Administrator can add interceptor binding information at runtime, using vendor-specific tools.

  5. The Application Assembler can add a deployment descriptor to the ejb-jar that includes interceptor binding information.

Answer: E

Question No: 53

A developer wants to package an enterprise bean FooBean within a .war file:

@Stateless

public xlass FooBean {

public void foo () {}

}

Which package approach is correct?

  1. / (Root)

    I – META – INF /

    I – acme

    I – FooBean.class

  2. / (Root) I – acme

    I – FooBean.class

  3. / (Root)

    I – WEB – INF /

    I – acme

    I – FooBean.class

  4. / (Root)

I – WEB – INF /

I – Classes/ I – acme

I – FooBean.class

Answer: D

Explanation: To include enterprise bean class files in aWARmodule, the class files should be in the

WEB-INF/classes directory.

Note: Enterprise beans often provide the business logic of a web application. In these cases, packaging the enterprise bean within the web application’sWARmodule simplifies deployment and application organization. Enterprise beans may be packaged within aWARmodule as Java

programming language class files or within a JAR file that is bundled within theWARmodule.

Reference: The Java EE 6Tutorial, Packaging Enterprise Beans inWAR Modules

Question No: 54

A developer creates a stateless session bean, EmployeeServiceBean, and its interface, EmployeeService. The session bean uses two annotated entity classes, Employee.class and Department.class.

Which two package options can the developer use when creating a deployable EAR? The proposed directory structure is listed for each option. (Choose two)

  1. Emp.ear emp-ejb.jar

    META-INF/persistence.xml EmployeeService.class EmployeeServiceBean.class lib/emp-classes.jar Employee.class Department.class

  2. Emp.ear

    META-INF/orm.xml EmployeeService.class EmployeeServiceBean.class Employee.class Department.class

  3. Emp.ear emp-ejb.jar

    META-INF/persistence.cml Employee.class Department.class EmployeeService.class EmployeeServiceBean.class

  4. Emp.ear emp-ejb.jar persistence.xml Employee.class

Department.class EmployeeService.class EmployeeServiceBean.class

Answer: A,C

Question No: 55

Assume you have been tasked with building an ejb-jar containing an EJB application. The EJB application contains local, remote, and web service and-point EJBs that provide reusable services within an enterprise. When the application is deployed clients will access the remote session beans using the global JNDI name java/: ServiceLayer / lt;bean_namegt;. All of the EJBs are located in the com.acme.servicelayer package and are deployed as class files. The application uses a maximum of deployment descriptor and annotation configuration?

  1. Name the jar servicelayer.jar with the following structure:

    / (Root)

    I – META – INF /

    I – MANIFEST.MF

    I – classes/ I – com/

    I – acme/

    I – servicelayer /

    lt;list of classesgt;

  2. Name the jar servicelayer.jar with the following structure:

    / (Root)

    I – META – INF/

    I – MANIFEST.MF

    I – ejb – jar.xml I – classes/

    I – com/

    I – acme /

    I – servicelayer/

    lt;list of classesgt;

  3. Name the jar servicelayer.jar with the following structure:

    /(Root)

    I – META – INF /

    I – ejb – jar.xml I – com/

    I – acme/

    I – servicelayer/

    lt;list of classesgt;

  4. Name the jar servicelayer.jar with the following structure:

/ (Root)

I – META – INF/

I – MANIFEST.MF

I – ejb-jar.xml I – com/

I – servicelayer/

lt;list of classesgt;

Answer: A

Explanation: Structure of an Enterprise Bean JAR:

Assembly Root ejb-jar.xml

glassfish-ejb-jar.xml (optional, not used hereNot D, Not C, not B)) META-INF

MANIFEST.MF

All .class files for this module

References: The Java EE 6Tutorial, Packaging Enterprise Beans in EJB JAR Modules

Question No: 56

A developer writes a stateful session bean with local business interface Bar containing method test. Method test is implemented as:

  1. @Remove

  2. public void test () {}

A business method in a stateless session bean invokes a reference to bean Bar as follows:

11. @EJB Bar bar; 12.

  1. public void foo () {

  2. bar.test ();

  3. bar.test();

16. }

Assuming execution reaches Line 15, what is the expected result?

  1. Method foo returns without error.

  2. A javax.ejb.NoSuchEJBException is thrown.

  3. A java.rmi.NoSuchObjectException is thrown.

  4. A javax.ejb.NoSuchEntityException is thrown.

Answer: B

Question No: 57

MyMsg is a JMS message-driven bean with container-managed transaction demarcation. FooBean is an EJB 3.x stateless session bean that sends message to the JMS destination with MyMsgBean is associated.

MyMsgBean’s message listener method has transaction attribute REQUIRED, and is defined as follows:

  1. public class MyMsgBean implements javax.jms.messageListener {

  2. public void onMessage(javax.jms.Message message) {

  3. / / do some work not shown here

  4. thrown new RuntimeException(“unexpected error . . . “);

14. }

Which statement is true about the result of message processing?

  1. FooBean receives javax.ejb.EJBException.

  2. The container discards the MyMsgBean bean instance.

  3. FooBean receives the original RuntimeException thrown from the message listener method.

  4. The container does NOT roll back the transaction, and FooBean can continue the transaction.

Answer: C Explanation:

Note: public interface MessageListener

A MessageListener object is used to receive asynchronously delivered messages.

Each session must insure that it passes messages serially to the listener. This means that a listener assigned to one or more consumers of the same session can assume that the onMessage method is not called with the next message until the session has completed the last call.

Reference: Enum TransactionAttributeType

Question No: 58

Given an JMS message-driven bean, which statement is true about its exception handling?

  1. Its message listener method must NOT throw any checked exception.

  2. Its message listener method can throw java.rmi.RemoteException.

  3. Its message listener method can throw any checked exception except java.rmi.RemoteException.

  4. Its message listener method can throw any checked exception that implements java.io.Serializable.

Answer: A

Question No: 59

Which is a correct way to define a runtime exception as an EJB 3.x application exception?

  1. public class MyAppException extends javax.ejb.EJBException

  2. @ApplicationException

    public class MyAppException extends javax.ejb.EJBException

  3. public class MyAppException extends javax.lang.EJBException

  4. @ApplicationException

public class MyAppException extends javax.lang.EJBException

Answer: B

Explanation: Use the @javax.ejb.ApplicationException annotation to specify that an exception class is an application exception thrown by a business method of the EJB. The EJB container reports the exception directly to the client in the event of the application error.

Note: java.lang.Object java.lang.Throwable java.lang.Exception

java.lang.RuntimeException javax.ejb.EJBException javax.ejb

public class EJBException

extends java.lang.RuntimeException

The EJBException is thrown to report that the invoked business method or callback method could not be completed because of an unexpected error (e.g. the instance failed to open a database connection).

Example:

The following ProcessingException.java file shows how to use

the @ApplicationException annotation to specify that an exception class is an application exception thrown by one of the business methods of the EJB:

package examples;

import javax.ejb.ApplicationException;

/*** Application exception class thrown when there was a processing error* with a business method of the EJB. Annotated with the* @ApplicationException annotation.*/

@ApplicationException()public class ProcessingException extends Exception {

Reference: Programming WebLogic Enterprise JavaBeans, Version 3.0 programming Application Exceptions

Question No: 60

A developer writes a stateless session bean with one local business interface and with container-managed transactions. All business methods have transaction attribute REQUIRED. The bean has an injected field sessionCtx of the type SessionContext. Which two operations are allowed in a business method of the bean? (Choose two.)

  1. sessionCtx. getEJBObject

  2. sessionCtx.setRollbackOnly

  3. sessionCtx. getMessageContext

  4. sessionCtx. getBusinessObject

  5. sessionCtx. getEJBLocalObject

Answer: B,D Explanation:

New Questions

100% Ensurepass Free Download!
Download Free Demo:1z0-895 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-895 Dumps

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF VCE Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.