0 Replies Latest reply on Jul 16, 2012 4:34 AM by devmhh

    Change JNDI or accessing resource

    devmhh

      Hello, we are currently integrating arquillian in our test environment. Excepted some issues with authorization everything is working so far. But there is one special problem.

       

      First what  we do:

       

      1. We create an EnterpriseArchive with all dependencies added as modules using the DependencyResolver of ShrinkWrap.
      2. Injecting a bean using @EJB. This works not directly but with usage of a simple JNDI lookup.
      3. Execute tests.

       

      The Problem is the JNDI path. Currently we must use an absolute path which is something like "java:global/test/project-ejb-1.09-SNAPSHOT/MyBean!com.project.MyBean". As you can see this JNDI contains the project version number which is of course dynamic and will change over time. We've tested several alternative JNDIs but nothing worked. To solve this problem we've decided to load a properties-file which contains the current project version number set by maven. It is no problem to insert the properties into the ear but loading this properties-file for the testcases to setup the ejb failes. We used several combinations of different class loaders with getResourceAsStream() but nothing worked.

       

      Has anybody an idea to get a more portable JNDI or how to access the properties-file?

       

      Thanks for your help