Le 7/12/2016 à 13:28, Arne Nordmark a écrit :

> I have put a symlink in /var/lib/tomcat7/common, so that would be loaded
> by the "Common" class loader.
> 
> The default Debian configuration in /etc/tomcat7/catalina.properties
> seem to be slightly broken here, so in the "common.loader" I had to
> change from ${catalina.home}/common/... to ${catalina.base}/common/...

Thanks for the info. I'm trying to reproduce the same error but I
haven't succeeded so far. Here is was I did:

1. Install tomcat7 on Jessie (version 7.0.56-3+deb8u5)

2. Create the /var/lib/tomca7/common directory

3. Modify common.loader in /etc/tomcat7/catalina.properties
   to include ${catalina.base}/common/*.jar (this will be fixed
   in the next version of tomcat8 btw)

4. Install libmysql-java

5. Create a symlink to mysql-connector-java.jar
   in /var/lib/tomcat7/common

6. Declare a datasource in /etc/tomcat7/server.xml:

  <Resource name="jdbc/test"
            auth="Container"
            type="javax.sql.DataSource"
            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
            maxActive="100"
            maxIdle="30"
            maxWait="10000"
            testOnBorrow="true"
            validationQuery="SELECT 1 FROM DUAL"
            username="root"
            password="smxpass"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/mysql?autoReconnect=true"/>

7. Create context.xml in /var/lib/tomcat7/webapps/ROOT/META-INF/

8. Link the datasource in context.xml:

  <Context path="/" antiResourceLocking="false">
    <ResourceLink name="jdbc/test"
                  global="jdbc/test"
                  type="javax.sql.DataSource"/>
  </Context>

9. Create a test page /var/lib/tomcat7/webapps/ROOT/test.jsp with:

  <%@page import="javax.naming.*,javax.sql.*" %>
  <%
  Context initContext = new InitialContext();
  Context envContext  = (Context) initContext.lookup("java:/comp/env");
  DataSource ds = (DataSource) envContext.lookup("jdbc/test");

  out.println("DataSource: " + ds);
  %>

10. Open http://localhost:8080/test.jsp

There is still something different with your setup but I don't know what.


> Am I correct in understanding that you want me to add the loop on top of
> version 7.0.56-3+deb8u5 without the other changes from upstream 7.0.73?

Yes please.

Emmanuel Bourg

__
This is the maintainer address of Debian's Java team
<http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers>. 
Please use
debian-j...@lists.debian.org for discussions and questions.

Reply via email to