• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Calling C++ APIs from an EJB

 
K N
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to call some C++ APIs from my EJB. These APIs might be available on the local machine (same machine as the App Server - WebLogic) or may be available on a remote machine. How can I accomplish this and which type of bean do I use ?
Thanks,
Kapil
 
Saloon Keeper
Posts: 28101
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Considering your needs, I think probably the best approach would be to setup a CORBA wrapper for the C++ service and invoke the C++ methods using remote calls.
The choice of EJB depends on context, though most likely you'd select a Session bean, since you're apparently more interested in business logic than data access here.
 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use an RMI service that is colocated with the C++ code and uses JNI to make the calls. Weblogic provides startup classes to accomplish this. You bind the service to a JNDI name and your beans can use lookup to get an instance and make the calls.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would avoid CORBA if I could. I like the idea of a co-located Java proxy using JNI to get to the C++ service. Then you could put the Java proxy in a different WebLogic server or even set it up as a servlet proxy.
 
K N
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
First of all I really thank you for your prompt replies. I am relatively new to the area of J2EE so if you could please help me with pointers / code / documentation on the respective approaches suggested, it would be a GREAT HELP.
Thanks again,
Kapil
 
Tim Holloway
Saloon Keeper
Posts: 28101
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Main problem with JNI is that it ties you to solving the specific problem in the specific environment, and my experience is that if something's really useful, people will come back demanding you employ it in ways you'd never have imagined.
While CORBA might have more overhead, it's more general (especially if you're one of those funky shops around here that wants to tie AS/400 RPG apps to Java - or at least other C++ apps), and it's probably going to be a little easier to maintain, since you have a consistent set of well-defined standards to work in.
CORBA got a bad name early because of initial compatability problems, but allegedly that's history.
Or was there something I don't know here?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
If your planing to use of Weblogic 7.0 it could be very easy i think. since it provides new concept called JCOM where u can easly intract with C++ COM objec as ur API.
Ref:
http://edocs.bea.com/wls/docs70/jcom/index.html
 
K N
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We will be sticking to WebLogic 6.1 I guess. If anybody can point me to any site / example it would be a great help
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kapil Nagpal:
We will be sticking to WebLogic 6.1 I guess. If anybody can point me to any site / example it would be a great help

 
Legend has it that if you rub the right tiny ad, a genie comes out.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic