Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"DNS or server error" after 1 run of servlet

Status
Not open for further replies.

rj2046

Programmer
Dec 15, 2004
14
US
I am trying to get a development environment working in preparation for a job interview.

I am using a servlet I developed in a local college class for j2 about a year ago.

I'm on
Win2k ,
IE 6.0
Netbeans 3.5.1 with tomcat 4

The servlet itself works. And after the first time that it works, I always get a "DNS or Server error" on the very next time I try to run it.

Then when I delete cookies, delete temp files, and delete history through the IE tools-->Internet Options menu, it will run again once more. but only once.

My project has uses an HTML page to do Post to

Code:
 [URL unfurl="true"]http://localhost:8080/MyWebApp/LoginServlet[/URL]

I have changed the 8080 port to another without success.

I've stopped and re-started the server numerous times.

It's almost as if the original instance of my servlet is occupying Tomcat and won't start another...

Any help Greatly appreciated. Thanks in advance.

Ray
 
What does the servlet do ?
Can you post the stack trace of the error ?

BTW, only one instance of a servlet will ever be instantiated in the JVM ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Thanks for the reply!

My servlet presents 2 selection lists and 1 text field for user input. On submit --- then runs the next servlet which converts the text field based on the selections and gives the answer back to the user.

The second servlet adds cookies for the selections.

My first post gave me a thought as to whether I hose up after just running the first servlet and not the second. Sure enough my test shows that I can run the first servlet over and over without the problem.

 
Can you post the stack trace of the error ?

What URL & how are you calling the second servlet. How are you setting the cookies ?

--------------------------------------------------
Free Database Connection Pooling Software
 
Thank you for helping me with this,

I don't have a stack trace from anything in particular. The sequence of events is:

Launch ( through NetBeans or directly )

The page has text fields for username, password
OnSubmit the Login Servlet is launched with this:
Code:
<form method="post" name="login" action="[URL unfurl="true"]http://localhost:8099/FxCalc1/Login"[/URL] >

The page has text entry and selections
OnSubmit the Convertservlet is launched with this:
Code:
"<form method=\"post\" title=\"convert\" action=\"[URL unfurl="true"]http://localhost:8099/FxCalc1/Login/Convert[/URL]

this page converts the data and displays it.
It adds cookies this way

Code:
            Cookie [] cookies = request.getCookies();

            String cookieStr=null;
            Cookie svalCookie = new Cookie( "srcVal", SrcVal );
            svalCookie.setMaxAge( YEAR );
            svalCookie.setPath( "/" );
            response.addCookie( svalCookie );
            Cookie scucyCookie = new Cookie( "srcCucy", SrcCucy );
            scucyCookie.setMaxAge( YEAR );
            scucyCookie.setPath( "/" );
            response.addCookie( scucyCookie );
            Cookie dcucyCookie = new Cookie( "dstCucy", DstCucy );
            dcucyCookie.setMaxAge( YEAR );
            dcucyCookie.setPath( "/" );
            response.addCookie( dcucyCookie );


The page has a Convert button for a new conversion if desired. If a new conversion is desired, On submit is exactly like the last one:

Code:
"<form method=\"post\" title=\"convert\" action=\"[URL unfurl="true"]http://localhost:8099/FxCalc1/Login/Convert[/URL]
 
Talking problems through to a listening audience is 1 way to begin to solve the problem.

I commented out the cookie code shown in the previous post and that fixed the errant behaviour when trying to run the Login servlet for the second time.

At least now I can concentrate on why thatcookie code would cause the server to not respond for the second run.

Thanks very much
 
The error you get : "DNS or server error" - where is this error being reported ? Is there any other part of that error you are not posting ? Is there anything in tomcat's log files ?

--------------------------------------------------
Free Database Connection Pooling Software
 
Thanks,

I'll check the logs now.

Here's the text of the error page that was returned to me


Code:
 The page cannot be displayed 
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings. 

--------------------------------------------------------------------------------

Please try the following:

Click the  Refresh button, or try again later.

If you typed the page address in the Address bar, make sure that it is spelled correctly.

To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP). 
If your Network Administrator has enabled it, Microsoft Windows can examine your network and automatically discover network connection settings.
If you would like Windows to try and discover them, 
click  Detect Network Settings 
Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed. 
If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0. 
Click the  Back button to try another link. 

Cannot find server or DNS Error
Internet Explorer
 
Ahhhh.... you don't want to pay any attention to what IO tells you.

What you've got here is that :

a) some code in your servlet has barfed, causing a HTTP 500, or 404 error (hence the IE page you see).
b) One of the URLs you are redirecting to does not exist.

Seeing as when you comment out the cookie code, its probably "a)" - just try readding in parts of code until you see the real error. There also may be something in the logs ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Yes you're absolutely correct!

There is a redirect in the login servlet and the url is stale due to my rearranging of the directories. The timeout was due to the redirect to the non-existant url

You've saved me tons of more aggravation.

Thank you very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top