JSPWiki
  1. JSPWiki
  2. JSPWIKI-728

JNDI mail context lookup fails with JBoss 5.1

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: 2.8.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      All

      Description

      Use of "java:comp/env" does not work with JBoss JNDI.
      Modify MailUtil.getJNDIMailSession() to

      Context initCtx = new InitialContext();
      if (jndiName.startsWith( "java:" ))

      { session = (Session) initCtx.lookup( jndiName ); }

      else

      { Context ctx = (Context) initCtx.lookup( JAVA_COMP_ENV ); session = (Session) ctx.lookup( jndiName ); }

        Activity

        Hide
        Harry Metske added a comment -

        Mslcolm,

        can you provide more specifics on why/how JBoss is failing here ?
        Did you use a proper deployment descriptor to map the component name the the jndi name ?

        For example (web.xml) something like:

         
        <resource-ref>
          <res-ref-name>mail/MyMailSession</res-ref-name>
          <res-type>javax.mail.Session</res-type>
        </resource-ref>
        

        regards,
        Harry

        Show
        Harry Metske added a comment - Mslcolm, can you provide more specifics on why/how JBoss is failing here ? Did you use a proper deployment descriptor to map the component name the the jndi name ? For example (web.xml) something like: <resource-ref> <res-ref-name>mail/MyMailSession</res-ref-name> <res-type>javax.mail.Session</res-type> </resource-ref> regards, Harry
        Hide
        Malcolm Kendall added a comment -

        Hi Harry,
        Yes you are correct, I did not use any deployment descriptor in web.xml.
        It was just an installation out of the box.
        Please close this then as resolved.

        tbh. first time I have heard of the <resource-ref> element.

        Show
        Malcolm Kendall added a comment - Hi Harry, Yes you are correct, I did not use any deployment descriptor in web.xml. It was just an installation out of the box. Please close this then as resolved. tbh. first time I have heard of the <resource-ref> element.

          People

          • Assignee:
            Harry Metske
            Reporter:
            Malcolm Kendall
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development