I have created a web application and the database connection is handled from using simple jdbc connection mechanism. after building the WAR file i have verified whether the WEB-INF/lib has the mysql connector library it was there and i am using mysql 1.8 java connector. but when i try to deploy the application in jboss i get sevral errors and warnings. project is build from java 1.7 and the jboss server runs with using same jdk version.
Unable to instantiate driver class "com.mysql.cj.jdbc.Driver":
java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver from [Module
"deployment.NEWAPPLICATION.war:main" from Service Module Loader]
i have no idea why am i getting this error cz mysql connector can be found on the class path, and one of the other issue i am getting at the same stack trace is this
Failed to define class com.mysql.cj.jdbc.Driver in Module
"deployment.NEWAPPLICATION.war:main" from Service Module Loader:
java.lang.UnsupportedClassVersionError: com/mysql/cj/jdbc/Driver :
Unsupported major.minor version 52.0
and there are many logs which says couldn't index classes from com/mysql/cj
Could not index class com/mysql/cj/MysqlxSession.class at
/content/NEWAPPLICATION.war/WEB-INF/lib/mysql-connector-java-8.0.16.jar:
java.lang.IllegalStateException: Unknown tag! pos=32 poolCount = 334
I haven't really worked much with WAR applications and haven't really worked much with the Jboss servers as well. I can't figure out this on my own and any help would be appreciated.
You say that you're using Java 1.7, but it looks like the MySQL driver is compiled with Java 1.8. Either upgrade your JRE, or find a driver compatible with Java 1.7. You'll need Connector/J 5.1, rather than 8. You can find this at The MySQL Archive
Edit: if you're using Maven, you can use this artefact:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>