4 Replies Latest reply on Mar 15, 2006 2:32 AM by scotto

    Mail service doesn't work in JBoss 4.0.4RC1

    herkules

      Hi,

      mail service works in 4.0.3sp1 but doesn't work in 4.0.4RC1. The log is strange:

      [org.jboss.system.ServiceCreator] Created bean: jboss:service=Mail
      [org.jboss.system.ServiceConfigurator] JNDIName set to java:/Mail in jboss:service=Mail

      ...

      In EJB stateless bean ctx.lookup("java:/Mail") returns null

      ...
      (shutdown)
      [org.jboss.deployment.SARDeployer] stopping mbean jboss:service=Mail
      [org.jboss.system.ServiceController] stopping service: jboss:service=Mail
      [org.jboss.system.ServiceController] stopping dependent services for: jboss:service=Mail dependent services are: []
      [org.jboss.mail.MailService] Stopping jboss:service=Mail
      [org.jboss.mail.MailService] Mail service 'java:/Mail' removed from JNDI
      [org.jboss.mail.MailService] Stopped jboss:service=Mail
      [org.jboss.deployment.SARDeployer] destroying mbean jboss:service=Mail
      [org.jboss.system.ServiceController] destroying service: jboss:service=Mail
      [org.jboss.system.ServiceController] destroying dependent services for: jboss:service=Mail dependent services are: []
      [org.jboss.mail.MailService] Destroying jboss:service=Mail
      [org.jboss.mail.MailService] Destroyed jboss:service=Mail
      [org.jboss.deployment.SARDeployer] removing mbean jboss:service=Mail
      [org.jboss.system.ServiceController] removing service: jboss:service=Mail
      [org.jboss.system.ServiceController] removing jboss:service=Mail from server
      [org.jboss.system.ServiceController] Ignoring request to remove nonexistent service: jboss:service=Mail

      Any idea what is wrong?

      Thanks Jan

        • 1. Re: Mail service doesn't work in JBoss 4.0.4RC1

          I've got the same problem with JBoss 4.0.4RC1 in the mail service JNDI lookup always returning null.

          From the log:

          16:42:45,312 INFO [MailService] Mail Service bound to mail/Mail


          My code:

          Context jndiContext = new session = (Session) jndiContext.lookup("mail/Mail");
          if( session == null ) {
           logger.error("JNDI lookup returned null session.");
          }


          Program output:
          16:46:55,156 [main] ERROR EmailUtils : JNDI lookup returned null session.


          Any ideas what is going on?


          • 2. Re: Mail service doesn't work in JBoss 4.0.4RC1
            herkules

            For me it worked to use:

            @Resource(mappedName="java:/Mail")
            private Session mailSession;

            instead of ctx.lookup. But the lookup should work too I suppose. Bug in RC?

            Jan

            • 3. Re: Mail service doesn't work in JBoss 4.0.4RC1
              herkules

              This can also help you: http://jira.jboss.com/jira/browse/JBAS-2938, mail client requires activation.jar.

              • 4. Re: Mail service doesn't work in JBoss 4.0.4RC1

                OK I found what the problem is (for my case at least):

                The code I was using to request the Session object from JNDI was running as a unit test case external to JBoss itself. (ie. as a JBoss client, rather than as a session bean or mbean). When I put this same code inside a session bean the Session object resolved fine!

                Is this a bug or a feature? Should client applications be able to request the MailService from JNDI and get an appropriate remote proxy object?

                If this is indeed the desired behaviour, would it not be better to throw some kind of NamingException to indicate that a remote interface is not available for the given object name, rather than just returning null?