при взятии коннекта:
Код: Выделить всё
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dortrans",connInfo);
коннектор - mysql-connector-java-5.1.6-bin.jar (Connector/J)
класс находится нормально.
в окнах всё работает нормально
Код: Выделить всё
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dortrans",connInfo);
Код: Выделить всё
Unable to connect to any hosts due to exception: java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve) ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve) STACKTRACE: java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:143) at com.mysql.jdbc.MysqlIO.(MysqlIO.java:225) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1805) at com.mysql.jdbc.Connection.(Connection.java:452) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:171) at com.brain.web.cont.init(cont.java:103) at org.apache.jsp.index_jsp._jspService(index_jsp.java:74) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:517) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245) at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:177) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) ** END NESTED EXCEPTION **
Код: Выделить всё
import java.sql.*;
import java.io.*;
public class ConnectionTest {
public static void main(String[] args) throws Exception {
Connection conn = null;
try {
String connectionURL ="jdbc:mysql://localhost:3306/test";
Class.forName("com.mysql.jdbc.Driver").newInstance();
out.println("before");
con = DriverManager.getConnection(connectionURL,"user", "password");
out.println("after");
con.close();
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (conn != null) conn.close();
}
}
}
Код: Выделить всё
java ConnectionTest
Код: Выделить всё
grant codeBase "file:${catalina.home}/webapps/<yourwebapp>/-" {
permission java.net.SocketPermission "127.0.0.1:3306", "resolve";
permission java.net.SocketPermission "127.0.0.1:3306", "connect";
}
Код: Выделить всё
RandomAccessFile f = new RandomAccessFile(savepath+filename,"rw");
byte[] bytes = buffer.toByteArray();
f.write(bytes,0,bytes.length - 2);
f.close();
Код: Выделить всё
access denied (java.io.FilePermission /var/lib/tomcat5/webapps/postget/images/1.jpg write)
Код: Выделить всё
URL url = new URL("http://localhost:8080/postget/1.txt");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
OutputStream ops = conn.getOutputStream();
PrintWriter pw = new PrintWriter(ops);
pw.print("blablabla");
pw.close();
conn.setDoOutput(false);
conn.disconnect();
Код: Выделить всё
access denied (java.io.FilePermission /upload__37e7e819_11bef7e0b23__8000_00000008.tmp write)