As previously stated (in the other thread), JNI is frowned upon in the EJB spec.
JNI has a nasty habit of blowing up (either due to memory leaks or poor interfacing to the dll/shared library) so keeping it outside of the JBoss JVM helps protects your application and application server from falling over. JCA-CORBA-RMI/JNI all work to accomplish that by placing isolating the native calls by varying degrees.
The only problem with CORBA is that usually you need an ORB framework - omniOrb only runs in a Cygwin environment on Windows so you'll probably MICO I suppose. CORBA is usually such a lot of work even to build some simple wrappers but Java at least has the tools to generate the call stubs on the JBoss end of things.
If you are comfortable with building RMI/JNI services or JCA services, that might be easier.
Hopefully someone else has some better ideas.
I can use JNI directly from a servlet on a standalone Tomcat, which would perhaps be the best performance of all solutions. So I'm still trying to think of a reason why an app server would benefit me in this case.
Do I need to buy a bridge solution like J-Integra for connecting to C++ dlls? Or does the JCA give me that functionality for free? We have old Fortran stuff too, but we'd probably have to wrap that in C++ anyway. I'm obviously clueless, but can't find any good explanations on the Internet. Everything concentrates on EIS connections.
I have to say, this is a really difficult decision for me. Thanks again for the input.
The JCA gives you a J2EE-compliant solution. Essentially, EJBs should obtain external resources through the container services - the container shields the EJB from the external environment and manages access to the external resources. This arrangement can also help prevent overtaxing resources and deal with issues such as when an EJB gets passivated and so on. Where you might have a large number of EJB instances, you don't necessarily want to have a resource lock per EJB instance.
EJBs aren't going to be the solution to everything. However, I find them a useful solution for enforcing scalable implementations, and ensuring the development of centralised business rules (Business APIs to steal from SAP) for access to data. I've seen a few commercial e-business applications using only servlets, and they have had both load-bearing issues, and transactional and data inconsistencies. For implementing large and complex business systems, EJBs make sense. YMMV.