problem in getting mail exchange records(MX) using DNS (glassfish(struts2))

problem in getting mail exchange records(MX) using DNS (glassfish(struts2))

Hi,

dummy.jsp

<%@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"%>

<%
out.println("dummy page");
try{

InitialDirContext context = new InitialDirContext();
String tempdomain = "dns:/dmk.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 eee..."+e);
e.printStackTrace();;
}

%>

Error is :

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 :

same code working in Tomcat.

Its urgent work for me . Please can any one help me in this.

Thanks, B.Sucharitha

View Answers









Related Tutorials/Questions & Answers:
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
problem in getting mail exchange records(MX) using DNS in java
problem in getting mail exchange records(MX) using DNS in java  Hi...) at java.lang.Thread.run(Thread.java:619) Note : I am using glassfish v3. above code works fine...(); String tempdomain = "dns:/gmail.com"; Attributes attributes
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 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 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
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
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>
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
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
getting a problem in execution - Development process
getting a problem in execution  hi friends i have a problem in imcms... the whole file i am getting a problem like in server.properties file... to the installation procedure all the procedure is completed but it is getting
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  
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
Struts2 Filter not getting initialised in WAS 8.0
Struts2 Filter not getting initialised in WAS 8.0  Hi All, Am facing a problem in the Struts2 initialisation part. My application is developed in Tomcat 5.5 and deployed in WAS 8.0 When its being launched, am getting the error
Create MX Effect using Actionscript in Flex4
Create MX Effect using Actionscript in Flex4: In this example we create a MX effect using Actionscript. The package of MX effect is mx.effects.*. Inthis...; </fx:Script> <s:Panel title="Create MX Effect using
displaying images and records problem - JSP-Servlet
displaying images and records problem  hi, Thanks for your reply.... Please, kindly help me to solve the problem urgently. Or in any other way to do it, all what i want is to display staff records and their pictures on the web pages
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
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 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
getting problem in storing & retrieving value in database
getting problem in storing & retrieving value in database  Hello everyone i am doing a project where my back end is ms access & i want to store value like 5353250214 so if i store it as long int in access it wont take it &
displaying employee records and their images problem - JSP-Servlet
displaying employee records and their images problem  hi, Thanks for your reply to my question. The code you sent to me yesterday was not working. it doesn't display any record and image. Please, help me out urgent
display records with images problem - JSP-Servlet
display records with images problem  hello, i am developing HR application whereby i want to display employee records and their pictures on web...( i.e. to display more than one employee with their records, it does not work
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
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
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
Struts2 Validation Problem - Struts
Struts2 Validation Problem  Hi, How to validate field that should not accept multiple spaces in Struts2? Regards, Sandeep  Hi friend, Please remember some points for solving : 1.Open the url
displaying both image and records problem in jsp and servlet - JSP-Servlet
displaying both image and records problem in jsp and servlet  hello... the application to display more than one employee records and their pictures. e.g. say i'm having records like: firstname, lastname, empid, department, salary, job_title
run servlets using Glassfish V3
run servlets using Glassfish V3  Hello to all, I was wondering how to run servlets using Glassfish V3. I'm using NetBeans 6.7 and need to use servlets, but I don't want to install Tomcat to do so, any suggestions
Select Records Using Prepared Statement
Select Records Using Prepared Statement   ... to select some specific records by using the PreparedStatement. We know...\jdbc\PreparedStatement>java SelectRecords Select Records Example by using
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..., new InternetAddress("[email protected]")); message.setSubject("mail
tiles using struts2
tiles using struts2  hello, im implementing tiles using struts2 in eclipse. i am having following problem occurred during execution.i have created all neccessary settings of jar files. plz help me
Count Records using the Prepared Statement
Count Records using the Prepared Statement  ... to count all records of the database table by using the PreparedStatement... the records of database table by using the PreparedStatement. For this, firstly
Deleting Records using the Prepared Statement
Deleting Records using the Prepared Statement  ... the records from the database table by using the PreparedStatement interface... of movies in the setInt method by using the PreparedStatement object. If it records
Getting the last inserted id using jsp
Getting the last inserted id using jsp  Pls how can i retrieve the last inserted id after submitting a form to mysql using jsp
JDBC: Select Records using Prepared Statement
JDBC: Select Records using Prepared Statement In this section, you will learn how to retrieve records of table using Prepared Statement. Select Records ...[] args) { System.out.println("Select Records using PreparedStatement
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
Difference between getting a document using DOMParser & DocumentBuilderFactory !!!
Difference between getting a document using DOMParser & DocumentBuilderFactory !!!  Hi, In DOM tutorials, on one page a document is formed using DocumentBuilderFactory and on the other page, document is formed using DOMParser
Update Records using Prepared Statement
Update Records using Prepared Statement   ... for updating the records. In this JDBC tutorial we are going to learn about the process of updating the records by using the PreparedStatement.  Here arise
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... InsertRecords Insert records example using prepared statement
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
Getting the ID of the element that fired an event using JQuery
Getting the ID of the element that fired an event using JQuery  Hello sir I want to know-Is there any way to get the ID of the element that fires the event? Please mention the code with your reply. This will make easy for me
How to delete excel file records using Store Procedure?
How to delete excel file records using Store Procedure?  Hi.. I have created one Excel file through stored procedure.Now I want to delete records or delete excel file. Thanks
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
here we r getting the problem with ut data and get data????????????
here we r getting the problem with ut data and get data????????????  private ArrayList keys; private ArrayList values; public Menus() { keys = new ArrayList(); values = new ArrayList(); } public
Struts2 Helloworld problem -Please help - Struts
Struts2 Helloworld problem -Please help  Hi I am a beginner in Struts2. I tried some HelloWorld example in Struts2, to understand. But due to some problem I unable to execute the program successfully. Please find my example
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
getting dropdown values using apache commons in servlet
getting dropdown values using apache commons in servlet  i want... commoms,before that i was using o'reilly api. here is my code : @Override...); } i tried to debug and i am getting the wright file path but while proceeding
Find Records of The Rows Using POI
Find Records of The Rows Using POI      In this program we are going to find records of  an excel sheet using POI3.0 API Event. The class RowRecordextends Record implements
retrieve the records from one table to another table by using cursors
retrieve the records from one table to another table by using cursors   Hi I'm fresher to backend(mysql),my requirement is retrieve the records from one table to another table by using cursors.The following is my procedure
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'[email protected]) by using JAVA Mail API. Could you please give me the clarification.......   Hi

Ads