Solved

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

Posted on 2004-10-31
9,879 Views
Last Modified: 2008-09-15
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
Question by:cruzsantiago
    11 Comments
     
    LVL 13

    Expert Comment

    by:petmagdy
    can please post what u have changed in java.policy
    0
     

    Author Comment

    by:cruzsantiago
    permission java.net.SocketPermission "158.58.11.15:5000","connect,resolve,listen,accept");

    Don't worry about the IP
    0
     
    LVL 13

    Expert Comment

    by:petmagdy
    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
     

    Author Comment

    by:cruzsantiago
    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
     
    LVL 13

    Expert Comment

    by:petmagdy
    on what aervlet engine r u running ur jsp now?
    0
     

    Author Comment

    by:cruzsantiago
    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
     
    LVL 13

    Expert Comment

    by:petmagdy
    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
     

    Author Comment

    by:cruzsantiago
    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
     
    LVL 13

    Expert Comment

    by:petmagdy
    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
     

    Author Comment

    by:cruzsantiago
    Well, at least I find the problem, there's a file tomcat.policy this need the grant option.
    0
     

    Accepted Solution

    by:
    PAQed with points refunded (125)

    modulo
    Community Support Moderator
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    3 Experts available now in Live!

    Get 1:1 Help Now