• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SerialContextProvider error

 
Lakshmi Saradha
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am in the first chapter of HFEJB book. I am getting a 'Can'tSerialContextProvider' error. here is my source code of the Client program.

import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import hf.AdviceHome;
import hf.Advice;
import java.rmi.*;
import javax.ejb.*;


public class AdviceClient{


public static void main(String args[]){

new AdviceClient().go();
}

public void go(){

try{
Context ic = new InitialContext();
//Object o = ic.lookup("TEST");




AdviceHome ac = (AdviceHome)PortableRemoteObject.narrow(ic.lookup("AdviceBean"),AdviceHome.class);



Advice adcomp = ac.create();
System.out.println(adcomp.getAdvice());
}
catch(Exception e)
{
e.printStackTrace();
//System.out.println(e.getMessage());
}


}//end of method



}

Here is the stack trace.
===========================================
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:63)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
at javax.naming.InitialContext.lookup(InitialContext.java:345)
at AdviceClient.go(AdviceClient.java:26)
at AdviceClient.main(AdviceClient.java:14)

=======================================

Any thoughts on the cause?
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi lakshmi,
Which app server you rare using and are you calling your ejb from a java client that is not on the same server. If yes then you need to get the initail context by providing the server properties.

InitialContext context = new InitialContext(serverPropertiesObj);

hope that helps.
 
Lakshmi Saradha
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sawan,
Thank you for the reply.
Could you please explain me 'serverPropertiesObj'? Is this an instance of 'Properties'?If so,what is the key-value pair that should be stored here?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic