Ubuntu Tomcat7 java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory

后端 未结 6 1301
耶瑟儿~
耶瑟儿~ 2020-12-13 09:33

I\'m trying to set up a JDBC DataSource in Tomcat 7 under Ubuntu 12.X, so I added the following to the context.xml file:



        
6条回答
  •  抹茶落季
    2020-12-13 10:03

    The cause is a issue in the Ubuntu build/package process for Tomcat7. If I understand the issue correctly, Apache builds tomcat-dbcp.jar from binary files, while Ubuntu builds packages only from source. The Ubuntu project ends up needing to change the Java package name, which tends to break things for us poor users. The gory details may be found at the Ubuntu issues list.

    The solution I found is to name the data source factory when I define the resource. In one case, I have a META-INF/context.xml file that contains:

    
    

    The critical element is the "factory" declaration, which overrides the built-in default.

    On our production machines, the resource is defined in the GlobalNamingResources element of the server.xml file. Specifying the factory is only needed on the Ubuntu systems.

提交回复
热议问题