• 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

EJB calling JNI

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have been asked to make calls from EJBs to native c/c++ libraries using JNI. I have read that this is a bad idea but I don't know enough about how the two technologies would interact to be able to defend the notion of NOT doing this or proposing alternate solutions. Can anyone help me out with this?
What I need are:
-- Reasons why making JNI calls from an EJB are a bad idea. (Things like threading, transactions, etc. in detail on why its bad/dangerous)
-- Possible work-arounds or other solutions. I've heard that using a separate RMI server to make the JNI calls might work....but I'm worried about scaleability and performance.
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see any problem with an EJB calling a C function via JNI. I'm actually doing something similar at the moment. I use SAP JCO, which is a Java API that wraps JNI calls to an SAP system, and we are using the adapter from our EJB code, so essentially we are making JNI calles.
I would not make direct JNI calls from you EJB code. Create a wrapper or adapter that performs the JNI work, so it's easier to replace with anohter component in the future because I'm assuming that you are attempting to access a legacy system using this JNI code, right? You may run across a JCA adapter in the future, so swapping out the JNI code for the JCA adapter would be easier.
Hope it helps,
Raffi
 
Don't touch me. And dont' touch this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic