problem in getting mail exchange records(MX) using DNS in java
Hi,
jsp file:
<%@page import="javax.naming.NamingEnumeration"%>
<%@page import="javax.naming.Context"%>
<%@page import="java.util.Hashtable"%>
<%@page import="javax.naming.directory.Attribute"%>
<%@page import="javax.naming.directory.Attributes"%>
<%@page import="javax.naming.directory.InitialDirContext"%>
<%@page import="javax.naming.directory.DirContext"%>
<%
try{
InitialDirContext context = new InitialDirContext();
String tempdomain = "dns:/gmail.com";
Attributes attributes = context.getAttributes(tempdomain, new String[]{"MX"});
out.println("attributes...."+attributes);
Attribute attributeMX = attributes.get("MX");
out.println("attributeMX...."+attributeMX);
}
catch(Exception e){
out.println("Error ****"+e);
e.printStackTrace();;
}
%>
Error:
javax.naming.NotContextException: Not an instance of DirContext
complete error stack trace:
SEVERE: javax.naming.NotContextException: Not an instance of DirContext
at javax.naming.directory.InitialDirContext.getURLOrDefaultInitDirCtx(InitialDirContext.java:92)
at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:123)
at org.apache.jsp.dummy_jsp._jspService(dummy_jsp.java from :73)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:619)
Note : I am using glassfish v3. above code works fine in tomcat.
Thanks,
B.Sucharitha.
View Answers
Ads
Related Tutorials/Questions & Answers:
Advertisements
problem in reading 10000 records in java
problem in reading 10000
records in java Hi
I have a huge
records 10000
records ,while reading it show some error only i can able to read 2000 recds and need to display all the recods in jsper reports
Thanks
Gopi
problem in viewing the mail's content using javamail
problem in viewing the
mail's content
using javamail i'm
using the following code to view a
mail in a javamail application
problem i'm facing... as if they are body of the
mail.
Secondly in some mails i'm
getting the following Exception
mail problem
mail problem Sir,
I tried ur send
mail example but it giveng...;
<title>
Mail API</title>
</head>
<body><table...;
Mail API</h1>
<tr>
java mail send using setText()
java mail send
using setText() Hai , Am newly
mail send portion...);
Here am
using set Text() method to send
mail content in html format. if i use... in
java file . but if i use set Content() method,
mail content is display html
Problem in getting file path in js
Problem in
getting file path in js hi,
I am
using ofbiz framework , How i can get the file path in javascript for input type = "file" and i am
using only firefox not other browser. so please help me it is very important for me
:( I am not getting Problem (RMI)
I am not
getting Problem (RMI) When i am excuting RMI EXAMPLE 3,2
I am
getting error daying nested exception and Connect Exception
 
Read Email using Java Mail API - James
Read Email
using Java Mail API - James https://www.roseindia.net/javamail/send-mail.shtml
From this sample, i understand that we need to pass user... the emails from the James
mail server irrespective of the users
Read Email using Java Mail API - James
Read Email
using Java Mail API - James https://www.roseindia.net/javamail/send-mail.shtml
From this sample, i understand that we need to pass user... the emails from the James
mail server irrespective of the users
Read Email using Java Mail API - James
Read Email
using Java Mail API - James https://www.roseindia.net/javamail/send-mail.shtml
From this sample, i understand that we need to pass user... the emails from the James
mail server irrespective of the users
Read Email using Java Mail API - James
Read Email
using Java Mail API - James https://www.roseindia.net/javamail/send-mail.shtml
From this sample, i understand that we need to pass user... the emails from the James
mail server irrespective of the users
iphone mail sending problem
iphone
mail sending problem Hi, I'm receiving the following error ... while sending
mail in my iphone application
Terminating app due to uncaught...
getting this error and to solve it?
Thanks in Advance!
Hi all,
I get
Send multipart mail using java mail
Send multipart
mail using java mail
This Example shows you how to send multipart
mail using java
mail. Multipart is like a container that holds one or more body
problem in using getKeyCode()
problem in
using getKeyCode() i am working with the jlist...while i was trying to use the arrow keys in the keyboard to select the values in the list it is not working properly...the code which i used is given below
send the mail with attachment problem - Struts
send the
mail with attachment problem Hi friends, i am
using the below code now .Here filename has given directly so i don't want that way. i need...
mail server
properties.setProperty("mail.smtp.host", host
sending mail using jsp
sending
mail using jsp please give me the detailed procedure and code for sending
mail through jsp program
Please visit the following links:
http://www.roseindia.net/ejb/introduction/j2eedemo.shtml
http
send mail using JavaScript
send
mail using JavaScript How can we send
mail using JavaScript?
Hi friends,
You can not send email directly
using JavaScript.
But you can use JavaScript to execute a client side email program send the email
using
Select Records Using Prepared Statement
Select
Records Using Prepared Statement
 ... to select some
specific
records by
using the PreparedStatement. We know... SelectRecords
Select
Records Example by
using the Prepared Statement
problem in jsp using ms-access
problem in jsp
using ms-access after starting server(tomcat) wen v run the pgm,we are just
getting a blank page.I guess we ve a pblm.. in the follwing line of code..
Connection con-DriverManager.getConnection
Count Records using the Prepared Statement
\PreparedStatement>
java CountRecords
Count
records example
using prepared... Count
Records using the Prepared Statement
 ... to count all
records
of the database table by
using the PreparedStatement
Deleting Records using the Prepared Statement
Deleting
Records using the Prepared Statement
 ... the
records from the
database table by
using the PreparedStatement interface... method
by
using the PreparedStatement object. If it
records gets delete
java program to exchange soap message
java program to
exchange soap message Hi Friends,
I want to developed a webservice
using soap as a protocol,in this webservice the client sends a set of 15 parameters and program on web server side receives this 15 parameters
Update Records using Prepared Statement
Update
Records using Prepared Statement
 ... the process of updating the
records by
using the PreparedStatement.
Here arise...\jdbc\jdbc\PreparedStatement>
java UpdatesRecords
Updates
Records Example
Inserting Records using the Prepared Statement
Inserting
Records using the Prepared Statement
 ... to learn how we will insert
the
records in the database table by
using...
records example
using prepared statement!
Enter movie name:
Bagban