This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes help with an error message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "help with an error message" Watch "help with an error message" New topic
Author

help with an error message

J Derzaph
Greenhorn

Joined: May 29, 2008
Posts: 7
I'm not sure if this is the right catagory for this one or not but here goes:
I'm trying to call a servlet with some javascript using XMLHttpRequest. the servlet is in the same domain but I'm getting this error:

uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI)
[Break on this error] req.open("GET", url, true);

I understand this usually has to do with the same origin policy and accesssing other domains but the servlet is in the same domain here.

Here is the code:


The file structure looks like this:
/Scottys/scripts.js -where the javascript is
/Scottys/contract.html -where the script is called from
/Scottys/servlets/autoSearchServlet -the servlet its trying to call
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Your web app structure looks wonky to begin with. Servlets need to be compiled and located in the hierarchy at WEB-INF/classes or in a jar file in WEB-INF/lib.

Can you "hit" the servlet by typing its URL into the address bar?
[ September 17, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
J Derzaph
Greenhorn

Joined: May 29, 2008
Posts: 7
Sorry, missed a couple of directories in there. The path for the servlet would be:
Scottys/WEB-INF/classes/servlets
the other two files are
Scottys/WEB-INF/contract.html
Scottys/WEB-INF/scripts.js

and i can hit it using the url

I think I may have found the problem though. I wasn't calling it from where I thought I was.
 
jQuery in Action, 2nd edition
 
subject: help with an error message