• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Mock Exam Question:

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(The following exam question appears from EJBCertificate.com and is not taken from the real SCBCD exam set.)

What I need is an expert opinion on the why option number 5 is correct. Why can't an EJB class have a package structure? Head First EJB even suggests a package structure is possible given the contents of an ejb jar are the META-INF directory AND the PACKAGE DIRECTORIES. Is this question wrong?? What's all this talk of a security hole? That certainly didn't get mentioned in HFEJB!


Identify correct programming restrictions that a Bean provider must follow to ensure that the enterprise bean is portable and can be deployed in any compliant EJB 2.0 Container. [Select all correct answers]

1 The enterprise bean cannot define read and write to static fields.
2 The enterprise bean cannot make use of the Java Swing API.
3 The enterprise bean cannot make use of interfaces to define business methods.
4 The enterprise bean cannot make use of the Sun JavaMail API.
5 The enterprise bean must not attempt to define a class in a package.

Explanation
Answers 1, 2 and 5 are correct.

Answer 1 is correct. This rule is required to ensure consistent runtime semantics because while some EJB Containers may use a single JVM to execute all enterprise bean's instances, others may distribute the instances across multiple JVMs.

Answer 2 is correct. Most servers do not allow direct interaction between an application program and a keyboard/display attached to the server system.

Answer 5 is correct. This function is reserved for the EJB Container. Allowing the enterprise bean to perform this function would create a security hole.

Answer 3 is incorrect. It is possible to create an interface and implement the interface to make available in the enterprise bean business method.

Answer 4 is incorrect. The enterprise bean can make use of the JavaMail API.
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refer to page 496 of the spec. The terminology you found is taken directly from the spec. I think this does not refer to the package structure of the bean class or interfaces. We know that they can be in a package. I think this means "the bean class cannot define an inner class in a package". Even I am not very clear about this. Would be glad if Peer or someone else can provide an explanation
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There a few posts in this forum with relevance to this discussion. I picked some of them.

https://coderanch.com/t/159007/java-EJB-SCBCD/certification/package-class

https://coderanch.com/t/158164/java-EJB-SCBCD/certification/EJB-spec

https://coderanch.com/t/159917/java-EJB-SCBCD/certification/Imitations-EJB-Model
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by B Sathish:
Would be glad if Peer or someone else can provide an explanation



I've already added my part to the speculation in Help on EJB Programing Restrictions!!.
It certainly looks like the focus is on java.lang.ClassLoader.defineClass() and java.lang.ClassLoader.definePackage()
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic