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