Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7740899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:53:40+00:00 2026-06-01T08:53:40+00:00

Why does Glassfish shows this facelets error: javax.el.ELException: /foo/client.xhtml @11,74 value=#{messageBean.messages}: javax.mail.MessagingException: Socket closed;

  • 0

Why does Glassfish shows this facelets error:

javax.el.ELException: /foo/client.xhtml @11,74 value="#{messageBean.messages}": javax.mail.MessagingException: Socket closed;
  nested exception is:
    java.net.SocketException: Socket closed

Which I attribute to hitting leafnode on localhost too frequently and too rapidly. Glassfish logs below show successful message retrievals from leafnode, but multiple calls to SingletonNNTP.loadMessages().

How can deal with sockets correctly? Sometimes Leafnode gives desired output, sometimes not.

INFO: Initializing Mojarra 2.1.6 (SNAPSHOT 20111206) for context '/NNTPjsf'
INFO: WEB0671: Loading application [NNTPjsf] at [/NNTPjsf]
INFO: NNTPjsf was successfully deployed in 2,574 milliseconds.
INFO: MessageBean..
INFO: MessageBean..
INFO: MessageBean.getMessages..
INFO: MessageBean.getNNTP..
INFO: MAKING SINGLETON..
INFO: NNTP.loadMessages...
INFO: NNTP.loadMessages...
nntp: <200 Leafnode NNTP Daemon, version 1.11.8 running at localhost (my fqdn: dur.bounceme.net)
nntp: >GROUP comp.lang.java.help
nntp: <211 82 3 84 comp.lang.java.help group selected
nntp: >GROUP comp.lang.java.help
nntp: <211 82 3 84 comp.lang.java.help group selected
nntp: >XHDR Message-ID 3-84
nntp: <221 Message-ID header (from overview) for postings 3-84:
nntp: <3 <afp6m75oi6nli4b6q87s317lkc13g689c2@4ax.com>
nntp: <4 <ed7f31e9-8a19-46c7-9a7c-ad8aabfb9599@x10g2000pbi.googlegroups.com>
nntp: <5 <uA4ar.13560$fj7.13111@newsfe20.iad>

The backing bean as so:

package net.bounceme.dur.nntp;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.inject.Named;
import javax.mail.Message;

@Named
@SessionScoped
public class MessageBean implements Serializable {

    private static final long serialVersionUID = 1L;
    private static final Logger logger = Logger.getLogger(MessageBean.class.getName());
    private static Level level = Level.INFO;
    private DataModel dm = null;

    public MessageBean() {
        logger.log(level, "MessageBean..");
    }

    public List<Message> getMessages() throws Exception {
        logger.log(level, "MessageBean.getMessages..");
        List<Message> messages = getNNTP();
        return messages;
    }

    public DataModel getModel() throws Exception {
        logger.log(level, "MessageBean.getModel..");
        List<Message> messages = getNNTP();
        dm = new ListDataModel(messages);
        return dm;
    }

    private synchronized List<Message> getNNTP() throws Exception {
        logger.log(level, "MessageBean.getNNTP..");
        List<Message> messages = new ArrayList<Message>();
        SingletonNNTP nntp = SingletonNNTP.INSTANCE;
        messages = nntp.getMessages(false);
        logger.log(level, "MessageBean.getNNTP nntp.size:  {0}", messages.size());
        return messages;
    }
}

the Singleton:

package net.bounceme.dur.nntp;

import static java.lang.System.out;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.mail.*;

public enum SingletonNNTP {

    INSTANCE;
    private final Logger logger = Logger.getLogger(SingletonNNTP.class.getName());
    private final Level level = Level.INFO;
    private Properties props = new Properties();
    private List<Message> messages = new ArrayList<Message>();

    private SingletonNNTP() {
        out.println("MAKING SINGLETON..");
        props = PropertiesReader.getProps();
        boolean loaded = false;
        try {
            loaded = setMessages(false);
        } catch (Exception ex) {
            Logger.getLogger(SingletonNNTP.class.getName()).log(Level.SEVERE, "FAILED TO LOAD MESSAGES", ex);
        }
    }

    public List<Message> getMessages(boolean debug) throws Exception {
        logger.log(level, "NNTP.getMessages...");
        logMessages();
        return Collections.unmodifiableList(messages);
    }

    private boolean setMessages(boolean debug) throws Exception {
        logger.log(level, "NNTP.loadMessages...");
        Session session = Session.getDefaultInstance(props);
        session.setDebug(debug);
        Store store = session.getStore(new URLName(props.getProperty("nntp.host")));
        store.connect();
        Folder root = store.getDefaultFolder();
        Folder folder = root.getFolder(props.getProperty("nntp.group"));
        folder.open(Folder.READ_ONLY);
        Message[] msgs = folder.getMessages();
        messages = Arrays.asList(msgs);
        folder.close(false);
        store.close();
        if (debug) {

        }
        return true;
    }

    private void logMessages() throws Exception {
        logger.log(level, "NNTP.logMessages..");
        for (Message m : messages) {
            logger.log(level, String.valueOf(m.getMessageNumber()));
            logger.log(level, m.getSubject());
            logger.log(level, m.getContent().toString());
        }
    }

    private void persistMessages() throws Exception {
        //entities.Messages
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:53:41+00:00Added an answer on June 1, 2026 at 8:53 am

    That message means that you closed the socket and then tried to read from or write to it. You are trying to read Message content after you have closed the connection. You need to save not the Messages themselves but their content, while the connection is open.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does map() iterate through the list like for would? Is there a value in
Does anyone know how to configure glassfish 3.1 to host a web application? I
Environment : GlassFish 3.0.1, NetBeans 6.9, JDK 6u21 Problem : Unable to run app-client
I have the following authentication form in JSF running on Glassfish 3: <h:messages globalOnly=true
I'm using JSF2 and GlassFish, PrimeFaces 2.1. This works, showCreateProfile() method gets hit, and
Since migrating to Glassfish 3.1, my project cant source: com.sun.xml.rpc.client.StubPropertyConstants; . Glassfish 2.1 found
Does anyone know if OpenESB components, any version, can run on Glassfish v3? Or
I have a server java project, which runs on glassfish. How does it put
Does Glassfish has any hooks for start and shutdown and for domain start/stop ?
Does anyone know how to get the Oracle performance tuner (referred to in this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.