java - NoClassDefFoundError in org.apache.openjpa.lib.xml.XMLFactory from inside Karaf -


we trying simple use case of reading/writing mysql database using jpa camel routes inside karaf. frequently/always causes following stacktrace when camel loading code contains routes:

2013-07-19 17:01:47,178 | warn | ft.workoutentity | jpaconsumer | rg.apache.camel.util.camellogger 224 | 68 - org.apache.camel.camel-core - 2.10.4 | consumer consumer[jpa://workoutentity] failed polling endpoint: endpoint[jpa://workoutentity]. try again @ next poll. caused by: [java.lang.noclassdeffounderror - not initialize class org.apache.openjpa.lib.xml.xmlfactory] java.lang.noclassdeffounderror: not initialize class org.apache.openjpa.lib.xml.xmlfactory @ org.apache.openjpa.jdbc.sql.sqlerrorcodereader.parse(sqlerrorcodereader.java:107) @ org.apache.openjpa.jdbc.sql.dbdictionary.endconfiguration(dbdictionary.java:4712) @ org.apache.openjpa.lib.conf.configurations.configureinstance(configurations.java:518) @ org.apache.openjpa.lib.conf.configurations.configureinstance(configurations.java:443) @ org.apache.openjpa.jdbc.sql.dbdictionaryfactory.newdbdictionary(dbdictionaryfactory.java:199) @ org.apache.openjpa.jdbc.sql.dbdictionaryfactory.newdbdictionary(dbdictionaryfactory.java:100)

xmlfactory contained in openjpa-aggregate bundle bundle has imported. can instantiate other objects same org.apache.openjpa.lib.xml package.

i cracked open opensource openjpa code , took @ xmlfactory. there static block @ top should called when class loaded. static block not doing complex, instantiating sax , dom parser factories.

if, in java code contains routes, add following line:

org.apache.openjpa.lib.xml.xmlfactory.getclass()

to class loaded in classloader, error sometimes stop.

here's version info:

karaf => 2.3.2

camel => tried 2.10.4 , 2.11.1

openjpa => tried 2.2.0 , 2.2.2

mysql => 5.1.25

let me know if need more info.

-new info- turned on debug level logging karaf prompt , see error before noclassdeferror

2013-07-19 17:35:36,784 | debug | ft.workoutentity | transactiontemplate | tion.support.transactiontemplate 160 | 75 - org.springframework.transaction - 3.2.3.release | initiating transaction rollback on application exception javax.xml.parsers.factoryconfigurationerror: provider org.apache.xerces.jaxp.saxparserfactoryimpl not found @ javax.xml.parsers.saxparserfactory.newinstance(saxparserfactory.java:122)[:2.2.0] @ org.apache.openjpa.lib.xml.xmlfactory.(xmlfactory.java:60) @ org.apache.openjpa.jdbc.sql.sqlerrorcodereader.parse(sqlerrorcodereader.java:107) @ org.apache.openjpa.jdbc.sql.dbdictionary.endconfiguration(dbdictionary.java:4712) @ org.apache.openjpa.lib.conf.configurations.configureinstance(configurations.java:518) @ org.apache.openjpa.lib.conf.configurations.configureinstance(configurations.java:443) @ org.apache.openjpa.jdbc.sql.dbdictionaryfactory.newdbdictionary(dbdictionaryfactory.java:199) @ org.apache.openjpa.jdbc.sql.dbdictionaryfactory.newdbdictionary(dbdictionaryfactory.java:100) @ org.apache.openjpa.jdbc.conf.jdbcconfigurationimpl.getdbdictionaryinstance(jdbcconfigurationimpl.java:603)

this explains noclassdeffound error.

you don't have xerces installed.

try installing , dependencies maven:

osgi:install wrap:mvn:xml-apis/xml-apis/1.4.01 osgi:install wrap:mvn:xml-resolver/xml-resolver/1.2 osgi:install wrap:mvn:xerces/xercesimpl/2.11.0 

Comments