This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Websphere and the fly likes EJB InitialContext Factory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "EJB InitialContext Factory" Watch "EJB InitialContext Factory" New topic
Author

EJB InitialContext Factory

JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
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.


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
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

Joined: Apr 23, 2002
Posts: 10
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

Joined: Aug 10, 2001
Posts: 3892
    
    5
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

Joined: Nov 12, 2001
Posts: 906
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

Joined: Aug 10, 2001
Posts: 3892
    
    5
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

Joined: Nov 12, 2001
Posts: 906
Thanks a lot Kyle
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB InitialContext Factory
 
Similar Threads
Jboss - DeploymentException (session calling entity bean)
Purpose of the Home Class
MDB and foriegn JMS Provider
Multiple Entries in sun-ejb-jar.xml for Message Driven Bean?
DOA as session bean ?