Has anyone successfully gotten Squeryl to work inside a OSGi environment, specifically on Karaf 3.03.
So far I have gotten the individual dependencies to load, scala libraries, squeryl and the jdbc driver.The installed bundles look something like this:
51 | Resolved | 80 | 0.3.0.SNAPSHOT | ac.za.cput.pe.model
52 | Active | 80 | 2.11.6.v20150224-172222-092690e7bf | Scala Standard Library
53 | Active | 80 | 0 | wrap_mvn_org.squeryl_squeryl_2.10_0.9.5-6
54 | Active | 80 | 2.10.0.v20121205-112020-VFINAL-18481cef9b | Scala Standard Library
55 | Active | 80 | 0 | wrap_mvn_cglib_cglib-nodep_2.2
56 | Active | 80 | 0 | wrap_mvn_org.scala-lang_scalap_2.10.0
57 | Active | 80 | 2.10.0.v20121205-112020-VFINAL-18481cef9b | Scala Compiler
58 | Active | 80 | 2.10.0.v20121205-112020-VFINAL-18481cef9b | Scala Reflect
59 | Active | 80 | 0 | wrap_mvn_postgresql_postgresql_9.1-901-1.jdbc4
In my bundle I have code that looks like this:
Class.forName("org.postgresql.Driver")
SessionFactory.concreteFactory = Some(()=>
Session.create(
java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5432/pe","postgres"
,"12345"),new PostgreSqlAdapter
)
)
which basically tries to create squeryl session factory.
However when I start up karaf, this is the error I am getting:
java.lang.LinkageError: loader constraint violation: when resolving method "org.squeryl.SessionFactory$.concreteFactory_$eq(Lscala/Option;)V" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the current class, ac/za/cput/pe/model/activator/Activator, and the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for resolved class, org/squeryl/SessionFactory$, have different Class objects for the type concreteFactory_$eq used in the signature
Does anyone have any ideas?, I am a few hours from jumping out of my balcony :(