I have a need to call functions in a C library to perform certain operations. As has been posted elsewhere, EJB spec say under "Programming Restrictions" that EJB should not load native libraries due to security reasons (?what security reasons?).
I'm trying to come up with workarounds to this and would appreciate your feedback.
1) I can have a helper class loaded at startup of appserver. Thus, both the container & this helper class run on the same JVM. The helper class loads the library statically & interfaces to it via JNI. The EJB calls static methods on this helper class to communicate with the library. What are the implications of this design? Would the thread handling of the library impact the container? Can I use JNI in this case or will I have to use CORBA?
2) I load the helper class in a separate JVM & the EJB will use CORBA to communicate with the helper class, like above. Is this better?
3) I don't have a helper class at all. I just use plain & simple CORBA to call the C library from EJB.
I'm not sure if any of these are a good idea especially with the no-JNI rule in the spec. I'm aware of the java.security.policy property that has to be set to allow the helper class to load the library. Also, my appserver will be running on the same machine as the C library.
Any comments & feedbacks appreciated. Any direct experience with this design would be fantastic!