0 Replies Latest reply on Jan 30, 2010 4:36 PM by Markus Reich

    Mail session through JNDI

    Markus Reich Newbie

      Hi community,

       

      I have following constellation:

      JBOSS 4.2.2 (contains EJB Beans containing the business logic

      Tomcat 6 running the GUI

       

      Now I want to use the mail session provided by JBOSS in my Tomcat deployed app, I thought I can use the Spring JNDI Template therefore:

       

      <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
      <property name="environment">
      <props>
      <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
      <prop key="java.naming.provider.url">172.20.36.106</prop>
      <prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
      </props>
      </property>
      </bean>
      <bean id="mailSession" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
      <property name="jndiTemplate" ref="jndiTemplate" />
      <property name="jndiName" value="java:/Mail" />
      </bean>
      But using this leads to following error?
      Caused by: javax.naming.NameNotFoundException: Mail not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
      Maybe I misunderstood sthg. or am I doing something wrong, when I look into the JMX console I see the java:/Mail service running?
      regards
      Meex