java.security.AccessControlException: access denie

来源:互联网 发布:摄像头链接电脑网络 编辑:程序博客网 时间:2024/05/18 16:37
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 implementsGreetingService {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&amp;useUnicode=true&amp;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包就好了.




  • 大小: 25.5 KB
  • 查看图片附件
原创粉丝点击