This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Head First EJB, AdviceBean & that damned SerialContextProvider Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Head First EJB, AdviceBean & that damned SerialContextProvider" Watch "Head First EJB, AdviceBean & that damned SerialContextProvider" New topic
Author

Head First EJB, AdviceBean & that damned SerialContextProvider

Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Just got the HeadFirst EJB book and im through chapter one (excellent read btw). But im running the first example and I get the following output at this line : Object o = ic.lookup("Advisor");

D:\WorkSpace\JavaPlayground\EJB\Advice>java -cp %CLASSPATH%;AdviceAppClient.jar AdviceClient
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
a:63)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120
)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:20)
at AdviceClient.main(AdviceClient.java:11)
Now im using j2ee 1.4 because im a novice at running this sort of server and 1.4 runs when I click the "Start Default Domain" icon, whereas the 1.3 version simply tells me it can't find "C:`program" when I type in j2ee.
I cant believe 1.4 is causing these problems, and it will take me months to learn how to admin a j2ee server from scratch. So any help getting this problem working on 1.4 would be appreciated.
[ February 07, 2004: Message edited by: morgan bath ]

Morgan
SCJP (1.4), SCJD (1.4), SCWCD (1.3), SCBCD (1.3)
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
Probable cause: the j2ee server is not running. Use the command j2ee -verbose to start the server.


Sudhir V<br />(SCJP 1.2, SCWCD, OCA, SCBCD)
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
Please see this link
http://www.coderanch.com/t/158340/java-EJB-SCBCD/certification/Error-running-AdviceClient
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
There is no j2ee.bat file in my 1.4 installation. And if j2ee server was not running would I be able to run the Deploytool and deploy EJBs?
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
I follwed that link and im not 100% sure how it applies to me. Ive tried uninstalling all j2ee files and reinstalling JUST the 1.4 files and now I get this:
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:24)
at AdviceClient.main(AdviceClient.java:11)

I notice in the other thread the man had similar troubles, but they were talking about propertie files that dont even exist on my system.
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Ok im gonna remove everthing and figure out how to get j2ee 1.3 to work. For a start I have to junk the j2ee,bat which fails on the first line
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
Please see if your classpaths are set correctly. Use this link
http://www.oreilly.com/catalog/hfjejb/errata/hfjejb.help
I had another suggestion but since you have already started uninstalling please use these links for a clean start with 1.3.
http://it.sun.com/eventi/codecamps_2002/prerequisiti.html
http://java.sun.com/j2ee/sdk_1.3/install.html
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/GettingStarted.html
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
I seem to have 1.3 working. Solved ALL the problems by UNINSTALLING js2e 1.4 fro mthe c:\program files\java directory and installing it in a c:\sun\java directory.... Can you believe j2ee batch files bomb with spaces in directories It was the placement of my j2se that was screwing it... bizarre!
[ February 07, 2004: Message edited by: morgan bath ]
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Ok, J2EE 1.3 seems to be working, deployed the example, compiled the client and ran it .... and got this:
java.rmi.RemoteException: CORBA BAD_OPERATION 0 No; nested exception is:
org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemExceptio
n(ShutdownUtilDelegate.java:137)
at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at AdviceClient.go(AdviceClient.java:28)
at AdviceClient.main(AdviceClient.java:11)
Caused by: org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed:
No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
eption(ReplyMessage_1_2.java:93)
at com.sun.corba.ee.internal.iiop.ClientResponseImpl.getSystemException(
ClientResponseImpl.java:108)
at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOACli
entSC.java:132)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
... 2 more

Holy crap!
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Im never gonna give systems admins crap again .... I didnt realise how easy they made development Its nice to get to yor desk, sip your coffee, boot up jDeveloper and never give a second thought to what was going on in the background. Write program, deploy, sip coffee, continue ... ahhhhh
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Ahh the error is now on the getAdvice() command. Thats an improvement.
Object o = ic.lookup("Advisor");
AdviceHome home = (AdviceHome)PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor = home.create();
System.out.println(advisor.getAdvice()); //This is now where the client fails
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
Almost everyone has got this error. The remedy is simple "change the name of the method from getAdvice to something else like getMessage or something else. It will solve the problem
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
You are crappin me? Ill be back
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
ITS ALIVE!!! Mahahhhahhahahhahhahhhh!!!

major thanks. You saved my girlfriend from an evening of having to listen to wild howls of rage whilst trying to sleep
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
dude!!! you don't believe me huh!!!
look at this post from the author "kathy Sierra"
http://www.coderanch.com/t/158262/java-EJB-SCBCD/certification/CORBA-bad-operation-error-RI
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
See this space? See this right here? This space is my happy space right now Its saturday night, midnight, and im dancing around my computer happy cos I deployed a bean! I have to be the geekiest mofo alive.... and I dont care.
oh yeah ... "Bean there, done that!"
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Thanks for the link, its nice to know im not the only one to get frustrated by that
thanks for all your help.
alzamabar
Ranch Hand

Joined: Jul 24, 2002
Posts: 379
Ok, I followed all the discussion and I got the bean working by changing method name. Now could someone tell me why? Is that getAdvice() was returning an instance to the Bean class?

Marco


Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First EJB, AdviceBean & that damned SerialContextProvider
 
Similar Threads
regarding EJB Deployment
Error while running my first ejb program
A Quest for all of those who don't use RI for HF EJB
how to run the AdviceClient
EJB problem in JNDI lookup