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包就好了.