我想平流是在StringBuffer的某人,發送到服務器,但我得到java.security.AccessControlException:訪問被拒絕(java.lang.RuntimePermission createSecurityManager)
java.security.AccessControlException:訪問否認 (java.lang.RuntimePermission createSecurityManager)
請幫助別人還在苦苦掙扎的日子......
private void pushRawDataFilesToServer(StringBuffer sb) {
URL url;
try {
url = new URL("http://<ip>:8080/<appname>/WritePingData");
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection)url.openConnection();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setDefaultUseCaches(false);
try {
BufferedWriter serverbfw = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
serverbfw.write(sb.toString());
serverbfw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
這是在applet中運行嗎? – jtahlborn
顯示整個異常和發生異常的行。 – jtahlborn
雅運行裏面appletjava.security.AccessControlException:訪問被拒絕(java.lang.RuntimePermission createSecurityManager) \t在java.security.AccessControlContext.checkPermission(來源不明) \t在java.security.AccessController.checkPermission(來源不明) \t在java.lang.SecurityManager.checkPermission(未知源) \t at sun.awt.AWTSecurityManager.checkPermission(AWTSecurityManager.java:959) \t at java.lang.SecurityManager。(未知來源) \t at com.neurosynaptic.MySecurityManager。 (MySecurityManager.java:5) –
user2826111