bclark_hyperic
Enthusiast
Enthusiast

Missing jdbc driver when testing plugins from the command line

Hello,

I am trying to test an XML-based SQL Query plugin that I wrote and am having problems getting it to run from the command line. I get the below jdbcDriver-related error message when running the plugin. I have downloaded the Microsoft JDBC driver v.3.0 and placed it in \pdk\lib\jdbc but that didn't help. I even renamed it to mssqlserver.jar, but that didn't make a difference either. Am I just putting this driver in the wrong place or am I doing something else wrong?

I've also attached my plugin in case that is of any help in troubleshooting this particular issue.

Here is the error:
PluginException: Failed to load jdbcDriver=com.microsoft.jdbc.sqlserver.SQLServerDriver (missing mssqlserver.jar,msbase.jar,msutil.jar?)
org.hyperic.hq.product.PluginException: Failed to load jdbcDriver=com.microsoft.
jdbc.sqlserver.SQLServerDriver (missing mssqlserver.jar,msbase.jar,msutil.jar?)

Here is the command line that I am using:
D:\Program Files\Hyperic HQ>java -jar pdk/lib/hq-product.jar -Dplugins.include=hq-omsstatsf -DjdbcDriver=com.microsoft.jdbc.sqlserver.SQLServerDriver -DjdbcUrl=jdbc:sqlserver://sqldbserver:1433;databasename=central -DjdbcUser=hyper
icHQ -DjdbcPassword=xxxxx -m metric -p hq-omsstatsf -t "OMS" -Dlog=debug


Thanks,
Brian
0 Kudos
7 Replies
bclark_hyperic
Enthusiast
Enthusiast

I think I got past this particular error. Microsoft's JDBC documentation says to register the jdbc driver like this:
com.microsoft.sqlserver.jdbc.SQLServerDriver

Whereas Hyperic's documentation shows the driver being registered like this:
com.microsoft.jdbc.sqlserver.SQLServerDriver

Notice that the jdbc and sqlserver portions are reversed. When I register the driver the way Microsoft recommends, I no longer get the jdbc error.

However, I get a new error, so I don't really know if I have truly solved this problem, or simply obfuscated it. My new error message (at least the portions that look relevant to me) is:

INFO [main] [ProductPluginManager] Loading plugin: hq-omsstats2-plugin.xml
DEBUG [main] [ProductPluginManager] Manifest retrieval had an exception (continuing): error in opening zip file
DEBUG [main] [PluginLoader] hq-omsstats2-plugin.xml expanding D:\Program Files\Hyperic HQ\pdk\lib\jdbc...
DEBUG [main] [PluginLoader] hq-omsstats2-plugin.xml += D:\Program Files\Hyperic
HQ\pdk\lib\jdbc\jtds-1.2.5.jar
DEBUG [main] [PluginLoader] hq-omsstats2-plugin.xml += D:\Program Files\Hyperic
HQ\pdk\lib\jdbc\mssqlserver.jar
DEBUG [main] [PluginLoader] hq-omsstats2-plugin.xml += D:\Program Files\Hyperic
HQ\pdk\lib\jdbc\mysql-connector-java-5.1.10-bin.jar
DEBUG [main] [PluginLoader] hq-omsstats2-plugin.xml += D:\Program Files\Hyperic
HQ\pdk\lib\jdbc\postgresql-7.4.3.jar
DEBUG [main] [ControlPluginManager] PluginNotFound creating plugin for service ' OMS' from server 'NetworkServer'
DEBUG [main] [LogTrackPluginManager] PluginNotFound creating plugin for service 'OMS' from server 'NetworkServer'
DEBUG [main] [ConfigTrackPluginManager] PluginNotFound creating plugin for service 'OMS' from server 'NetworkServer'

Is the "manifest retrieval" error a problem?
How about the PluginNotFound error?

Brian
0 Kudos
bclark_hyperic
Enthusiast
Enthusiast

As described in this article from Microsoft TechNet, if you are using their JDBC driver, you need to change the way you register the jdbc driver:

http://msdn.microsoft.com/en-us/library/ms378956.aspx

The driver must be registered as:
com.microsoft.sqlserver.jdbc.SQLServerDriver

And not as the Hyperic documentation states, which transposes two of the portions of the registration string.

Brian
0 Kudos
Argon0_hyperic
Contributor
Contributor

OK, so how does one actually USE the SQL Query server service?

Do we need to rename the .jar from the 3.0 download to the old naming convention (mssqlserver.jar)? as well as changing the way we register the driver?
0 Kudos
bclark_hyperic
Enthusiast
Enthusiast

No, you don't need to rename the jar file. You just need to put the jar file in the appropriate place in the Agent or HQ Plugins folder so it gets "included" when it starts up.

For example, put it here:
...\hyperic-hq-agent-4.4.0\bundles\agent-4.4.0-1509\pdk\lib\jdbc\

Or here (which is where I have my custom sql query plugin located):
...\hq-plugins\
0 Kudos
Argon0_hyperic
Contributor
Contributor

OK, so tying your two answers together...

You just need to get the current version of the MS jdbc driver and put it in the pdk\lib\jdbc directory, RESTART the agent (this I have not been doing up 'til now) to get the driver included when it starts...

Meanwhile somewhere in the code you need to change com.microsoft.jdbc.sqlserver.SQLServerDriver to com.microsoft.sqlserver.jdbc.SQLServerDriver

Then it should work..

This implies that the help text within the SQL Query server is very out of date, to the point of being "dangerously" misleading - it actually mentions what the required jars are and that the driver is included in HQ by default (as well as some of the others (e.g. DB2, Oracle, etc...)).
0 Kudos
bclark_hyperic
Enthusiast
Enthusiast

> You just need to get the current version of the MS
> jdbc driver and put it in the pdk\lib\jdbc directory,
> RESTART the agent (this I have not been doing up 'til
> now) to get the driver included when it starts...

Yes

>
> Meanwhile somewhere in the code you need to change
> com.microsoft.jdbc.sqlserver.SQLServerDriver
> to com.microsoft.sqlserver.jdbc.SQLServerDriver

Yes. That "somewhere in the code" is in your SQL Query plugin, and would look something like this:
<config>
<option name="jdbcDriver" type="enum" description="JDBC Driver Class Name">
<include name="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> <!-- this limits the selection to one driver -->
</option>
</config>

>
> This implies that the help text within the SQL Query
> server is very out of date, to the point of being
> "dangerously" misleading - it actually mentions what
> the required jars are and that the driver is included
> in HQ by default (as well as some of the others (e.g.
> DB2, Oracle, etc...)).

Yes. I left a comment in the documentation to this effect.
0 Kudos
Argon0_hyperic
Contributor
Contributor

<erm>...
I'm not really interested in writing a whole new "plugin" I just want to use the SQL Query server within Hyperic, it seems to do what I need it to, just I cannot call the correct JDBC driver from the dropdown. If you can tell me where this is in the code I will change it....
0 Kudos