• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

SerialContextProvider error

 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
She'll be back. I'm just gonna wait here. With this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic