Home » Developer & Programmer » JDeveloper, Java & XML » applet give me error (java.security.AccessControlException: access denied (java.util.PropertyPermiss
applet give me error (java.security.AccessControlException: access denied (java.util.PropertyPermiss [message #213237] Tue, 09 January 2007 23:21 Go to next message
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member
hi master
sir wrote connection class that run and give me right result
but when i call data from applet then
java give me error

java.security.AccessControlException: access denied (java.util.PropertyPermission oracle.jserver.version read)

at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
at java.security.AccessController.checkPermission(AccessController.java:401)


this is my class code

import java.sql.*;
public class tcon {
public tcon() {
}
public String mfa1(){
String mfatt ="K1";
String mfa ="";
String query = "select title,accid from chartofacc where accid='"+ mfatt + "'";

// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery(query);
while (rset.next())
mfatt=rset.getString("title");
}
catch(Exception e){
e.printStackTrace();
}
return mfatt;
}

}


and

this is my applet code


public class tapp extends javax.swing.JApplet {
tcon testcall = new tcon();
public void init() {
initComponents();
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();

getContentPane().setLayout(null);

jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

getContentPane().add(jButton1);
jButton1.setBounds(20, 10, 120, 40);

jTextField1.setText("jTextField1");
getContentPane().add(jTextField1);
jTextField1.setBounds(150, 10, 120, 40);

}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText(testcall.mfa1());
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JTextField jTextField1;
// End of variables declaration

}



please give me idea how i get data form java class

thank

aamir



i wrote applet which is connect to database.
when i run this applet with appletviewer it is retriving,but when i run thiswith IE ,it is giving following exception:
java.security.AccessControlException: access denied (java.util.PropertyPermission oracle.jserver.version read)

is there any setting to run this applet
thank you
how change java.policy file [message #213266 is a reply to message #213237] Wed, 10 January 2007 02:05 Go to previous message
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member
sir i serch in net i got some idea

i. change java.policy
and put this code

grant codeBase "http://ib-s01/-" {
permission java.security.AllPermission;
};


sir please give me idea i serch java.policy in my system that show many java.policy file

sir which file i use and where i put
this code

grant codeBase "http://ib-s01/-" {
permission java.security.AllPermission;
};

second idea got from net change the java.security


2. change java.security
and put this code

policy.url.1=file:${java.home}/lib/security/java.policy


sir please give me idea i serch java.policy in my system that show many java.security file

sir which file i use and where i put
this code

policy.url.1=file:${java.home}/lib/security/java.policy


please give me idea how i chang my java.policy and java.security file

thank you

aamr
Previous Topic: method not give me right result how pass code from applet to class
Next Topic: how change java.policy file and java.security
Goto Forum:
  


Current Time: Sat Dec 10 13:00:29 CST 2016

Total time taken to generate the page: 0.07956 seconds