AnsweredAssumed Answered

How to create a plug-in that queries MySQL database

Question asked by mrab on Oct 6, 2016
Latest reply on Oct 11, 2016 by Jason_Wolfe

I am trying to create a plug-in in Service Catalog that will query data from a MySQL database to populate a select box.  My question is how/where to add the MySQL jar file.


I have followed the document to create the new plug-in.  In addition, I did the following:


1)  updated the plugin code to include my MySQL connection and query

2)  added the MySQL jar to the 'lib' folder under 'select.custom-src'

3)  added the jar file name to build.xml:

  <path id="compile.src.classpath">
    <pathelement location="build" />
    <pathelement location="lib/commons-logging-api.jar" />
    <pathelement location="lib/plugins.apis.jar" />
    <!-- Add any additional jars here -->
    <pathelement location="lib/myql-connector-java-5.1.39-bin.jar" />

4) I ran 'ant', then continued on with the directions to copy plugin.jar and to the correct directory and reload the plug-in in Service Catalog.


When I test my form, I am getting this error in the log:

2016/10/06 TRACE [http-bio-8080-exec-14] [PrivateContextClassLoader] Class:com.mysql.jdbc.Driver is allowed to be loaded:false
2016/10/06 TRACE [http-bio-8080-exec-14] [PluginClassLoader] Parent classloader could not find class :com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver


Can someone provide some direction for the proper MySQL jar location?