简体   繁体   中英

How to use local @EJB-annotation between WAR and JAR in EAR

I'm using a JBoss eap 6.4 and tries to create a test EAR with a WAR and a JAR with ejb's inside.

My problem is that Servlets in my WAR can not make local calls (@EJB) to the ejb's inside the JAR even though they are packed inside the same EAR. The reference is never injected.

I found this for local clients: It must run in the same application as the enterprise bean it accesses. at https://docs.oracle.com/javaee/6/tutorial/doc/gipjf.html#girfl . To my that sounds like my situation, please correct me if I'm wrong.

I also found this interesting post: EAR vs separate EJB + WAR . To me the situation #1 in the first answer sounds like this should work.

But I also found this post: How to get CDI in war AND EJB running if both are bundled in an EAR that saying that there is different scope for the classloader. To me that sounds like my attempt with local calls never will work. Could it be different situation's for different app-servers?

To illustrate this I just made this image, the problem is where the red arrow is.

Do you think I have mixed something up?

我的耳朵的形象

Best regards Fredrik

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