Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners problem in getting mail exchange records(MX) using DNS in java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


B.sucharitha
problem in getting mail exchange records(MX) using DNS in java
0 Answer(s)      2 years and 7 months ago
Posted in : Java Beginners


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.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
problem in getting mail exchange records(MX) using DNS in java
problem in getting mail exchange records(MX) using DNS in java  Hi...(); String tempdomain = "dns:/gmail.com"; Attributes attributes = context.getAttributes(tempdomain, new String[]{"MX"}); out.println("attributes
problem in getting mail exchange records(MX) using DNS (glassfish(struts2))
problem in getting mail exchange records(MX) using DNS (glassfish(struts2... tempdomain = "dns:/dmk.com"; Attributes attributes = context.getAttributes(tempdomain, new String[]{"MX"}); out.println("attributes...."+attributes); Attribute
Advertisements
how to get mail exchange records using java dns protocol
how to get mail exchange records using java dns protocol  Hi, how to get DNS mail exchage records(MX) using struts2 framework(server:glassfishv3) Thanks, B.Sucharitha.
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
send mail using smtp in java
send mail using smtp in java  How to send mail using smtp in java?   Sending mail in JSP - SMTP
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
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
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>
How to read yahoo mail using java mail api - WebSevices
How to read yahoo mail using java mail api  Hi there .... i wanted to know how to read mail from yahoo using pure java code. Is there any one who can help me regarding this, please if possible show me the exact way as well
send without authentication mail using java - JavaMail
send without authentication mail using java  Dear All, I am tring to send simple mail without authentication using java. is it possible, could... props = new Properties(); props.put("mail.smtp.host", "mail host name
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
when sending the mail from java I am getting the below error - JavaMail
when sending the mail from java I am getting the below error   when sending the mail from java I am getting the below error : Exception... not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/mail/mail.jar,file
problem getting password - JavaMail
problem getting password  hi i am trying to get password but igot following error Error sending mail:javax.mail.MessagingException: Could not connect to SMTP host: 192.168.10.14, port: 25;nested exception
java source code to create mail server using struts2
java source code to create mail server using struts2  java source code to create mail server using struts2
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
How i can send testing mail on my id using java?
How i can send testing mail on my id using java?  Which packages i should use to implementing java mail service??? Thanks
Getting the Records in PL/SQl between Date Ranges - JDBC
Getting the Records in PL/SQl between Date Ranges  Getting the records Between the Dates in PL/SQL Database by using JDBC and display through JSP
JAVA MAIL - JavaMail
application using JAVA MAIL API.  Hi Friend, Please explain us what code you are using so that we can rectify the problem. If you are getting the Email...JAVA MAIL  Hi! I am doing project called "E-mail Client
Java Mail exception - JavaMail
Java Mail exception  Hi! I am developing E-mail Client (GMAIL) program using JSP technology. Till now i dont have any problem. From last 3 days while i am connecting to the Gmail, I am getting the following exception... Whats
java mail
java mail example  how to download javamail software give one examples   Please visit the following link: Java Mail API
java mail
java mail  By Which code or function i can send E-mail to given E-mail Address   Hi Friend, Please visit the following link: Java Mail Thanks   Hi Friend, Please visit the following link: Java Mail
java mail
: Java Mail Thanks...java mail  import javax.mail.*; import javax.mail.internet....) throws MessagingException, AddressException { // Setup mail
java mail
java mail  how to download javamail software give one examples   Please visit the following link: Java Mail API
getting a problem in execution - Development process
getting a problem in execution  hi friends i have a problem in imcms content managment system it is a java content mangment system it is according... the whole file i am getting a problem like in server.properties file
java mail
want to understand the working of Java Mail download the source code from here and learn the coding logic behind Java Mail. You can even compile the source code...java mail  sir, I need a source code to understand
dns server
dns server   how to make my pc a dns server
dns server
dns server   how to make my pc a dns server
dns server
dns server   how to make my pc a dns server
dns server
dns server   how to make my pc a dns server
dns server
dns server   how to make my pc a dns server
Advertisements
 

 

 

DMCA.com