Reputation: 1331
I added the dependency for mysql in pom file
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
and then i start getting the error given below.
java.lang.IllegalArgumentException: Class file is Java 8 but max supported is Java 7: com/mysql/cj/api/CacheAdapter.class in /home/claritus/Downloads/appengine-endpoints-helloworld-java-maven-master/target/helloworld-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-6.0.3.jar
Unable to update app: Class file is Java 8 but max supported is Java 7: com/mysql/cj/api/CacheAdapter.class in /home/claritus/Downloads/appengine-endpoints-helloworld-java-maven-master/target/helloworld-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-6.0.3.jar
I know java 8 is not supported by the google app engine till now. so i changed my jdk and jre path to java 7. but still i am getting this error at the time of deploying the code on google app engine.
Upvotes: 1
Views: 462
Reputation: 52516
Inside your pom.xml must have:
<build>
<finalName>spring_multilanguage</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>version
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Where is the position of <build>
pair tags, see an example of pom.xml
:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.vyhn.demo_spring</groupId>
<artifactId>multilanguage</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>multilanguage Maven Webapp</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.12</junit.version>
<jdk.version>1.8</jdk.version>
</properties>
<developers>
<developer>
<name>Do Nhu Vy</name>
<email>[email protected]</email>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>spring_multilanguage</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>version
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Google App support Java 8 (in beta): https://cloud.google.com/appengine/docs/flexible/java/dev-java-only
Upvotes: 0
Reputation: 35961
You don't need to add mysql driver, it's already provided by App Engine. Specify it as provided
in pom.xml
:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
<scope>provided</scope>
</dependency>
Upvotes: 1