wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Error Running AdviceClient from HFE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Error Running AdviceClient from HFE" Watch "Error Running AdviceClient from HFE" New topic
Author

Error Running AdviceClient from HFE

Raja Sagar Panamgipalli
Ranch Hand

Joined: Aug 13, 2003
Posts: 109
Hi all...

I'm getting the following error when running the AdviceClient...



Guys can anyone figure it out and let me know....
I'm also using WASAD 5.0 with WAS 4.0 there i'm able to run my getAdvice method using the test client.
But i'm failing to complete the Client part everytime....plz advice...

Thank you....

Regards
Sagar


SCJP 1.4<br />SCBCD 1.3
Raja Sagar Panamgipalli
Ranch Hand

Joined: Aug 13, 2003
Posts: 109
The above comes when i'm using the j2ee 1.3RI deploytool.

i set classpath=%classpath%;AdviceAppClient.jar when i got the client-jar file after deploying it in the RI.

then compiled it :
C:\projects\advice>javac AdviceClient.java

then run it..:
C:\projects\advice>java AdviceClient



Thank you ...
Raja Sagar Panamgipalli
Ranch Hand

Joined: Aug 13, 2003
Posts: 109
Hi Sheriff....

Guys...seriously in trouble cant proceed further ....

Got any clues as to y this exception comes.....

Thanks...
Raja Sagar Panamgipalli
Ranch Hand

Joined: Aug 13, 2003
Posts: 109
Thank Kathy......it helped.....

Ah... the now-infamous CORBA.BAD_OPERATION error...

Sorry I didn't even think to come over to this forum and check; I'll do that from now on -- this discussion has been going on over in the EJB cert forum, but then Johannes alerted me to this discussion, so here I am.

O'Reilly should have something up in the next day or two about this.
Here's the deal:

1) There's a bug in the J2EE RI, that only appears in some implementations (not yet sure which). Obviously, it doesn't appear on my current set-up (Linux distribution of J2EE 1.3.1, J2SE 1.3.1, running under OSX 10.2 and 10.3)

2) The *official* bug at Sun is documented a little differently, but I talked with someone from the J2EE team today, and here's the story...

* You can get this error if you have a Remote interface name that has a business method with a name that has matching characters!! Yep, that's it. And this workaround will definitely fix the BAD_OPERATION problem, assuming you've done everything else correctly.

* So the problem is that we have an interface that looks like this:

public interface Advice extends EJBObject {
public String getAdvice() throws RemoteException;
}

// notice that getAdvice() contains a String matching the interface name. This is NOT a restriction of Java or even RMI, but once you get CORBA involved, naming problems can happen, and this is one...

3) To fix it, you need to:

* Change the component interface business method to something *other* than getAdvice(). So, you could change it to

public String getTheMessage() throws RemoteException

* Change the corresponding business method in the bean class

* Change the client code to invoke this method instead of getAdvice()

* Recompile everything.

* Now, you must recreate your enterprise bean and redeploy.

The safest way to do this (although it might be overkill) is to do the following:

* Run 'cleanup' (without the quotes) at the command-line. This will undeploy all of your applications (you probably only have one at this point), and restore the server to the way it was when you installed it. The logs are cleared, etc. along with the repository that holds your server's deployed applications.

* Be sure the server is shut down, and deploytool is shut down

* Delete your .ear file from your Advice directory (or wherever you have it).
* Delete any temp files that were put in that directory as well

* Restart the server
* Restart deploytool

* Start over making your AdviceApp, (follow the steps in the book again) and creating the bean... the only difference from the previous app is the name of the business method.

* Run your client
* Hold your breath (until it completes)

* Yay! Success.

Note: some people have found a different workaround, but it involves taking the classes out of their packages. Don't do this! Don't ask me why that workaround fixed this bug, but it's definitely not the right solution since you really do need these classes to be in packages.

So, keep *everything* exactly the same as it is in the book, except give the business method ANY name other than the one it has. And if you continue to use the RI, and you are on a system that produces this error, then keep that in mind when naming other business methods in other Remote interfaces.

And remember, if you *are* planning to take the exam, this naming problem is NOT an EJB rule -- it is simply a bug related to CORBA use in the RI.

Whew!

OK, so far, everyone who has tried this fix has been successful, so we're certain that this is indeed the problem.

On the Sun site, we never even thought to check for a bug report on this since I've never had a problem (I've also tested this code under Solaris, but haven't tried it on a Windows machine under J2EE 1.3.1...)

cheers and thanks for your patience,
Thanks to the quick work of the javaranchers, we've solved the mystery of the RI...

You can go back to having fun now

-Kathy

--------------------
Raja Sagar Panamgipalli
Ranch Hand

Joined: Aug 13, 2003
Posts: 109
The above was Kathy's conclusion......

http://www.coderanch.com/t/312836/EJB-JEE/java/Head-First-EJB-st-tut
 
jQuery in Action, 2nd edition
 
subject: Error Running AdviceClient from HFE