In linux, it is always unsuccessful to call a database during the development of a web application. if you write a class separately and compile and execute it to access the database, it is normal, however, when a web application calls this class to connect to the database, the following error occurs: com. mysql. jdbc. communicationsException: Communicationslinkfailureduetounderlyingexception:-g Tomcat
In linux, it is always unsuccessful to call a database during the development of a web application. if you write a class separately and compile and execute it to access the database, it is normal, however, when a web application calls this class to connect to the database, the following error occurs: com. mysql. jdbc. communicationsException: Communications link failure due to underlying exception:-g uDg XX_fn * s]
** Begin nested exception ** # (R.; Fz
W * xeyA
Java. security. AccessControlException X &) mDn
MESSAGE: access denied (java.net. SocketPermission localhost resolve) PujB> 5 ^ 1 {
B % C % f7hj6
STACKTRACE: % N-Pivt '* V
VyTH 8rSx =
Java. security. AccessControlException: access denied (java.net. SocketPermission localhost resolve) Gng = 6> uR
Dva 1 eOmO
It seems that the error is not in the database, but it should also be related to the web. Check the ports and find that all ports are open, and the file permission is also open to other users. Some people say it is a java security configuration issue. change/usr/lib/jvm/java-1.5.0-sun-1.5.0.10/jre/lib/security/java. the policy file under the policy cannot be accessed after modification. it seems that the problem is not here. in the tomcat folder, there are also several policy files in the/etc/tomcat5.5/policy. d. We should be able to see five. policy files, which have different roles. there are comments in them. Insert the following code in the corresponding place :! G} xz = M
Hwd [$ G ):/
Grant codeBase "file:/var/lib/tomcat5.5/webapps/project name/-" {* 0, U? 8 # h (
Permission java. security. AllPermission; '5 \ zssE
}; QCO & z ($) oy
JJ + 4 w
In this way, the project will have the corresponding permissions. if you really don't know which file to store, then put a sentence in each file, it will certainly work. W., 6I t
I2s5_yC
In this way, tomcat opens the database access permission for web applications.