Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB InitialContext Factory

 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guus,
In order to call an EJB from a Java client, is it mandatory to use : com.ibm.websphere.naming.WsnInitialContextFactory to build my context factory or can I use something less "proprietary"
The bottom line is I don't want my customer to have to use ibm classes if he does not want to.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can simply use the no-arg constructor of InitialContext() and let it use the IBM class, which is the default.
Or, alternatively, look up the factory name from an environment variable or properties file.
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answer Kyle, but I guess I missexplained myself.
I have an EJB deployed onto WAS.
I want to call this EJB from a Java client.
Can this client use a WebLogic ContextFactory, or a Sun ContextFactory or whatver to call my EJB instead of the IBM ContextFactory ?
I hope so, but someone assure me it is not possible
 
gagaghost
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
try following settings.
//////////////////////////////////////
p.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
p.setProperty(Context.PROVIDER_URL,"corbaloc:iiop:127.0.0.1:2809");
///////////////////////////////////
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jean-Louis Marechaux:
Thanks for the answer Kyle, but I guess I missexplained myself.
I have an EJB deployed onto WAS.
I want to call this EJB from a Java client.
Can this client use a WebLogic ContextFactory, or a Sun ContextFactory or whatver to call my EJB instead of the IBM ContextFactory ?
I hope so, but someone assure me it is not possible

No, they can't.
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle, you mean a WebLogic client cannot reach a IBM EJB ?
Actually, I never thought about this scenario... And frankly, I'm not sure whether it could be useful or not :-)

Question 1
So let's talk about a possible one.
Imagine I have a TomCat deployed on a machine A and A WebSphere on a machine B.
What is the .jar file I have to deploy with my webapp on A in order to be able to obtain a IBM InitialContextFactory and to work with my IBM EJBs ???
Question 2
I'm not sure to figure out why a generic ContextFactory is not possible. If the way to build JNDI trees is normalized, what is the technical issue that prevent from having a generic API ?
Do you have any docs to help me to understand that ?
Is this something expected in a future J2EE Spec, or is there really a technicall issue I miss here ?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jean-Louis Marechaux:
Kyle, you mean a WebLogic client cannot reach a IBM EJB ?
Actually, I never thought about this scenario... And frankly, I'm not sure whether it could be useful or not :-)

Question 1
So let's talk about a possible one.
Imagine I have a TomCat deployed on a machine A and A WebSphere on a machine B.
What is the .jar file I have to deploy with my webapp on A in order to be able to obtain a IBM InitialContextFactory and to work with my IBM EJBs ???

There's actually a round dozen or so jar files you'd have to deploy. Look in the InfoCenter about the "Thin Application Client" and you should find out how to make this work.

Question 2
I'm not sure to figure out why a generic ContextFactory is not possible. If the way to build JNDI trees is normalized, what is the technical issue that prevent from having a generic API ?
[/QB

The problem is that the JNDI specification does not state what SPI JNDI is placed on top of. That's why you need different factories; every vendor has their own SPI. See the JNDI spec for details.

Do you have any docs to help me to understand that ?
Is this something expected in a future J2EE Spec, or is there really a technicall issue I miss here ?[/QB]
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Kyle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic