0 Replies Latest reply on Aug 16, 2013 7:04 AM by Lalit Manchanda

    Class Not Found com.mysql.clusterj.openjpa.NdbOpenJPABrokerFactory

    Lalit Manchanda Newbie

      Hi,

       

      I am using jboss-fuse-6.24 on windows 7.

       

      I am trying to connect to mysql cluster using openJpa+clusterj. In my bundle I see the following:

       

      Bundle-ClassPath = .,com.sun.xml.bind.jaxb-impl-resources.jar,xerces.xercesImpl-resources.jar,xalan.xalan-resources.jar,com.mysql.clusterj.jar,com.oracle.ojdbc6

       

       

      .jar,mysql.mysql-connector-java.jar,org.apache.servicemix.bundles.org.apache.servicemix.bundles.hsqldb.jar,org.milyn.milyn-scribe-jpa.jar,commons-lang.commons-l

       

       

      ang.jar,org.milyn.milyn-scribe-core.jar,org.milyn.milyn-commons.jar,javassist.javassist.jar,org.freemarker.freemarker.jar,org.milyn.milyn-smooks-csv.jar,net.sf.

       

       

      opencsv.opencsv.jar,org.milyn.milyn-smooks-core.jar,com.thoughtworks.xstream.xstream.jar,xmlpull.xmlpull.jar,xpp3.xpp3_min.jar,jaxen.jaxen.jar,org.mvel.mvel2.ja

       

       

      r,org.milyn.milyn-smooks-flatfile.jar,org.milyn.milyn-smooks-javabean.jar,org.milyn.milyn-smooks-persistence.jar,org.milyn.milyn-smooks-templating.jar,antlr.ant

       

       

      lr.jar,antlr.stringtemplate.jar,ognl.ognl.jar,postgresql.postgresql.jar

       

       

      Import-Package-com.mysql.clusterj.openjpa.NdbOpenJPABrokerFactory;resolution:=optional (This is in addtion to the others)

       

       

       

      blueprint.xml looks like following:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xmlns:camel="http://camel.apache.org/schema/blueprint"

              xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"

             xsi:schemaLocation="

             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

             http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd

             http://aries.apache.org/xmlns/jpa/v1.1.0 http://aries.apache.org/schemas/jpa/jpa_110.xsd">

       

       

       

        <bean id="purchaseOrder" class="manchanda.lalit.TestJpa.PurchaseOrder"/>

       

       

      <camelContext trace="true" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">

      <template id="baseProducer"/>

      <consumerTemplate id="baseConsumer" />

       

       

       

      <route id="date-insert-check">

              <from uri="timer:foo?period=40s"/>

              <bean ref="helloBean" method="putCheckDate"/>

                  

              <to uri="mock:result"/>

          </route>

          

       

        

         

      </camelContext> 

       

       

        <reference id="jpaTransactionManager" interface="javax.transaction.TransactionManager"/>

       

       

           <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">

              <argument ref="jpaTransactionManager"/>

          </bean>

       

       

                 <bean id="PROPAGATION_REQUIRED" class="org.apache.camel.spring.spi.SpringTransactionPolicy">

              <property name="transactionManager" ref="transactionManager"/>

           </bean>

       

       

       

         

          <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">

               <jpa:unit unitname="camel-openjpa-mysql" property="entityManagerFactory"/>

                <property name="transactionManager" ref="transactionManager"/>

          </bean>

         

      </blueprint>

       

       

      Persistence Unit looks like following:

       

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">

       

      <persistence-unit name="camel-openjpa-mysql" transaction-type="JTA">

        <provider>

               org.apache.openjpa.persistence.PersistenceProviderImpl

         </provider>

                  <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/mysqlds</jta-data-source>

                  <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/mysqlds)</non-jta-data-source>

               <class>manchanda.lalit.TestJpa.CheckDate</class>

           <exclude-unlisted-classes>true</exclude-unlisted-classes>

         

          <properties>

            <property name="openjpa.Log" value="DefaultLevel=INFO, Tool=INFO"/>

       

            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>

                  <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>

                  <property name="openjpa.jdbc.UpdateManager" value="org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager"/>

       

                  <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />

                   <property name="openjpa.ConnectionURL" value="jdbc:mysql://10.12.122.23:3306/volt" />

                   <property name="openjpa.ConnectionUserName" value="volt" />

                   <property name="openjpa.ConnectionPassword" value="volt@123" />

                   <property name="openjpa.BrokerFactory" value="com.mysql.clusterj.openjpa.NdbOpenJPABrokerFactory" />

                  <property name="openjpa.jdbc.DBDictionary" value="TableType=ndb"/>

                  <property name="openjpa.ndb.connectString" value="10.12.122.22:1186" />

                  <property name="openjpa.ndb.database" value="volt" />

          </properties>

       

       

        </persistence-unit>

       

       

         

      </persistence>

       

       

       

      But while I start the bundle I get the following exception:

       

       

      s. The error will be ignored.

      <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: Could not invoke the static newInstance method on the named factory class "<<openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.util.UserException: The named BrokerFactory "com.mysql.clusterj.openjpa.NdbOpenJPABrokerFactory" is not valid.>".

              at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:76)[243:org.apache.openjpa:2.2.0]

              at org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(PersistenceProviderImpl.java:147)[243:org.apache.openjpa:2.2.0]

              at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:185)[243:org.apache.openjpa:2.2.0]

              at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)[243:org.apache.openjpa:2.2.0]

              at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.createEntityManagerFactories(EntityManagerFactoryManager.java:360)[256:org.apache.aries.jpa.container:1.0.1.redhat-60024]

              at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:199)[256:org.apache.aries.jpa.container:1.0.1.redhat-60024]

              at org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(PersistenceBundleManager.java:296)[256:org.apache.aries.jpa.container:1.0.1.redhat-60024]

              at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[13:org.apache.aries.util:1.0.1.redhat-60024]

              at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[13:org.apache.aries.util:1.0.1.redhat-60024]

              at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[13:org.apache.aries.util:1.0.1.redhat-60024]

              at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[13:org.apache.aries.util:1.0.1.redhat-60024]

              at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[13:org.apache.aries.util:1.0.1.redhat-60024]

              at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4580)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1073)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:437)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4148)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.Felix.startBundle(Felix.java:2055)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.fusesource.fabric.fab.osgi.commands.fab.StartCommand.startBundle(StartCommand.java:70)[71:org.fusesource.fabric.fab.fab-osgi:7.2.0.redhat-024]

              at org.fusesource.fabric.fab.osgi.commands.fab.StartCommand.doExecute(StartCommand.java:62)[71:org.fusesource.fabric.fab.fab-osgi:7.2.0.redhat-024]

              at org.fusesource.fabric.fab.osgi.commands.fab.FabCommandSupport.doExecute(FabCommandSupport.java:34)[71:org.fusesource.fabric.fab.fab-osgi:7.2.0.redhat-024]

              at org.fusesource.fabric.fab.osgi.commands.BundleCommandSupport.doExecute(BundleCommandSupport.java:39)[71:org.fusesource.fabric.fab.fab-osgi:7.2.0.redhat-024]

              at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.karaf.shell.console.jline.Console.run(Console.java:176)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

              at org.apache.karaf.shell.console.jline.DelayedStarted.run(DelayedStarted.java:61)[15:org.apache.karaf.shell.console:2.3.0.redhat-60024]

      Caused by: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: The named BrokerFactory "com.mysql.clusterj.openjpa.NdbOpenJPABrokerFactory" is not valid.

              at org.apache.openjpa.kernel.Bootstrap.getFactoryClass(Bootstrap.java:166)[243:org.apache.openjpa:2.2.0]

              at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:118)[243:org.apache.openjpa:2.2.0]

              at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:65)[243:org.apache.openjpa:2.2.0]

              ... 36 more

      Caused by: java.lang.ClassNotFoundException: com.mysql.clusterj.openjpa.NdbOpenJPABrokerFactory not found by org.apache.openjpa [243]

              at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)

              at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)

              at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_43]

              at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1862)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)[org.apache.felix.framework-4.0.3.redhat-60024.jar:]

              at org.apache.openjpa.persistence.osgi.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:43)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)[:1.6.0_43]

              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_43]

              at java.lang.Class.forName0(Native Method)[:1.6.0_43]

              at java.lang.Class.forName(Class.java:249)[:1.6.0_43]

              at org.apache.openjpa.kernel.Bootstrap.getFactoryClass(Bootstrap.java:164)[243:org.apache.openjpa:2.2.0]

       

       

       

      Kindly help in what I am missing here.

       

      Thanks

      Lalit