1Z0-895 - Java Platform, Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Exam

Go back to Oracle

Exam FAQ

How many questions are there on the 1Z0-895 exam? How long is the 1Z0-895 exam? How much does the 1Z0-895 exam cost? What is the best way to study for the 1Z0-895 exam?

Example Questions

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: 10. public class MyMsgBean implements javax.jms.messageListener { 11. public void onMessage(javax.jms.Message message) { 12. / / do some work not shown here 13. thrown new RuntimeException("unexpected error . . . "); 14. } Which statement is true about the result of message processing? A developer creates a stateless session bean. This session bean needs data from a remote system. Reading this data takes a long time. Assume that the data will NOT change during the life time of the bean and that the information to connect to the remote system is defined in JNDI. Which statement describes how to manage the data correctly? Which two statements are true JMS message-driven beans? (Choose two.) Which is a correct way to define a runtime exception as an EJB 3.x application exception? A developer wants to create an enterprise bean that uses the EJB Timer service. Which two are true? (Choose two.) A developer writes a stateful session bean FooBean with one remote business interface Foo. Foo defines an integer / setter method pair implemented as: 10. private int value; 11. public void setValue (int i) {value = i; } 12. public int getValue () {return value; } A session bean ClientBean has a business method doSomething and an ejb-ref with ejb-ref-name "fooRef" that is mapped to FooBean's Foo interface. 11. @Resource private SessionContext SessionCtx; 12. public void doSomething () { 13. Foo foo1 = (Foo) sessionCtx.lookup("fooRef"); 14. Foo foo2 = (Foo) sessionCtx.lookup("fooRef"); 15. foo1.setvalue(1); Which statement is true after the code at line 15 completes? Which statement about message-driven beans is correct? A developer writes a stateless session bean FooBean with one remote business interface FooRemote containing one business method foo. Method foo takes a single parameter of application-defined type MyData. 11. public class MyData implements java.io.Serialization { 12. int a; 13. } Methods foo is implemented with the FooBean class as: 11. public void foo (MyData data) { 12. data.a = 2; 13. } Another session bean within the same application has a reference to FooRemote in variable fooRef and calls method foo with the following code: 11. MyData data = new MyData(); 12. data.a = 1; 13. fooRef.foo(data); 14. System.out.printIn(data.a); What is the value of data.a when control reaches Line 14 of the client? Assume a client will be accessing a Singleton bean. Which client views is a Singleton bean capable of exposing? (Choose two) Which API must an EJB 3.1 container make available to enterprise beans at runtime? A developer is writing client code to access a session bean deployed to a server instance. The client can access the session bean under which of these circumstances? (Choose three) 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's source code. No deployment descriptor was provided in the EJB jar delivered by the Bean Provider. Which represents the solution to this problem? A developer writes an interceptor class containing an AroundInvoke method, and applies it to the local business interface method of a stateless session bean: 11. @Interceptors(FooInterceptor.class) 12. public void bar() () A client obtains a reference to the bean's local business interface, and calls the method bar two times from the same thread. Assuming that the container dispatches both cell to the same stateless session bean instance, how many instances of the FooInterceptor class will be used? 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 / <bean_name>. 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? A developer writes a stateful session bean with local business interface Bar containing method test. Method test is implemented as: 11. @Remove 12. public void test () {} A business method in a stateless session bean invokes a reference to bean Bar as follows: 11. @EJB Bar bar; 12. 13. public void foo () { 14. bar.test (); 15. bar.test(); 16. } Assuming execution reaches Line 15, what is the expected result? Which two annotations can be applied at the class, method, and field levels? (Choose two.) Which two statements are correct about stateless session beans? (Choose two.) A developer writes a stateful session bean FooBean with two local business interfaces Foo and bar. The developer wants to write a business method called getBar for interface Foo that returns a Bar reference to the same session bean identity on which the client onvokes getBar. Which code, when inserted on line 12 below implements the getBar method with the wanted behavior? 10. @Resource SessionContext sessionCtx; 11. public Bar getbar () { 12. 13. } A java EE application contains a session bean which uses a security role USER. A group called people is defined an LDAP server. Which two define appropriate EJB role responsibilities? (Choose two.) An ejb-jar also contains three interceptor classes: AInt, BInt, CInt. Each interceptor class defines an AroundInvoke method called intercept. The ejb-jar also contains a stateless session bean FooBean with a local business interface Foo that declares a method foo (): 10. @Stateless 11. @Intercaptors ({CInt.class, BInt.class}) 12. public class FooBean implements Foo { 13. 14. public void foo () {} 15. 16. } The ejb-jar contains a META-INF/ejb-jar.xml file with an <interceptor-binding> section: <interceptor-binding> <ejb-name>FooBean</ejb-name> <interceptor-order> <interceptor.class>com.acme.AInt</interceptor-class> </interceptor-order> </interceptor.binding> What is the interceptor order when the business methodfoo() is invoked? You are writing a client that sends a message to a JMS queue. Which statement is true? Which is true about caller security principal propagation for asynchronous EJB method Invocations? 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? How many interceptor classes can be applied to a single stateful session bean? A stateless session bean FooBean implements an asynchronous business method foo() on its bean class: @Asynchronous public void foo() ( ... ) The asynchronous business method is exposed through a remote business interface FooRemote. A caller acquires an EJB reference to this bean and invokes it as follows: 100. fooRemoteRef.foo(); Which exception can result from the invocation on line 100? Which two are true about the client view of a message-driven bean? (Choose two.) A stateful session bean needs to restore its conversational state to its initial state if the transaction in which the bean is participating rolls back. Which bean method can be used to do this? Which two are programming restrictions in the EJB specification? (Choose two.) A developer impalements an asynchronous implementation for calculating insurance proposals. The input data for the calculations is made available on a single message queue. Two types of insurance proposals will be calculated: car and life. Message with data for other insurance types are posted on the queue but should be left on the queue by this implementation. Which statement is true? Given an JMS message-driven bean, which statement is true about its exception handling? Which statement is true about both stateful session beans and stateless session beans? Which statement is correct about a Java EF client of a message driven bean? A developer writes three interceptor classes: AInt, BInt, and CInt. Each interceptor class defines an AroundInvoke method called interceptor. In the ejb-jar.xml descriptor, CInt is declared as the default interceptor. FooBean is a stateless session bean with a local business interface Foo that declares a method Foo (): 10. @Stateless 11. @Interceptors(AInt.class) 12. public class FooBean Implements Foo { 13. 14. @Interceptors (BInt.class) 15. @ExcludeClassInterceptors 16. public void foo () {} 17. } What is the interceptor order when the business method foo () is invoked? 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.) A bean developer writes a stateless session bean FooEJB with the following asynchronous business method: @Asynchronous public Future<Integer> fooAsync () { System.out.printIn ("begin"); int i = 1; System.out.print("end"); Return new AsyncResult<Integer> (i); } Given the following code, where fooRef is an EJB reference to FooEJB: Future<Integer> fooFuture = fooref.fooAsync(); fooFuture.cancel (true); Which two represents possible system output after all processing has completed? (Choose two) 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.) You are writing an EE component that functions as a message producer. The message producer sends message to a JMS queue. The component environment defines a resource-ref of type javax.jms.ConnectionFactory with the same jms/ConnectionFactory. Which will correctly obtain a connection factory for a queue? Which must result in the destruction of a stateful session bean? A developer writes a stateful session bean called FooBean. Which code can be inserted before Line 11 of the FooBean class to define a TYPE-level environment dependency on a JMS Topic? 11. public class FooBean { 12. 13. public void foo() () 14. 15. } Given the following stateful bean: 10. @Stateful 11. @TransactionAttribute(TransactionAttributeType.SUPPORTS) 12. public class VideoBean implements video { 13. / / insert code here 14. public void method () {} 15. } Assuming no other transaction-related metadata, which code can be added at line 13 to guarantee that business method methodA will execute only if invoked with an active transaction? Suppose a developer wants to create an automatic persistent timer that performs data validation every hour. Given the following stateless session bean: @Stateless Public class OrderVerificationBean { Private void verificationExternalOrders () { / / do something } } What is the minimum modification you would need to make to the bean to create the automatic persistent timer? 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.) You are writing a client that sends a message to a JMS queue. What two statements are true? An enterprise developer has received ejb-jars from multiple Bean Provides and wants to combine them into a single ejb-jar as well as altering the method permissions on some of the beans without recompiling any of the code contained in the ejb-jar. Which is correct? 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? An enterprise bean has security permissions set up using declarative security features. Under which two conditions can a client be guaranteed to have permission to invoke a business method on the enterprise bean? (Choose two.) A bean developer wants to write a stateless session bean class that implements the following remote business interface: @Remote Public interface Foo { Void bar () throws Exception; Which bean class method is valid? A developer implements a CMT session bean with a method storeBoth which inserts data both a related database and an LDAP server. The relational database supports transactions while the LDAP system does NOT. Given that both updates should succeed or be rolled back, while is the best solution? Given a set of CMT bean methods with the following transaction attributes: Method M1 = SUPPORTS Method M2 = REQUIRED Method M3 = NOT_SUPPORTED Method M4 = REQUIRES NEW And the following method invocation sequence: Method Ml invokes Method M2 Method M2 invokes Method M3 Method M1 invokes Method M4 If Method Ml is invoked by a method that does NOT have a transaction context, which describes a possible scenario? Assume you have been tasked with building an ejb-jar containing an EJB application. The EJB application contains local, remote, and web service end-point EJBs that provide reusable sevices within an enterprise. When the application is deployed, client will access the remote session beans using the global JNDI name java:ServiceLayer/<bean_name>. All of the EJBs are located in the com.acme.sevicelayer package and are deployed as class files. The application uses a mixture of deployment descriptor and annotation configuration. Which JAR representation best represents deployed structure for the previous requirements?