Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-4124

Using getDefaultSession istead of getSession in org/jboss/resource/adapter/mail/inflow/MailFolder.java

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • JBossAS-4.2.0.CR1
    • JBossAS-4.0.5.GA
    • JCA service
    • None

      I'm using MDB of type org.jboss.resource.adapter.mail.inflow.MailListener
      it was working incorrectly. Sometimes, out of blue, it stopped fetching mail with exception (which I could see after fix from JBAS-3769):

      2007-02-02 11:51:52,220 ERROR [MailActivation] Failed to execute folder check, spec=MailActivationSpec(mailServer=10.0.0.1, storeProtocol=imap, mailFolder=INBOX, pollingInterval=60000, messageSelector=null, userName=***, maxMessages=1)
      javax.mail.NoSuchProviderException: Invalid protocol: null
      at javax.mail.Session.getProvider(Session.java:412)
      at javax.mail.Session.getStore(Session.java:511)
      at javax.mail.Session.getStore(Session.java:491)
      at javax.mail.Session.getStore(Session.java:477)
      at org.jboss.resource.adapter.mail.inflow.MailFolder.open(MailFolder.java:69)
      at org.jboss.resource.adapter.mail.inflow.MailActivation.run(MailActivation.java:121)
      at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
      at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
      at java.lang.Thread.run(Thread.java:595)

      problem was fixed, when I applyed this patch:
      Index: src/main/org/jboss/resource/adapter/mail/inflow/MailFolder.java
      ===================================================================
      — src/main/org/jboss/resource/adapter/mail/inflow/MailFolder.java (revision 60713)
      +++ src/main/org/jboss/resource/adapter/mail/inflow/MailFolder.java (working copy)
      @@ -64,7 +64,8 @@
      throws Exception
      {
      // Get a session object

      • session = Session.getDefaultInstance(sessionProps);
        + session = Session.getInstance(sessionProps);
        +
        // Get a store object
        store = session.getStore();
        store.connect(mailServer, userName, password);

      I believe that using getDefaultSession() was incorrect, because we don't need defaul we need our session =)

      Please plan this to be fixed.

              weston.price Weston M. Price (Inactive)
              atamur Ilya (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: