In a EJB only approach:
- You should shield your application from the native code, using helper
classes. The same functionality you will use with your EJB, you could
reuse
with some other component type.
- You cannot pass JTA transaction to native code, so you should use the
NotSupported transaction declaration in yours EJB deployment descriptor
- If you need to have a transaction in code like
doSomethingBeforeNative,
doSomethingNative, doSomethingAfterNative, you need some "special" code
to
handle cases like these, Id the all something's have successfully
completed,
except the last one, you need to "manually" undo the native!
A "pure" EJB developer will use Corba or JMS to communicate with the
native
code, I think you need to also, on the server part, something to deal
with
transactions, if you want transaction propagation
In Corba you need
- to have skill's for that (you can do it in Java, by the way)
- an ORB
If you want to have a robust deployment, always deploy your native code
in a
different "server instance" of the one(s) running the EJB containers. If
your
native code crashes, it will not crash the EJB container.
Anup Maliyackel wrote:
> I have a design issue regarding JNI and EJB. I have a native library with
> me for predictive modelling. I want to use the library along with EJB. I
> have searched the archives and a few other sites like theserverside.com and
> have got a few tips
>
> 1. Even though J2EE prohibits JNI from EJB a lot of app servers allow you
> to do it. So one option is use JNI directly from EJB.
> 2. Use a helper class having a static block to load the library. This
> helper class can have methods(static?) to call the native methods. From EJB
> call the methods of the helper class
> 3. Use RMI from EJB to talk to the native library
> 4. Use CORBA
> 5. Use messaging service
>
> My questions are
>
> 1. Are there any security issues in using option 1 or option 2?
> 2. What should be the approach if the native library has to maintain state
> and might be part of an ejb transaction?
> 3. Are there any problems with concurrent access to the library?
> 4. What about exceptions thrown from native code? How will it affect
> clustering, transactions etc.
> 5. What are the pros and cons of the various approaches listed above.
>
> Any tips would be appreciated
> Regards
> Anup
--
Bruno Antunes,
Java Software Engineer
email: mailto:[EMAIL PROTECTED]
Phone: +351.21.7994200
Fax : +351.21.7994242
WhatEverSoft - Java Center
Centro de Competencia Java
Praca de Alvalade, 6 - Piso 4
1700-036 Lisboa - Portugal
URL: http://www.whatevernet.com
_____________________________________________________________________
INTERNET MAIL FOOTER
A presente mensagem pode conter informa��o considerada confidencial.
Se o receptor desta mensagem n�o for o destinat�rio indicado, fica
expressamente proibido de copiar ou endere�ar a mensagem a terceiros.
Em tal situa��o, o receptor dever� destruir a presente mensagem e por
gentileza informar o emissor de tal facto.
---------------------------------------------------------------------
Privileged or confidential information may be contained in this
message. If you are not the addressee indicated in this message, you
may not copy or deliver this message to anyone. In such case, you
should destroy this message and kindly notify the sender by reply
email.
---------------------------------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".