glassfish
  1. glassfish
  2. GLASSFISH-15837

jndi.properties not set when using embedded glassfish

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.1_b40
    • Fix Version/s: None
    • Component/s: embedded
    • Labels:
      None

      Description

      To be fair, I'm not sure this is a bug so much as something that deserves to be explained.

      When you use the maven-embedded-glassfish-plugin, you connect to the running Glassfish instance by doing:

      new InitialContext();

      Obviously for this to work a jndi.properties has to be on the classpath somewhere. Merely using the maven-embedded-glassfish-plugin is not sufficient.

      There needs to be an as-easy-as-possible way to have "new InitialContext()" Just Work.

        Activity

        Hide
        Bhavanishankar added a comment -

        The tests are run in surefire plugin. In the test you are doing

        new InitialContext()

        For that to work, the surefire test will require a jndi provider specified via jndi.properties in its classpath.

        I don't see this as an issue with glassfish plugin.

        Show
        Bhavanishankar added a comment - The tests are run in surefire plugin. In the test you are doing new InitialContext() For that to work, the surefire test will require a jndi provider specified via jndi.properties in its classpath. I don't see this as an issue with glassfish plugin.
        Hide
        Bhavanishankar added a comment -

        It might be worth mentioning that, including glassfish-embedded-all as a project dependency with <scope>test</scope> is all that is needed to get everything working here.

        Show
        Bhavanishankar added a comment - It might be worth mentioning that, including glassfish-embedded-all as a project dependency with <scope>test</scope> is all that is needed to get everything working here.
        Hide
        ljnelson added a comment -

        Right. That seems a little heavyweight, though. Is there a "thinner" "lighter" dependency I should use? Or is there a way for the plugin to somehow shove a jndi.properties onto the classpath somehow?

        Show
        ljnelson added a comment - Right. That seems a little heavyweight, though. Is there a "thinner" "lighter" dependency I should use? Or is there a way for the plugin to somehow shove a jndi.properties onto the classpath somehow?
        Hide
        Sanjeeb Sahoo added a comment -

        You have at least two choices:
        a) Just pass a properties object containing
        java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory
        to new InitialContext().
        b) Add jndi.properties to your application.

        Show
        Sanjeeb Sahoo added a comment - You have at least two choices: a) Just pass a properties object containing java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory to new InitialContext(). b) Add jndi.properties to your application.

          People

          • Assignee:
            Bhavanishankar
            Reporter:
            ljnelson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: