I am working on migrating a project to deltaspike & WildFly. It has a web module, ejb module and multiple submodules. One of the submodule A, has Entity and EntityRepository. I am trying to inject it into another submodule B. Injection fails and I am getting NPE.
During startup, Servlet in webmodule call a RepositoryFactory(spring factory) in Module B to create repository, which has EntityRepository from module A injected.
This is my ear structure.
EAR
|_META-INF
| |_Application.xml
|
|_WebModule
|_EJBModule
|_Lib
|_Module A
| |_Entity
| |_EntityRepository
|_Module B
|_NamedQueryRepoFactory
|_NamedQueryRepository
Entity
@Entity
@Table(name="WF_NAMED_QUERY_REF")
public class WfNamedQueryRef implements Serializable {
...
}
EntityRepository
@ApplicationScoped
@Repository
public abstract class WfNamedQueryRefEntityRepository implements EntityRepository<WfNamedQueryRef, Integer>, EntityManagerDelegate<WfNamedQueryRef> {
...
}
Other bean where I am trying to inject
@ApplicationScoped
public class NamedQueryRepository extends AbstractNamedQueryRepository {
private Logger logger = LoggerFactory.getLogger(this.getClass().getName());
@Inject
private WfNamedQueryRefEntityRepository namedQueryRepo;
....
List<WfNamedQueryRef> list = namedQueryRepo.findAll();
....
}
I have beans.xml in META-INF folder in each submodule and also in WEB-INF folder in WebModule.
In the log during startup I see ClassDeActivationUtils for all the EntityRepository with "activated=true".
[org.apache.deltaspike.core.util.ClassDeactivationUtils] (MSC service thread 1-4) class: domain.repository.WfNamedQueryRefEntityRepository activated=true
What else I am missing.
Thanks