简体   繁体   中英

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

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

在此处输入图片说明

======= 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). But i have already included this dependecy in 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.

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.

If you do this, then the problem will go away and you will be able to reference the EJB correctly.

Depending upon your needs, it may be easier for you to use local interfaces and put your EJBs within your WAR file. You will then not have to have a separate JAR file that contains remote interfaces. This obviously depends on whether you need to separate the EJBs and WAR files out into an EAR or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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