Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-1647

@Resource injection of primitive types from JNDI

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • Unscheduled
    • AS 4.2.1.GA
    • injection
    • None
    • Workaround Exists
    • Hide
      • Use an <env-entry>, which overrides the use of mappedName for primitives/primitive wrappers/String.
        For URL, use <env-entry> and remove mappedName (mappedName overrides).
      • Inject as an Object, and convert in the code.
      Show
      Use an <env-entry>, which overrides the use of mappedName for primitives/primitive wrappers/String. For URL, use <env-entry> and remove mappedName (mappedName overrides). Inject as an Object, and convert in the code.

      The following does not work to inject an arbitrary JNDI entry for primitive/primitive wrapper/String fields:
      @Resource( mappedName = "java:/blah/blah" )
      String myVar;

      In older versions, a "NYI" exception was thrown (then changed to a different exception before getting to the user).
      In newer versions, the literal value in mappedName is injected.

      For all other types, the JNDI entry injection works. For example, the following does inject that same String from JNDI:
      @Resource( mappedName = "java:/blah/blah" )
      Object myVar;

        1. EJBTHREE-1647_classloading.patch
          2 kB
          ALRubinger
        2. MappedName-jboss-metadata.patch
          2 kB
          Brad Maxwell
        3. URL-patch-jboss-ejb3-core.patch
          2 kB
          Brad Maxwell

            arubinge@redhat.com Andrew Rubinger (Inactive)
            rhn-support-dereed Dennis Reed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: