Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

list of providers servlet  RSS feed

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is in reference to Javamail:
I am trying to get a list of providers using the following code.The result is length=0.Does that mean there is no provider installed and if not how to install a provider?(I have tried the 'put' method of Properties but looks like it doesnt work.)
How do I change the provider registry?
The code has been tested on weblogic 5.1.0 server.
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class ListProviderServlet extends GenericServlet
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
PrintWriter out = response.getWriter();
Properties properties = System.getProperties();
Session session = Session.getInstance(properties, null);
Provider[] providers = session.getProviders();
out.println("length= " + providers.length);
catch (IOException e)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!