4 Replies Latest reply on Mar 15, 2006 11:55 AM by William DeCoste

    problem injecting java:/Mail resource

    Nic Holbrook Newbie

      I'm not sure if I'm just doing something dumb or if there is a bug here. I am trying to inject the mail session into an ejb. The class is a stateless session bean using a local interface only.

      I'm using the following.

      @Resource(mappedName="java:/Mail")
      javax.mail.Session session;

      I've tried changing the mapped name to just Mail, and removing it but I keep getting errors.

      -------------------------------------------------------------------------------------------------------

      2006-03-13 11:01:41,951 ERROR [com.tess.common.interceptor.LoggingInterceptor] java.lang.RuntimeException: Non matching type for inject of field: javax.mail.Session com.tess.itms.service.AuthServiceImpl.session for type: javax.mail.Session of jndiName env/com.tess.itms.service.AuthServiceImpl/session
      Caused by: java.lang.IllegalArgumentException
      at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
      at java.lang.reflect.Field.set(Field.java:656)
      at org.jboss.ejb3.injection.JndiFieldInjector.inject(JndiFieldInjector.java:78)


      ---------------------------------------------------------------------------------------------------------

      Any ideas?