• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Lookup EJB on Different Application servers

 
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

How can I lookup remote EJB 3.1 deployed on Websphere Application server(V8.0) from client Application deployed on Weblogic server (10.3)?

I tried the following scripts
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.put(javax.naming.Context.PROVIDER_URL, "corbaname::192.168.75.104:2809");

InitialContext cxt = new InitialContext(props);

Object obj = cxt.lookup("java:global/AcasyaPrmClientEAR/PrmBusiness/dep");

DepartmentRemote departmentBoundary = (DepartmentRemote)obj;


And other code
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:2809");

InitialContext cxt = new InitialContext(props);

Object obj = cxt.lookup("java:global/AcasyaPrmClientEAR/PrmBusiness/dep");

DepartmentRemote departmentBoundary = (DepartmentRemote)obj;


and I tried all patterns of JNDI, but Unfortunately not work, I got a lot of exceptions especially NamingException & org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0

its Important, I want help from you

Thanks
 
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abdelrahman,

Hmm, If you're getting naming exception it's because you're pointing to the wrong place. You may be pointing to the wrong JNDI server or also to a non-existing EJB.

Are you sure of this JNDI server? Have you declared your EJB under this name / address? In EJB 3.1 it's possible through the attribute lookup of the DI injections from the EJB 3.1 (@EJB, @Resource, @PersistenceContext, etc)
 
Abdelrahman Musa
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Jayr

I have two application instances deployed on different application server on my local machine, I tried to testing the EJBs instances that deployed on WAS server by deploying an web application on the same server its worked fine without any problem, but when I lookup these EJBs from other application server(Weblogic, or glassfish) Unfortunately no response.

is it my snap of code true ?
Regarding to INITIAL_CONTEXT_FACTORY should I use the callee application server factory or calling application server (WAS or weblogic Factory)?
Should I use the IIOP in this syntax?
I used global EJB JNDI name is it right ? or i have to use vendor specific JNDI name for Websphere ?


Thanks a lot
 
Jayr Motta
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abdelrahman,

That's what I meant bro, you've said that you're using EJB 3.1, right? In the spec of EJB 3.1, you can declare JNDI global names through the annotation attribute lookup.



Once you did this and you have the proper address and permission to access it, then the EJB will be accessible on the global JNDI environment.

is it my snap of code true ?


Yes!

Regarding to INITIAL_CONTEXT_FACTORY should I use the callee application server factory or calling application server (WAS or weblogic Factory)?


I couldn't understand your question. I also don't know too much about "WAS".

Should I use the IIOP in this syntax?


No, you should use the JNDI name. java:global[/<app-name>]/<module-name>/<bean-name>[!<fully-qualified-interface-name>]

I used global EJB JNDI name is it right ?


No, you didn't. I don't know the vendor-specific features of "WAS", but by default your bean will not exist in the global JNDI register.

i have to use vendor specific JNDI name for Websphere ?


If it translate into a global JNDI entry, yes.

Hope it helps. If it doesn't, keep asking and I'll help you!
 
Abdelrahman Musa
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jayr,

To declare JNDI global names through the annotation attribute lookup. I think we have to distinguish between Local and Remote EJBs; in Local EJB you can use annotation attribute lookup with EBJ's name,
but in case Remote you have to define ejb-ref in web.xml , is it right ???



and ejb-ref in vendor-web.xml file



please could you provide me sample of code to lookup EJBs between two different Application servers, either using EJB3.1 spec. or using InitialContext.

I appreciate your help

Thanks
 
Jayr Motta
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right now I can't post an example of it because I'm at work, check this out http://publib.boulder.ibm.com/infocenter/wasinfo/beta/topic/com.ibm.websphere.base.doc/info/aes/ae/cejb_ref.html and if it doesn't make yourself clear I'll code an example for you!

Let me know!
 
Abdelrahman Musa
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jayr,

I tried all possibilities but useless, please provide me sample code about this issue

Thanks a lot
 
Abdelrahman Musa
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

the technique that used in the following forum describe the Lookup EJBs on remote server from Java client resolved the problem,
but I feel its not sense when the client is other application server
http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14109046

but , when I want to connect to EJB on remote sever(WAS) from client deployed on Weblogic, should I use the same technique ?

Thanks
 
Jayr Motta
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no difference between a non-EJB client and an EJB client from the access perspective, it could have from the injection perspective(once certain classess are not managed by the container).

If the technique worked there it's because they've wired everything correctly. The ejb name with the reference that becomes a JNDI global name and then referencing this one in any other code, either in an EJB through injection annotations or in any class through JNDI lookup.
 
Greenhorn
Posts: 5
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I know this is an old post. but I'm having the same problem. So far nobody has posted a proper answer in this thread.

I think Jayr is missing the fact that the two servers Musa is using are from two different vendors.

"Regarding to INITIAL_CONTEXT_FACTORY should I use the callee application server factory or calling application server (WAS or weblogic Factory)?
Should I use the IIOP in this syntax?
"

could someone please shed some light on this issue?

Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic