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

 
 


B.sucharitha
problem in getting mail exchange records(MX) using DNS in java
0 Answer(s)      a year and a month 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.

View Answers









Related Pages:
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
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.
mail
mail  I wrote a program to send mail using smtp. But there is an error message " could not connect to smtp.gmail.com port 465. what is the problem how can i solve it ...   Please visit the following link: Java Mail API
Open Source Exchange
a competitor to Microsoft's Exchange e-mail and collaboration server software, on Monday... almost identical to that of using Microsoft's Outlook. In short, Exchange Server...Open Source Exchange Exchange targeted
mail
mail  how to send mail using jsp   Please visit the following links: JSP Send Mail Java Mail Tutorials
Open Source E-mail
Open Source E-mail Server MailWasher Server Open Source MailWasher Server is an open-source, server-side junk mail filter package.... MailWasher Server fully supports Windows Server/Exchange Server systems
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
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
Java Mail API - JavaMail
account using java mail api... i got code from our roseindia.net i.e....Java Mail API  Hi! I wish u advanced happy new year to all of ur...("pop3s"); after successful compilation, at runtime i am getting the following exce
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
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
Open Source E-mail Server
Open Source E-mail Server MailWasher Server Open Source MailWasher Server is an open-source, server-side junk mail filter package.... MailWasher Server fully supports Windows Server/Exchange Server systems
java mail - Java Beginners
java mail  how to send a mail without authentication one domain to another in java?  hi elumalai, check yourself, this is user problem.  Hi, You have to use the Java mail api. You need to use the SMTP
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
JAVA MAIl - JavaMail
JAVA MAIl  Hi, I am trying to send a mail using java mail api. But I am getting following error: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect
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
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
Getting NumberFormatException
Getting NumberFormatException  Hello Sir, I'm using Integer.parseInt.... I used the same type of code in a simple .java program but when I.m using... help me out of this problem. CODE: <% String t2=request.getParameter
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 mail using smtp in java
send mail using smtp in java  How to send mail using smtp in java?   Sending mail in JSP - SMTP
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
java mail
: Java Mail Thanks...java mail  import javax.mail.*; import javax.mail.internet....) throws MessagingException, AddressException { // Setup mail
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
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
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
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 - Java Beginners
java mail  how to send mail using with out Authentication?????????/ using gmail server
java mail programs
java mail programs  I got some codes from this about sending mail,forwarding mail,multipart mail etc..and I compiled and executed it,but it did... output.actually,do I need a mail server to get correct output of these codes?plz help me, I
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
java mail api - JavaMail
java mail api  Hi, Pls give me the detailed information on how... in the code..   Hi friend, For solving the problem remember some points : 1.Download the Apache Mail server (James) http://james.apache.org
Java Mail - JavaMail
Java Mail  how to email using Java mail or automatic generated mail???  Hi Friend, Please visit the following link: http://www.roseindia.net/javamail/ Hope that it will be helpful for you. Thanks
java mail error - JavaMail
java mail error  how to rceive emails using java mail api  Hi Friend, We can use Java Mail APIs to send and receive mails in Java.... Please visit the following link to know more about use of Java Mail API. http
how to make this java mail works? - Java Beginners
how to make this java mail works?  Dear experts, Recently, I... that : The mail package is not part of the Java SDK, you can get the latest... work, for I am really keen to include a java mail inside my application. Now, I
Technical description of Java Mail API
Technical description of Java Mail API   ... Mail API. You must understand the Java Mail API before actually delving into the development of mail processing applications. Core classes that makeup the Java
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I... the records using jstl tag libraries. But it is not working. I think...(); } } Here am getting the records as a list of pojo classes. I have to display
Java Mail - JMS
running very well,creating no other problems. Now i am trying to learn java mail... is given below................. //My first java mail program............. import..., For solving the problem visit to : http://www.roseindia.net/mail/sending-an-email
Getting NumberFormatException
Getting NumberFormatException  Thanks for the reply. Its works well, but whenever I'm using numeric value from 0010 to 0757 it is returning some... to solve this problem. I'm giving you the code below. Code: `print("<% String
JAVA Mail - JavaMail
JAVA Mail  Hi! I am trying to send the mail using SMTP of gmail. program was compiled successfully. when i am trying to execute that program it is showing error --- Must issue STARTTLS command first... How to avoid
problem
problem  Hi, what is java key words   Hi Friend, Java Keywords are the reserved words that are used by the java compiler for specific operations and you cannot create variables and name it using the keyword. For more
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 getting servlet:xmlHTTP.status=404 - Ajax
problem getting servlet:xmlHTTP.status=404   hi, ihave a text field... object.The problem is my script is unable to get the servlet in which i have... of the servlet, it gets it and teh xmlHTTP.status =404 condition becomes false.im using
Introduction of Java Mail
; Sending message using Java Mail This Example shows you... into the Message object   Reading message using Java Mail...; Send multipart mail using java mail This Example shows you
duplicate records inserting
duplicate records inserting  in the application i have provided the text filed on entering and submit the record is getting inserted. my question is i want to avoid duplicate values getting inserted. ex. i am inserting name
display 1000 of records - Struts
have pagination concept in Java. Using that we can display any number of records...display 1000 of records  how to display 1000 of records using next button in jsp using Struts1.1 + example We have pagination concept in Java. Using
Using Single Quote in Reciepient mail Id.
Using Single Quote in Reciepient mail Id.  Hi, Is it possible to send a mail to a Mail Account having singlequote (Ex: prasad'g@gmail.com) by using JAVA Mail API. Could you please give me the clarification.......   Hi
java mail - JavaMail
java mail  HI! I am developing email client. Using IMAP i am displaying all the messages which are in "INBOX". I want to know how to access remining folders such as "sent", "draft" and others..... Thanks in advance
Getting a absolute path
. Then this problem can be solved by using a method getAbsolutePath().The method... Getting a absolute path     ... then it is very easy to work on it. Suppose a situation where a problem comes
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.