9 Replies Latest reply on Feb 20, 2013 5:01 PM by shadowcreeper

    Possible to express jndi dependencies without @Resource ?

    Trond G. Ziarkowski Newbie

      Hi all,


      I have an application that uses an ejb with @Startup and @Singleton to bootstrap a spring application. My application is using hibernate api without jpa and trying to use Infinispan for 2nd level cache causes this error:

      [org.hibernate.cache.infinispan.JndiInfinispanRegionFactory] (ServerService Thread Pool -- 66) Unable to retrieve CacheManager from JNDI [java:jboss/infinispan/container/hibernate]: javax.naming.NameNotFoundException: Error looking up infinispan/container/hibernate, service service jboss.naming.context.java.jboss.infinispan.container.hibernate is not started


      If I add @Resource(mappedName = "java:jboss/infinispan/container/hibernate") public void setDummy(Object o) {}, then jboss figures out that infinispan must be started before my app and everything works.


      I use this bootstrapper ejb in multiple contexts and its dependencies will then be different, so I don't want to express dependencies using annotations and dummy setter methods.

      Can I somehow express this dependency another way? In MANIFEST.MF or any of the deployment descriptors?