java.security.AccessControlException: access denie

简介: Exception: Cannot load connection class because of underlying exception: 'java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)'. gwt 1.6 新建一个工程使用jdbc
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包就好了.


cb45aad4-7d70-32a0-8dfe-00e5df6c9663.bmp

目录
相关文章
|
XML Java 关系型数据库
IDEA 报错: java.sql.SQLException: Access denied for user ‘root ‘@‘localhost‘ (using password: YES)
IDEA 报错: java.sql.SQLException: Access denied for user ‘root ‘@‘localhost‘ (using password: YES)
880 0
|
Java 数据库连接 开发工具
【Java异常】Spring Boot出现警告 WARNING: An illegal reflective access operation has occurred
【Java异常】Spring Boot出现警告 WARNING: An illegal reflective access operation has occurred
367 1
解决java.sql.SQLException: Access denied for user ‘Lenovo‘@‘localhost‘ (using password: YES)问题~
解决java.sql.SQLException: Access denied for user ‘Lenovo‘@‘localhost‘ (using password: YES)问题~
131 0
|
SQL 存储 Oracle
Java连接Access数据库改成MySQL连接数据库
升级诉求:Java连接Access已经算是过时的产物了,一般作为存储服务的应用在Java界比较常用的还是MySQL, 当然还有Oracle数据库。这里要讲的就是连接MySQL数据库了。 就是因为有了SQL标准,各大厂商实现SQL语句基本上大同小异, 所以我们从Access平稳的切换到MySQL数据库也比较方便快捷, 那如何进行Access数据库切换成MySQL数据呢? 下文就是指导手册了,如有问题可以联系作者一同探讨哟~
241 1
Java连接Access数据库改成MySQL连接数据库
|
开发工具 git
用Git工具下载其他人的项目出现的问题---fatal: unable to access ‘https://github.com/TheAlogorithms/Java.git/‘.........
在开启SS的前提下,手动配置git的代理。git客户端输入如下两个命令就可以了。
172 0
用Git工具下载其他人的项目出现的问题---fatal: unable to access ‘https://github.com/TheAlogorithms/Java.git/‘.........
|
Web App开发 前端开发 JavaScript
【BUG日记】【VUE】【JAVA】后端已经添加上@CrossOrigin,前端还是显示Access to XMLHttpRequest...
【BUG日记】【VUE】【JAVA】后端已经添加上@CrossOrigin,前端还是显示Access to XMLHttpRequest...a
206 0
【BUG日记】【VUE】【JAVA】后端已经添加上@CrossOrigin,前端还是显示Access to XMLHttpRequest...
|
数据安全/隐私保护 Android开发
Javaweb项目碰到的问题- Access denied for user 'root'@'localhost' (using password: YES)
Javaweb项目碰到的问题- Access denied for user 'root'@'localhost' (using password: YES)
370 0
|
SQL Java 关系型数据库
|
SQL 关系型数据库 Java
下一篇
DataWorks