Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource

Explorer

When using mysql for streaming Analytics Manager, it fails to start with the below error.

Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
	at com.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:93)
	at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:319)
	at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:114)
	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:105)
	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:72)
	at com.hortonworks.registries.storage.impl.jdbc.connection.HikariCPConnectionBuilder.prepare(HikariCPConnectionBuilder.java:49)
	at com.hortonworks.registries.storage.impl.jdbc.connection.HikariCPConnectionBuilder.<init>(HikariCPConnectionBuilder.java:38)
	at com.hortonworks.registries.storage.impl.jdbc.provider.QueryExecutorFactory.getHikariCPConnnectionBuilder(QueryExecutorFactory.java:79)
	at com.hortonworks.registries.storage.impl.jdbc.provider.QueryExecutorFactory.get(QueryExecutorFactory.java:45)
	at com.hortonworks.registries.storage.impl.jdbc.JdbcStorageManager.init(JdbcStorageManager.java:240)
	at com.hortonworks.streamline.webservice.StreamlineApplication.getStorageManager(StreamlineApplication.java:194)
	at com.hortonworks.streamline.webservice.StreamlineApplication.getDao(StreamlineApplication.java:183)
	at com.hortonworks.streamline.webservice.StreamlineApplication.registerResources(StreamlineApplication.java:215)
	at com.hortonworks.streamline.webservice.StreamlineApplication.run(StreamlineApplication.java:101)
	at com.hortonworks.streamline.webservice.StreamlineApplication.run(StreamlineApplication.java:75)
	at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43)
	at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
	at io.dropwizard.cli.Cli.run(Cli.java:75)
	at io.dropwizard.Application.run(Application.java:79)
	at com.hortonworks.streamline.webservice.StreamlineApplication.main(StreamlineApplication.java:79)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at com.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:80)
	... 19 more
3 REPLIES 3

Expert Contributor
@Swaapnika Guntaka

I'm no expert on SAM, but from what I can see from the provided info is that MySQL driver is not present in the required location for SAM to make use off or if you have the mysql driver present then that driver does not have this class.

Explorer

Adding mysql connector to CLASSPATH solved the problem. Previously SAM was unable to locate the driver.

@Swaapnika Guntaka Can you provide more details on which connector and class path you used? I am seeing this same error today. I have tried to put the connector into my class path and classpath/bin as well as a few other locations but the error remains. TIA for your reply.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.