Error with Maven GAE Plugin + Google Cloud SQL

跟風遠走 提交于 2019-12-06 08:10:19

Ok I solved. I manually put mysql-connector-java-5.1.18-bin.jar in my sdk folder:

 file:///opt/appengine-java-sdk-1.6.0/lib/impl/

Error changes in a more comfortable:

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

Thank you for suggestions however

Or you can use maven-antrun-plugin do it for you at build time. No more manual intervention for your project team (I use this with the offical appengine-maven-plugin, you need to adapt the path for use with maven-gae-plugin) :

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.7</version>
  <executions>
    <execution>
      <!-- Use 'package' instead of 'install' if you want the Driver to be available for 'integration-test' -->
      <phase>package</phase>
      <configuration>
        <target>
          <!-- delete existing mysql jar from appengine sdk lib/impl -->
          <delete>
            <fileset 
              dir="${settings.localRepository}/com/google/appengine/appengine-java-sdk/${appengine.target.version}/appengine-java-sdk/appengine-java-sdk-${appengine.target.version}/lib/impl" 
              includes="**/mysql-connector-java*" />
          </delete>
          <!-- copy mysql jar into appengine sdk lib/impl -->
          <copy 
            file="${settings.localRepository}/mysql/mysql-connector-java/${mysql.version}/mysql-connector-java-${mysql.version}.jar" 
            todir="${settings.localRepository}/com/google/appengine/appengine-java-sdk/${appengine.target.version}/appengine-java-sdk/appengine-java-sdk-${appengine.target.version}/lib/impl"/>
        </target>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin> 

Did you add this to the plugins' dependencies as well ?

If it is the plugin's classpath it should be picked up by GAE.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!