This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First EJB, AdviceBean & that damned SerialContextProvider

 
Morgan Bath
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Sudhir V
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probable cause: the j2ee server is not running. Use the command j2ee -verbose to start the server.
 
Sudhir V
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see this link
http://www.coderanch.com/t/158340/java-EJB-SCBCD/certification/Error-running-AdviceClient
 
Morgan Bath
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are crappin me? Ill be back
 
Morgan Bath
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 379
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic