@Stateless beans in dependency but needs @PersistenceContext

Hi,
i have a dependency to my EJB that contains @Stateless beans but also needs to have @PersistenceContext injected into the beans. What is the way to go about it?

Currently i load it as a jar in the ear in the lib directory and have the jar also mentioned in the persistence.xml in the main ejb to recognize the domain objects in it.

However when loading the jar, payara stops because it cannot find the unit for thepersistence.

One problem i have is that the same jar is to be used in multiple applications,m so i cannot put a fixed name in the unitName in the peristsenceContext, on top of that i tried that just to see if it would work and it didn’t.

If you need any more info to help, let me know.

Hello,

Codeexample please. :slight_smile: