Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"

Grand Puba

+ Follow
since Oct 28, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Grand Puba

Are client and server located in the same VM? Otherwise they won't be able to share static instances...

java.rmi.NoSuchObjectException is a subclass of java.rmi.RemoteException which gives the client some more information 'bout what's going on on the server.
If the client receives the java.rmi.RemoteException or the javax.ejb.EJBException from a method invocation, the client, in general, does not know if the enterprise Bean�s method has been completed or not.

The spec staits:
An enterprise bean must not use the package to attempt to access files and directories in the file system.
The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC, to store data.

What DB do you use? Can't you store the XML there?



You will need to use a remote interface when the client that will be working with it will be in a different Java Virtual Machine (distributed environment).
Local client view can only be accessed by beans who are packaged within the same EJB-JAR package or by beans who are packaged within different EJB-JAR packages (or WAR packages), but everything is still packaged within the same application's EAR package.

So, I don't think it is possible to call local interfaces since each container will have it's own VM.



Note: If you create an entity bean, you need to remember that it's usually used with a local client view. If your entity bean needs to provide access to a client outside of the existing JVM (i.e., a remote client), you typically use a session bean with a remote client view. (Session Facade pattern)

The exam tells you how many correct answers to choose so it's like the SCJP exam.

Check out the SCBCD JavaRanch Forum or the SCBCD links section.

I personally liked a lot for mock exams.

Hope this was helpfull,


Cant I type cast like this directly ..
code: loginHome = (LoginHome)context.lookup("java:comp/env/LoginBean");

You can safely cast the LocalHome interface but only when you 're sure it's local interface. For remote interfaces, you will need to use PortableRemoteObject.narrow(homeObject). (That's because of the IIOP protocol used)

The same client was working in weblogic, After the server is migrated to oracle10g i'm facing this exception.

Oracle uses the special ORMI protocol (instead of RMI-IIOP) which is, in my opinion, the start of a lot of problems...
Anyway, the HashTable should look like:

Hashtable env = new Hashtable();
env.put(Context.SECURITY_PRINCIPAL, "");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
env.put(Context.PROVIDER_URL, "ormi://localhost:<port>/ejbsamples");

Hope this was helpfull...

[ November 14, 2004: Message edited by: Grand Puba ]
Sorry Nick,
I wasn't very clear in my question (I think that's the stress because I have the exam today). I actually ment: Does the container always roll-back the transaction (or at least mark the transaction for roll-back) when a System exception is thrown ?

Sorry for my previous question...
Thx 4 the reply thou
Does the container always roll-back the transaction (or at least mark the transaction for roll-back)? Even whith BMT beans?
When a Stateless SessionBean's ejbCreate calls getCallerPrincipal() on the SessionContext, how will the container react? Will it return *null* (the API says this method will never return *null* ) or will it throw a system exception? And if so, which one? I should expect IllegalStateException?


I also think the BMT will roll back, and CMT will not roll back but in reality , the BMT method will probably throw an application exception to indicate this behaviour...