Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-2558

Component's resources defined in the \<env-entry\> are not available to the EJB3 JAX-WS handlers

    XMLWordPrintable

Details

    Description

      While the resources defined in \<env-entry\> are not injected using the @Resource in handlers for both Web and EJB3 containers (an issue has been created for this problem), they are not available via JNDI lookup from handlers for EJB3 container as the JSR 109 requires. Therefore, for EJB3-based WS components, there's no way to pass any data into the associated handlers. I tried this on both JBossAS 4.2.2.GA (JBossWS 2.0.1) and JBoss 5.0.0.GA (JBossWS 3.0.4). Here's the details on the code:

      • A simple EJB3 stateless session bean annotated with @WebService and @HandlerChain
      • ejb-jar.xml has the following \<env-entry\> definition for the session bean:

      \<env-entry\>
      \<env-entry-name\>configFile\<env-entry-name\>
      \<env-entry-type\>java.lang.String\<env-entry-type\>
      \<env-entry-value\>TestService2HandlerConfig.xml\<env-entry-value\>
      \<env-entry\>

      • The hanler is a SOAP handler and has the following code segment:

      @Resource(name="configFile")
      String configFile;
      ....
      @PostConstruct
      public void init() {
      if (configFile == null) {
      InitialContext icxt = new InitialContext();
      Context myEnv = icxt.lookup("java:comp/env");
      configFile = (String)myEnv.lookup("configFile");
      ....

      Note: the same handler configured for Web-container WS endpoints works OK - although configFile is not injected by @Resource, but at least it looked up fine using JNDI.

      Can this be fixed more easily and therefore earlier since it already works for Web container based WS endpoint/handler? This is a show stopper since there's no way to pass in info into the handler for EJB3 based WS endpoint/handler.

      Attachments

        Issue Links

          Activity

            People

              ropalka Richard Opalka
              gang.yang_jira Gang Yang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: