Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Examples of ILLEGAL RMI-IIOP Types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Examples of ILLEGAL RMI-IIOP Types" Watch "Examples of ILLEGAL RMI-IIOP Types" New topic
Author

Examples of ILLEGAL RMI-IIOP Types

Arthur Orange
Ranch Hand

Joined: Dec 29, 2004
Posts: 30
I must have read these through the specs a million times :
"If the business method corresponds to a method of the entity bean�s REMOTE interface, the method argument and return value types MUST be legal types for RMI-IIOP."

What are examples of legal and illegal RMI IIOP types? I read in HFEJB they should be one of the following:
- Primitives
- Serializable Objects
- Array or collections of primitives or serializable objects.
- A remote object

Now what would be an illegal type? let me guess: Boolean, Integer wrapper types?

The same goes for serializable objects. Which objects are serializable and which are not? HFEJB mentions that String is not serializable. What other illegal types? Why is string considered non serializable?


SCJP, SCWCD, SCBCD, ICAD
Fernando Matias Valadao
Greenhorn

Joined: Feb 19, 2003
Posts: 26
>>What are examples of legal and illegal RMI IIOP types? I read in HFEJB >>they
>>should be one of the following:
>>- Primitives
>>- Serializable Objects
>>- Array or collections of primitives or serializable objects.
>>- A remote object
>>
>>Now what would be an illegal type? let me guess: Boolean, Integer wrapper >>types?

Illegal types are the objects that do not fit to any of the rules you enumerated
Strings, boolean, integer and all Wrapper types ARE serializable objects, because they implement the Serializable marker interface (check the J2SDK doc for each class).
You define a serializable class when it implements the Serializable marker interface (yes, it's that simple), and its attributes must be serializable, too.
Some classes that are not serializable: java.net.Socket, java.sql.DriverManager. They're not either RMI-IIOP compliant objects.
That's my R$0.02.


"In the case of a nuclear attack, the protection of our records is essential, if this country is to carry on its economy and maintain our way of life."
Yorck Zhou
Greenhorn

Joined: Jan 04, 2003
Posts: 22
transient type data is not serializable.


----------------------------------<br />SCJP SCWCD<br />dive into EJB, drinking hot Java
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
http://www.jguru.com/faq/view.jsp?EID=349856 says:

A legal value type for RMI is an object that implements the java.io.Serializable interface and is, in fact, serializable (An object that implements the Serializable interface will not actually be serializable if the classes of one or more of its member variables are non-serializable).
Interestingly, it is a violation of the J2EE specification to pass or return a parameter of type java.lang.Object from an EJB method because the Object class does not implement Serializable. Some EJB 1.1 compliant application servers (the J2EE reference server itself for example!) will allow the deployment and use of EJB's that violate this constraint if at runtime the bean methods actually pass and return sub-types of Object that are serializable. However, if you run the Verifier tool that comes with the J2EE reference server, you will be informed that the bean method parameters do not conform to the RMI-IIOP value type guidelines.
For a more detailed explanation of legal RMI types, read section 2.6 of the RMI specification at: http://java.sun.com/j2se/1.3/docs/guide/rmi/spec/rmiTOC.html


Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Examples of ILLEGAL RMI-IIOP Types