DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42062>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42062

           Summary: Connect to database (under Windows) from linux :(
           Product: Tomcat 5
           Version: 5.5.17
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


Hi. I write a servlet that connect with database mysql. On the PC under Windows 
it works fine, but under Linux i cant solve 1 problem: the connection to 
database not created. User have all needed rights in database and another 
program (under linux) could connect to this server. The sql driver mysql-
connector-java-5.0.4-bin.jar is in apache-tomcat-5.5.17\common\lib and in 
Servlet/web-inf/lib. 
Servlet/META-INF/contex.xml :
 <Context privileged="true" antiResourceLocking="false" antiJARLocking="false">
  
  <Resource name="jdbc/positioneer" auth="Container"
            type="javax.sql.DataSource" username="user" password="xxxxx"
            driverClassName="com.mysql.jdbc.Driver" 
url="jdbc:mysql://217.67.191.210:3306/positioneer"
            maxActive="8" maxIdle="4"/>
  
</Context>

Servlet/WEB-INF/web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; >

        <resource-ref>
         <description>
           Resource reference to a factory for java.sql.Connection
           instances that may be used for talking to a particular
           database that is configured in the server.xml file.
         </description>
         <res-ref-name>jdbc/positioneer</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
   </resource-ref>

        <servlet>
        <description>Main servlet</description>
        <display-name>SSSServlet</display-name>
        <servlet-name>SSSServlet</servlet-name>
        <servlet-class>Reports.SSSServlet</servlet-class>
   </servlet>
    <servlet-mapping>
        <servlet-name>SSSServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

</web-app>

I listen 3306 port when servlet tried to init, but nothing send or recieved.
Please help to find where is mistake. The error script :

Not connected to database.Errors occurs when communicating with the database 
server: Communications link failure due to underlying exception: 

** BEGIN NESTED EXCEPTION ** 

java.net.SocketException
MESSAGE: java.security.AccessControlException: access denied 
(java.net.SocketPermission 89.108.80.240:3306 connect,resolve)

STACKTRACE:

java.net.SocketException: java.security.AccessControlException: access denied 
(java.net.SocketPermission 89.108.80.240:3306 connect,resolve)
     at com.mysql.jdbc.StandardSocketFactory.connect
(StandardSocketFactory.java:156)
     at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
     at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
     at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
     at com.mysql.jdbc.NonRegisteringDriver.connect
(NonRegisteringDriver.java:266)
     at java.sql.DriverManager.getConnection(DriverManager.java:525)
     at java.sql.DriverManager.getConnection(DriverManager.java:171)
     at Reports.SSSServlet.openConnection(SSSServlet.java:106)
     at Reports.SSSServlet.init(SSSServlet.java:131)
     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:275)
     at org.apache.catalina.security.SecurityUtil.doAsPrivilege
(SecurityUtil.java:161)
     at org.apache.catalina.security.SecurityUtil.doAsPrivilege
(SecurityUtil.java:114)
     at org.apache.catalina.core.StandardWrapper.loadServlet
(StandardWrapper.java:1099)
     at org.apache.catalina.core.StandardWrapper.allocate
(StandardWrapper.java:757)
     at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:130)
     at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:178)
     at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:126)
     at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:105)
     at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:107)
     at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:148)
     at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:869)
     at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConne
ction(Http11BaseProtocol.java:664)
     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
(PoolTcpEndpoint.java:527)
     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt
(LeaderFollowerWorkerThread.java:80)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:684)
     at java.lang.Thread.run(Thread.java:595)


** END NESTED EXCEPTION **

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to