one of the EJB restriction is "EJB must not attempt to define a class in a package". What does this mean? Does that mean we can't do this:- package myPackage; import ... public class MyBean implements SessionBean{ : : } that doesn't sound right, does it?
This is in section 24.1.2 Programming restrictions but i don't know why..
� The enterprise bean must not attempt to define a class in a package. This function is reserved for the EJB Container. Allowing the enterprise bean to perform this function
I got some leads from ejbcertification but huh? Question from ejbcertification (check out answer 5)
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. [Check all correct answers] Feedback: Answer 1, 3 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 3 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 4 is incorrect. It is possible to create an interface and implement the interface to make available in the enterprise bean business method. Answer 2 is incorrect. The enterprise bean can make use of the JavaMail API.
oppss, here are the answers from ejbcertificate:- 1. The enterprise bean cannot define read and write to static fields. 2. The enterprise bean cannot make use of the Sun JavaMail API. 3. The enterprise bean cannot make use of the Java Swing API. 4. The enterprise bean cannot make use of interfaces to define business methods. 5. The enterprise bean must not attempt to define a class in a package.
Suman There is no explanation there If you are thinking of what Roger wroteI would have thought that this is about disallowing the use of definePackage() and defineClass() of ClassLoader Was that not covered in spec seperately on page 495 of spec , the second bullet point?? I am still not clear what the spec meant by that point. Can someboby help.......
This is my understanding. You must not do anything relating to a class loader. So, you cannot "create a class loader; obtain the current class loader; set the context class loader".
We are also told that the "enterprise bean must not attempt to define a class in a package". My belief is that this refers to the use of the defineClass() and definePackage() methods being disallowed. This is consistent with the class loader being disallowed.
Arguably, there was no need to disallow the definition of a class in a package as all methods of the ClassLoader class are banned, but I guess the EJB spec writers just wanted to make things a bit clearer. Of course, you could well argue that they should have written this particular programming restriction in much better English ...
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
Gift giving made easy with the permaculture playing cards