Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1127

External JNDI Lookup and Object creation fails for embedded scenario

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.3
    • Fix Version/s: None
    • Component/s: JNDI
    • Labels:
      None

      Description

      In case of embedded scenario (e.g. in WAS CE container), no external lookups are successful as the object factory returned is always of type org.apache.aries.jndi.OSGiObjectFactoryBuilder. There is no way to override this currently and hence any object factories required by external JNDI lookups are ignored and object resolution, if required does not work.

        Activity

        Hide
        ajit.pendse Ajit Pendse added a comment -

        Object factories can be configured using "java.naming.factory.object" environment key. From javax.naming.Context javadoc -

        String javax.naming.Context.OBJECT_FACTORIES = "java.naming.factory.object"

        Constant that holds the name of the environment property for specifying the list of object factories to use. The value of the property should be a colon-separated list of the fully qualified class names of factory classes that will create an object given information about the object. This property may be specified in the environment, an applet parameter, a system property, or one or more resource files.

        There should be some way of supporting this for external JNDI look-ups, requiring some type of object resolutions, to work.

        E.g. currently Tibco EMS JNDI connections from Aries cannot work as OSGiObjectFactoryBuilder cannot create required objects for Tibco EMS JNDI.

        Show
        ajit.pendse Ajit Pendse added a comment - Object factories can be configured using "java.naming.factory.object" environment key. From javax.naming.Context javadoc - String javax.naming.Context.OBJECT_FACTORIES = "java.naming.factory.object" Constant that holds the name of the environment property for specifying the list of object factories to use. The value of the property should be a colon-separated list of the fully qualified class names of factory classes that will create an object given information about the object. This property may be specified in the environment, an applet parameter, a system property, or one or more resource files. There should be some way of supporting this for external JNDI look-ups, requiring some type of object resolutions, to work. E.g. currently Tibco EMS JNDI connections from Aries cannot work as OSGiObjectFactoryBuilder cannot create required objects for Tibco EMS JNDI.
        Hide
        SergiusMohr Sergius Mohr added a comment -

        My Workaround in embedded scenario with Apache Sling and Tomcat for accesing JDBC-DataSource:

        • don't use Aries JNDI bundles (and no other bundles like xbean-naming, PAX-JDBC etc.)
        • use (Tomcat) default JNDI ObjectFactory (java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, java.naming.factory.url.pkgs=org.apache.naming)
        • add package "org.apache.naming" to org.osgi.framework.system.packages (or sling.system.packages in my case)

        Now i can access my Tomcat-DataSource "java:/comp/env/jdbc/myDataSource" from persistence.xml (or directly/manual from bundle).

        Show
        SergiusMohr Sergius Mohr added a comment - My Workaround in embedded scenario with Apache Sling and Tomcat for accesing JDBC-DataSource: don't use Aries JNDI bundles (and no other bundles like xbean-naming, PAX-JDBC etc.) use (Tomcat) default JNDI ObjectFactory (java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, java.naming.factory.url.pkgs=org.apache.naming) add package "org.apache.naming" to org.osgi.framework.system.packages (or sling.system.packages in my case) Now i can access my Tomcat-DataSource "java:/comp/env/jdbc/myDataSource" from persistence.xml (or directly/manual from bundle).

          People

          • Assignee:
            Unassigned
            Reporter:
            ajit.pendse Ajit Pendse
          • Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:

              Development