Skip to Content
author's profile photo Former Member
Former Member

Creating an Initial Context failed

Dear Community

Let me aslk you with following problems:

I would like to call MailSend Service of WAS 6.20 by an standalone client. Therefore

I created a intial context which pointed to naming service of WAS 6.20.

I used following properties:

intial context factory = ""

security principal = "Administrator"

security credentials = ""

provider url = ""

domain = true

If I run client I still get an intial context object. But when try to

lookup for RemoteObject "MailSession" I get an following exception:

11:14:34,053 WARN [NamingContext] Failed to connect to

javax.naming.CommunicationException: Failed to retrieve stub from

server Root exception is invalid stream header

Next I will find concerning code snippet:

Properties properties = new Properties();




properties.put(Context.SECURITY_PRINCIPAL, "Administrator");

properties.put(Context.SECURITY_CREDENTIALS, "");

properties.put(Context.PROVIDER_URL, "");

properties.put("domain", "true");

InitialContext ctx = new InitialContext(properties);

Object o = ctx.lookup("java:comp/env/mail/MailSession");

sess = (Session) javax.rmi.PortableRemoteObject.narrow(o,


I do not have any idea solving this problem and would like to ask for any help.

Thanks & Regards

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Feb 24, 2005 at 03:50 PM

    Hi Annemarie,

    the exception says that when the client retrieved a serialized object from the server (here: when trying to receive the stub) it is checked and indentified as c.

    This can be a real network problem, but this is unprobable if the exception is always thrown at the same time. It can also be some "artificial" network problem, that content is filtered any something happens by that (strange erroneous firewall).

    What I would try (even if it <i>should</i> not lead to success, but who knows) if: Are you on a JDK 1.3.1 on client side? If your are on 1.4.X or 1.5, there at least is the possibility that things go wrong depending on that version "conflict".

    Hope it helps


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.