1 Reply Latest reply on Jul 30, 2012 7:05 PM by Mitchell Ackerman

    javax.naming.NoInitialContextException in WebApp

    Mitchell Ackerman Newbie

      Hi, I have a webapp, running in JBoss AS7.1.1.Final.  In it, I am attempting to send an email, but am getting javax.naming.NoInitialContextException when trying to lookup SMTP:


      InitialContext ic = new InitialContext();

      Session mailSession = (Session)ic.lookup("java:/Mail");


      my standalone.xml contains:


              <subsystem xmlns="urn:jboss:domain:naming:1.1"/>


              <subsystem xmlns="urn:jboss:domain:mail:1.0">

                                              <mail-session debug="true" jndi-name="java:/Mail" from="test@test.com" >

                                                             <smtp-server outbound-socket-binding-ref="mail-smtp"/>




      the complete error is:


      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial


      Anyone have any idea what is going on here?


      thanks, Mitchell