tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Permissions
Date Wed, 01 Aug 2007 12:14:24 GMT
Looks like the path to your jar file is wrong.

grant codeBase 
"file:${catalina.home}/webapps/ROOT/WEB-INF/lib/mysql-connector-java-3.1.14-bin.jar" 
{
  permission java.security.AllPermission;
}

or to pull an example from the catalina.policy file distributed with tomcat:

grant codeBase 
"jar:file:${catalina.home}/webapps/ROOT/WEB-INF/lib/mysql-connector-java-3.1.14-bin.jar!/-"

{
  permission java.net.SocketPermission "137.250.38.190:3306", "connect" ;
  permission java.net.SocketPermission "127.0.0.1:3306", "connect" ;
}

In either case, you missed WEB-INF/lib in your path to the jar file.  If 
you jar file is really in webapps/ROOT as described below, it won't even 
be loaded by tomcat.

--David

Alexander Osherenko wrote:

>Hello!
>
>I'm working with tomcat 5.5.9 on Windows XP. I'm experiencing a strange problem with paths
and permissions. I start "catalina.bat start -security" and assume that the catalina would
read permissions from the catalina.policy file in the conf directory.
>
>I grant permissions to the mysql-connector*.jar
>
>grant codeBase "file:${catalina.home}/webapps/ROOT/mysql-connector-java-3.1.14-bin.jar"
{
>    permission java.security.AllPermission;
>      //permission java.net.SocketPermission "127.0.0.1:3306", "connect,resolve";
>};
>
>but still get the error message:
>
>MESSAGE: java.security.AccessControlException: access denied (java.net.SocketPermission
137.250.38.190:3306 connect,resolve)
>
>STACKTRACE:
>
>java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission
137.250.38.190:3306 connect,resolve)
>    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
>    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2569)
>    at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
>    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
>    at java.sql.DriverManager.getConnection(Unknown Source)
>    at java.sql.DriverManager.getConnection(Unknown Source)
>    at GUI.DBWrapper.<init>(DBWrapper.java:40)
>    at GUI.CeisApplet.<init>(CeisApplet.java:47)
>    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
>    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
>    at java.lang.reflect.Constructor.newInstance(Unknown Source)
>    at java.lang.Class.newInstance0(Unknown Source)
>    at java.lang.Class.newInstance(Unknown Source)
>    at sun.applet.AppletPanel.createApplet(Unknown Source)
>    at sun.plugin.AppletViewer.createApplet(Unknown Source)
>    at sun.applet.AppletPanel.runLoader(Unknown Source)
>    at sun.applet.AppletPanel.run(Unknown Source)
>    at java.lang.Thread.run(Unknown Source)
>
>
>** END NESTED EXCEPTION **
>
>
>
>Last packet sent to the server was 0 ms ago.
>    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2643)
>    at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
>    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
>    at java.sql.DriverManager.getConnection(Unknown Source)
>    at java.sql.DriverManager.getConnection(Unknown Source)
>    at GUI.DBWrapper.<init>(DBWrapper.java:40)
>    at GUI.CeisApplet.<init>(CeisApplet.java:47)
>    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
>    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
>    at java.lang.reflect.Constructor.newInstance(Unknown Source)
>    at java.lang.Class.newInstance0(Unknown Source)
>    at java.lang.Class.newInstance(Unknown Source)
>    at sun.applet.AppletPanel.createApplet(Unknown Source)
>    at sun.plugin.AppletViewer.createApplet(Unknown Source)
>    at sun.applet.AppletPanel.runLoader(Unknown Source)
>    at sun.applet.AppletPanel.run(Unknown Source)
>    at java.lang.Thread.run(Unknown Source)
>
>Although the paths should be correct, the permissions are not granted. What do I miss?
>
>Cheers
>Alexander
>  
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message