Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3114

@Resource(lookup="java:...") causes an exception for URL resources

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 8.0.0.Final
    • None
    • None
    • Hide

      Injection the following resource to any container managed bean.

      @Resource(lookup="java:global/url/Configuration)
      private URL url;

      define resource in server-configuration (e.g. standalone.xml)

      <subsystem xmlns="urn:jboss:domain:naming:2.0">
      <bindings>
      <simple name="java:global/url/Configuration" value="file:///data/config/wildfly-services-1.0" type="java.net.URL"/>
      </bindings>
      <remote-naming/>

      Show
      Injection the following resource to any container managed bean. @Resource(lookup="java:global/url/Configuration) private URL url; define resource in server-configuration (e.g. standalone.xml) <subsystem xmlns="urn:jboss:domain:naming:2.0"> <bindings> <simple name="java:global/url/Configuration" value="file:///data/config/wildfly-services-1.0" type="java.net.URL"/> </bindings> <remote-naming/>

      When referencing an URL resource via @Resource the lookup-property only supports a valid URLs (e.g. http://www.jboss.org). A JNDI-Name causes an exception (e.g. java:global/url/Configuration or java:app/url/Configuration)

      Issue has been discussed in the user form.

      Note:
      @Resource(name="java:global/url/Configuration") works.
      From my point of view, the javadoc of @Resource is not very easy to understand.

            emartins@redhat.com Eduardo Martins
            thomas.kriechbaum Thomas Kriechbaum (Inactive)
            Eduardo Martins
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: