Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

AccessControlException: access denied

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my hosting setup:
tomcat 4.1, jdk 1.4.2, mysql 3.23, mysql-connector-java-3.0.9-stable-bin.jar, (plesk 6, Apache 2.0)
error message:
java.sql.SQLException: Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)
basically, i have just joined up with a new host and am trying to get quite a simple web app up and running. i have to upload my app as a war file and i have tried to follow the required structure and web.xml format.
i have placed the jar file for connector j in web-inf/lib but have not referred to this in the web.xml file - is that where i'm goin wrong? if so, what should go in the web.xml file about connector j?
i'm really not sure what is causing this problem: my knowledge of servlets is limited and i am new to war files. i know my database username and password is correct since i have tested connecting via a php script. my host won't help me get set up at all (unless i pay 75 bucks an hour to their java expert) so i thought i would try the friendly folk here first
im only trying to run one simple college project but i just can't get up adn running adn it's doing my head in

*any* advice would be greatly appreciated!
here is my web.xml file in case it helps:
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Bookstore</display-name>
<servlet>
<servlet-name>Home</servlet-name>
<servlet-class>Home</servlet-class>
</servlet>
<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>Login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Home</servlet-name>
<url-pattern>/Home</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/Login</url-pattern>
</servlet-mapping>
</web-app>
 
Bartender
Posts: 9623
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Janine Dalton:

error message:
java.sql.SQLException: Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve)


Not a JDBC problem. It's a security policy problem. The java policy file is <JAVA_HOME>/jre/lib/security/java.policy. You probably need a line in the "grant" section like:

but I'm sure your host would want it restricted to the host you are on and the port your database uses. Check out
Permissions in the Java 2 SDK for more info.
 
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic