[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 9916
  • Last Modified:

Error : java.security.AccessControlException: access denied (java.net.SocketPermission 192.44.11.30:5000 connect,resolve)

Hi experts,

I create the next code for connect to Sybase DB, but I got this message when I try to connect there, I Change in the java.policy the grant option, but I have the response , can you help  I don't know what I missing.

Regards

CODE :

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="
                                                java.sql.*,
                                                java.text.*,
                                                java.util.*,
                                                javax.servlet.*,
                                                javax.servlet.*,
                                                com.sybase.jdbcx.*,
                                                com.sybase.jdbc2.jdbc.*" errorPage="" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%!String username = "user"; String password = "password";%>
<%
      try
      { Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
       Connection con = DriverManager.getConnection  ("jdbc:sybase:Tds:158.58.11.15:5000/gm_master",username,password);  %>

<table >
<tr>
<td>
</td>
</tr>
 <%          
   }     catch(Exception e)
      {%>
<b>Error : </b>
      <%= e.toString() %>
<%      }%>
</body>
</html>
0
cruzsantiago
Asked:
cruzsantiago
  • 5
  • 5
1 Solution
 
petmagdyCommented:
can please post what u have changed in java.policy
0
 
cruzsantiagoAuthor Commented:
permission java.net.SocketPermission "158.58.11.15:5000","connect,resolve,listen,accept");

Don't worry about the IP
0
 
petmagdyCommented:
Ok, as u r calling from JSP u don't need to set permission to access Sybase Socket for JDBC, please try to remove the java.policy u have set for Sybase JDBC and tell me if it works
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
cruzsantiagoAuthor Commented:
Well this line I write after read some experience in experts exchange, with or with out them  I still having the same problem, I don't know if I need check some with my server or start a services like tomcat.
0
 
petmagdyCommented:
on what aervlet engine r u running ur jsp now?
0
 
cruzsantiagoAuthor Commented:
My server It's RAQ550 Cobalt

Apache/1.3.20 Sun Cobalt (Unix) mod_jk mod_ssl/2.8.4 OpenSSL/0.9.6 PHP/5.0.1 FrontPage/5.0.2.2510 mod_perl/1.26/Jdk/1.3/jakarta-tomcat/-3.2.3

0
 
petmagdyCommented:
can u try it on windows on Tomcat first, maybe it is unix permission problem, the root needs to allow this port for u
0
 
cruzsantiagoAuthor Commented:
Yes and it works, and other if i use isql -u<user> -P<password> -S<server> over the unix prompt I connect to the server in another machine, Really I don't know whats happend.
By sides I am root, so I can change all you tell me.
0
 
petmagdyCommented:
just a try, use tomcat only without apache and start it with the root account and test ur jsp if will work, can u try this?
0
 
cruzsantiagoAuthor Commented:
Well, at least I find the problem, there's a file tomcat.policy this need the grant option.
0
 
moduloCommented:
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now