java.security.AccessControlException: access denie

xiaoxiao2026-09-19  7

Exception: Cannot load connection class because of underlying exception: 'java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)'. gwt 1.6 新建一个工程使用jdbc连接的时候有问题. 报的这个错误. 1.在run-> web application 的时候在helloworld里面写一段jdbc连接的代码 @SuppressWarnings("serial")public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService { public String greetServer(String input) { String serverInfo = getServletContext().getServerInfo(); String userAgent = getThreadLocalRequest().getHeader("User-Agent"); Connection con = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); String url = "jdbc:mysql://localhost:3306/test_ssh?autoReconnect=true&useUnicode=true&characterEncoding=utf-8"; con = DriverManager.getConnection(url, "root", ""); if (!con.isClosed()) System.out.println("Successfully connected to " + "MySQL server using TCP/IP..."); } catch (Exception e) { System.err.println("Exception: " + e.getMessage()); } finally { try { if (con != null) con.close(); } catch (SQLException e) { } } return "Hello, " + input + "!<br><br>I am running " + serverInfo + ".<br><br>It looks like you are using:<br>" + userAgent; }} 2.用 run-> web application的时候报错误. Exception: Cannot load connection class because of underlying exception: 'java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)'. 在属性里面添加jar包就好了. [img]/upload/attachment/111291/cb45aad4-7d70-32a0-8dfe-00e5df6c9663.bmp[/img]
转载请注明原文地址: https://www.6miu.com/read-5052796.html

最新回复(0)