如何在Windows上使用Java EE(Servlet)正确使用JNI? [英] How to use JNI correctly with Java EE (Servlets) on windows?

查看:372
本文介绍了如何在Windows上使用Java EE(Servlet)正确使用JNI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解Servlet使用JNI的正确方法是什么。

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

据我所知,有几个问题:

As I understand there are several problems:


  1. 如果本机DLL崩溃,它将关闭整个应用服务器

  2. 如果DLL由一个加载的类加载,而不是另一个类加载器将无法加载和使用它。

我搜索了互联网并发现了几种可能的解决方案

I searched internet and found couple of possible solution


  • 创建独立的启用JMS的应用程序,并使用Servlet中的JMS与之通信。

  • 运行独立服务器,加载JNI和通过RMI与之交谈

  • 使用Java连接器架构

我将不胜感激。主题,这种情况下的最佳做法是什么?

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

PS我不确定它是否重要,但需要使用本机DLL的应用程序在JBoss上运行。

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

推荐答案

我绝对不会在Java EE应用服务器中运行基于JNI的工具。您对使用JMS的建议很好。您可以围绕基于消息的Bean创建服务,以响应您的外部服务调度的消息:

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

此处是消息驱动bean上Oracle Java EE文档的链接:
http://download.oracle.com/javaee/5/tutorial/doc/bnbpk.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

我建议将两台JBoss服务器连接到通过JMS相互交谈比编写JCA适配器更容易,并且JMS消息驱动的bean是更清晰的接口。 JCA似乎根本没有发展 - 似乎没有任何伟大的实现教程(这只是我的看法)。

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).

这篇关于如何在Windows上使用Java EE(Servlet)正确使用JNI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆