简体   繁体   English

EJB项目中的Netbeans和Call Enterprise Bean

[英]Netbeans and Call Enterprise Bean in EJB project

Hi i have a problem with calling a Enterprise Bean (from EJB container) in Servlet (in Web Container). 嗨,我在Servlet(在Web容器中)中调用Enterprise Bean(从EJB容器中)时遇到问题。

i get following error: 我得到以下错误:

remote interface must be stored in separate ejb client jar in order to reference

My projects structures look like: 我的项目结构如下:

======= EE APPLICATION (EJB and WEB) ======== ======= EE应用程序(EJB和WEB)========

在此处输入图片说明

======= EJB CONATINER ======== ======= EJB CONATINER ========

在此处输入图片说明

======= WEB CONATINER ======== =======网络主持人========

在此处输入图片说明

Understanding a error message my Web Container should contains a jar file with interface definition of EJB Bean which i would like to call (StringProvider). 理解了一条错误消息后,我的Web容器应包含一个我要调用的具有EJB Bean接口定义的jar文件(StringProvider)。 But i have already included this dependecy in WebContainer. 但是我已经在WebContainer中包含了这种依赖。 And error still shown. 并且错误仍然显示。

==== INDEX SERVLET ===== ====索引服务=====

在此处输入图片说明

==== AND STILL ERROR APPEAR ===== ====仍然出现错误=====

在此处输入图片说明

What i do wrong?? 我做错了什么? Can anybody help with this issue. 任何人都可以帮助解决这个问题。 I will greatful for help 我将竭诚为您服务

As you are creating a WAR and an EJB file and storing them in an Enterprise Archive, NetBeans is saying that you will have potential problems if you keep your remote interface in the same project as the EJB's themselves. 在创建WAR和EJB文件并将它们存储在企业归档中时,NetBeans表示,如果将远程接口与EJB本身放在同一个项目中,则可能会出现问题。

NetBeans is telling you that you must put your remote EJB references into a separate JAR file that both your EJB and WAR projects can then reference. NetBeans告诉您,必须将远程EJB引用放入一个单独的JAR文件中,然后EJB和WAR项目都可以引用该文件。

If you do this, then the problem will go away and you will be able to reference the EJB correctly. 如果这样做,那么问题将消失,并且您将能够正确地引用EJB。

Depending upon your needs, it may be easier for you to use local interfaces and put your EJBs within your WAR file. 根据您的需求,使用本地接口并将EJB放入WAR文件中可能会更容易。 You will then not have to have a separate JAR file that contains remote interfaces. 然后,您将不必具有包含远程接口的单独的JAR文件。 This obviously depends on whether you need to separate the EJBs and WAR files out into an EAR or not. 显然,这取决于您是否需要将EJB和WAR文件分离到EAR中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM