Victor Ronin
Victor Ronin

Reputation: 23298

How to use JNI correctly with Java EE (Servlets) on windows?

I am trying to understand what is the correct way of usage JNI from Servlet.

As I understand there are several problems:

  1. If native DLL crashes, it will bring down whole app server
  2. If DLL is loaded by one class loaded, than another class loader won't be able to load and use it.

I searched internet and found couple of possible solution

I would appreciate any information on this subject, what is best practice in this case?

P.S. I am not sure whether it's important, but the application which needs to use native DLL runs on JBoss.

Upvotes: 0

Views: 1697

Answers (1)

Chris K
Chris K

Reputation: 12359

I would absolutely not run a JNI-based tool in a Java EE app server. Your suggestion for using JMS is a good one. You could create a service around message based Beans to respond to messages dispatched by your external service:

http://oreilly.com/catalog/entjbeans3/chapter/ch13.html

Here is the link to the Oracle Java EE documentation on Message-driven beans: http://download.oracle.com/javaee/5/tutorial/doc/bnbpk.html

I would suggest getting two JBoss servers to talk to one another over JMS is easier than writing a JCA adapter, and that JMS message-driven beans are a cleaner interface. JCA doesn't seem to be evolving at all - there doesn't seem to be any great implementation tutorials (that's just my perception).

Upvotes: 1

Related Questions