6 Replies Latest reply on Oct 18, 2010 6:43 AM by pilhuhn

    Mysql Database

    macchonmhaighe

      When I add mysql databases I get the following error

      org.rhq.enterprise.communications.command.impl.remotepojo.server.RemotePojoInvocationCommandService.execute(RemotePojoInvocationCommandService.java:184)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)
      at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)
      at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
      at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)
      at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:288)
      at $Proxy0.execute(Unknown Source)
      at org.rhq.enterprise.communications.command.server.CommandProcessor.handleIncomingInvocationRequest(CommandProcessor.java:290)
      at org.rhq.enterprise.communications.command.server.CommandProcessor.invoke(CommandProcessor.java:184)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:809)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:608)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:420)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173)
      Caused by: org.rhq.core.clientapi.agent.PluginContainerException: Could not find plugin class [org.rhq.plugins.mysql.MySqlDatabaseComponent] from classloader [PluginClassLoader@566d0085[parent=PluginClassLoader@64cbbe37[parent=org.rhq.core.pc.plugin.RootPluginClassLoader@7c354093,embedded-dir=[<>],urls=[file:/opt/jopr-agent/rhq-agent/plugins/rhq-database-plugin-1.3.1.jar]],embedded-dir=[file:/opt/jopr-agent/rhq-agent/data/tmp/rhq-mysql-plugin-1.3.1.jar6010567631000438599.classloader/],urls=[file:/opt/jopr-agent/rhq-agent/plugins/rhq-mysql-plugin-1.3.1.jar,mysql-connector-java-5.1.6.jar119651533068943126.tmp]]]
      at org.rhq.core.pc.plugin.PluginComponentFactory.instantiateClass(PluginComponentFactory.java:240)
      at org.rhq.core.pc.plugin.PluginComponentFactory.buildResourceComponent(PluginComponentFactory.java:134)
      at org.rhq.core.pc.inventory.InventoryManager.activateResource(InventoryManager.java:1197)
      ... 25 more
      Caused by: java.lang.ClassNotFoundException: org.rhq.plugins.mysql.MySqlDatabaseComponent
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
      at org.rhq.core.pc.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:63)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.rhq.core.pc.plugin.PluginComponentFactory.instantiateClass(PluginComponentFactory.java:228)
      ... 27 more


      I did a searh for the files and mysql-connector is there
      /opt/jopr-agent/rhq-agent/data/tmp/rhq-mysql-plugin-1.3.1.jar6010567631000438599.classloader/mysql-connector-java-5.1.6.jar119651533068943126.tmp

      But in the error there is a comma instead of a forwardslash in the file path, is this correct

      urls=[file:/opt/jopr-agent/rhq-agent/plugins/rhq-mysql-plugin-1.3.1.jar,mysql-connector-java-5.1.6.jar119651533068943126.tmp]]]

        • 1. Re: Mysql Database
          mazz

          the error is about not finding the plugin component class, not a MySQL JDBC driver class:

          Caused by: java.lang.ClassNotFoundException: org.rhq.plugins.mysql.MySqlDatabaseComponent


          That needs to be in the mysql plugin jar.

          As for the comma thing, that's showing you a comma-separated list of jars. It does seem kinda funny that the second one is just a filename, rather than a full URL, but I would think if that really was an indication of a problem, we'd have this problem cropping up in other places, since there are other plugins that ship with 3rd party libs too.

          In short, I'm not sure what the issue is - but the error message shows that the problem is loading the component class, not a JDBC driver class.


          • 2. Re: Mysql Database
            macchonmhaighe


            Do I need to download the mysql connector and add it to the plugins folder?

            In the plugins folder there is rhq-database-plugin-1.3.1.jar
            and
            rhq-mysql-plugin-1.3.1.jar
            Is the mysql connector bundled with the rhq-mysql-plugin?

            mysql-connector-java-5.1.6.jar is not located anywhere on this machine so I am presuming that it is either bundled in the plugin or I need to download it and add it to the plugins folder

            • 3. Re: Mysql Database
              mazz

              A few points to make:

              1) where did you get the mysql plugin? Are you building your own mysql pulgin?

              2) the MySQL JDBC connector jar should come inside the plugin already. In the plugin .jar, there should be a /lib entry and in there should be the MySQL JDBC connector jar. Take a look at the prototype mysql plugin pom.xml found in the source repo and you'll see where it adds that MySQL connector jar as a dependency and copies it to the plugin jar:

              http://git.fedorahosted.org/git/rhq/rhq.git?p=rhq/rhq.git;a=blob;f=modules/plugins/mysql/pom.xml;hb=master

              3) The error you are getting "Caused by: java.lang.ClassNotFoundException: org.rhq.plugins.mysql.MySqlDatabaseComponent" does not involve the MySQL JDBC connector jar. That class "MySqlDatabaseComponent" is not a class found in the MySQL JDBC connector jar - its in the main mysql plugin jar. And looking at the latest code in the new git repository, there is no class called MySqlDatabaseComponent:

              http://git.fedorahosted.org/git/rhq/rhq.git?p=rhq/rhq.git;a=tree;f=modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql;hb=master

              which is why I asked where you got the mysql plugin jar.

              • 4. Re: Mysql Database
                macchonmhaighe

                1) The plugin was pre-installed when I downloaded jopr2.3.1
                2)I think the mysql-connector is included in the plugin jar as it is showing up in the tmp directory
                3)Is there a different version of the mysql plugin I can download that does have this class?

                in rhq-plugin.xml there is reference to this class http://git.fedorahosted.org/git/rhq/rhq.git?p=rhq/rhq.git;a=blob;f=modules/plugins/mysql/src/main/resources/META-INF/rhq-plugin.xml;h=d94a60f7ec38221a9ddedf32dfa3faa3196aa759;hb=master

                But it doesn't exist in the plugin

                <service name="Database" class="MySqlDatabaseComponent" discovery="MySqlDatabaseDiscoveryComponent">
                352 <plugin-configuration>
                353 <c:simple-property name="databaseName" displayName="Database Name" readOnly="true" />
                354 </plugin-configuration>
                355
                356
                357
                358
                359 <c:simple-property name="type" default="query">
                360 <c:property-options>
                361 <c:option value="query" name="query"/>
                362 <c:option value="update" name="update"/>
                363
                364 </c:property-options>
                365 </c:simple-property>
                366
                367
                368 <c:simple-property name="result"/>
                369 <c:simple-property name="contents"/>
                370
                371
                372
                373
                374
                375
                376
                377
                378
                379
                380
                381
                382
                383 <service name="Table" class="MySqlTableComponent" discovery="MySqlTableDiscoveryComponent"
                384 description="Database table" createDeletePolicy="both" creationDataType="configuration">
                385
                386 <plugin-configuration>
                387 <c:simple-property name="tableName" readOnly="true" />
                388 </plugin-configuration>
                389
                390
                391
                392

                • 5. Re: Mysql Database

                  Hello,

                  I'm facing the same issue: I use jopr 2.3.1 (binary download) and manually added a MySQL server. I have the same error messages showing up in the log file of the agent and came to the same conclusion: the rhq-plugin.xml in rhq-mysql-plugin-1.3.1.jar references the class MySqlDatabaseComponent which is not in the jar

                  I also see that other referenced classes (MySqlUserComponent, MySqlUserDiscoveryComponent, MySqlTableComponent, MySqlTableDiscoveryComponent) are not in the jar either.

                   

                  Any idea how to solve this?

                  • 6. Re: Mysql Database
                    pilhuhn

                    I have just pushed an overhaul of the MySQL plugin to the RHQ master repository ( see Overhauled MySQL plugin for RHQ), not only fixes the above issues, but also provides auto discovery etc.

                    This will be in RHQ 4.

                    See also http://rhq-project.org