Hi, Fabrizio Scarcello schrieb: >> Hi Fabrizio >> > > Hi Felix! > What's a pleaure to talk with you..
Thanks ;-) > i'm surfing the sling mail archive and > i'm convinced that you are the real Apache Felix! ;-) Well, I am a member of the Apache Felix PMC but the project and me got their names completely independently of each other ;-) > I'm totally new to OSGI, but i'm enjoying a lot while discovering it... > The solution you suggested is very nice (the fragment bundle itself is a > very nice concept.. :-)), but perhpas i wasn't able to do all the right > things... > I have a directory postgres_fragment with: > - the postgresql.jar jdbc drivers > - the META-INF directory, containing a blank DEPENDENCIES file, NOTICE and > LICENSE files and the MANIFEST.MF file as follow: > > Manifest-Version: 1.0 > Bundle-Name: PostgreSQL Fragment > Bundle-Description: Attach PostgreSQL connectors to the embedded Jackrabbit > server bundle > Private-Package: org.postgresql > Fragment-Host: org.apache.sling.jcr.jackrabbit.server > Built-By: fabris > Bundle-Category: db_driver > Created-By: Fabris > Bundle-Vendor: HicTech s.r.l. > Build-Jdk: 1.6.0_16 > Bundle-Version: 0.1 > Bnd-LastModified: 1258108309167 > Bundle-ManifestVersion: 2 > Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt > Bundle-SymbolicName: com.hictech.bundle.postgresql > > > I make the jar of the directory content and install it using the > system/console webapp, but the bundle is only installed and not started (if > i understood, it can just depend from the different fragment bundles > lifecycle...) and the repository periodically tries to start but fails with > the following message: > 13.11.2009 16:31:34.058 *ERROR* [Repository Pinger] > org.apache.jackrabbit.core.RepositoryImpl failed to start Repository: Cannot > instantiate persistence manager > org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager: > Could not load class org.postgresql.Driver.... > > I'm not understanding where is the error... can you help me or give the > right link to read? ;-) Maybe the solution is very simple: If you start the fragment after the host bundle, the host bundle is (probably) not aware of the fragment yet. So you might want to refresh the jackrabbit-server bundle from within the web console. This should attacht the fragment and then add the contents of the bundle to the jackrabbit-server bundle's class loader. Please, note that fragments attached to a host bundle are only in resolve state and not in started state. Hope this helps. Regards Felix PS: Only the MANIFEST.MF file is important for OSGi, the DISCLAIMER, LICENSE and NOTICE.txt files are required by Apache for our artifacts for licensing reasons. > Thanks in advance, > greetings, > Fabris. > > > > >> Fabrizio Scarcello schrieb: >>> Hi to all, >>> a quick question: where i have to put jdbc drivers, if i use an external >> db >>> (not just the embedded derby)? >>> I downloaded the Sling war distribution, extracted and configured it with >>> PostegreSQL and then deployed it in a Tomcat instance under the context >>> /sling. It works fine, as i can see the system/console page... >>> But, trying to execute my scripts, i found that Sling searchs the >>> PostegreSQL drivers, but can't find them (even if i put the jar in the >> /lib >>> tomcat directory, where other webapps find and use it)... >>> I have the following exception: >>> 13.11.2009 12:11:04.858 *ERROR* [SCR Component Actor] >>> org.apache.jackrabbit.core.RepositoryImpl failed to start Repository: >> Cannot >>> instantiate persistence manager >>> >> org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager: >>> Could not load class org.postgresql.Driver: org.postgresql.Driver >>> >>> I think Sling has a different class loading engine and then different >>> settings... >> Yes, Sling is running inside an OSGi framework which is all about >> encapsulation (amongst other things of course). So there is no global >> class loader to which all class laoder delegate automagically as is >> custom in a regular java application. >> >> Otherwise all these nices things of dynamic bundle upgrades would not be >> possible. >> >>> Where i have to put the PostgreSQL driver jar to make it visible to >> Sling? >> >> Point is, how do you make them available to the Jackrabbit-Server >> bundle. I would suggest you create a Fragment bundle of the PostgreSQL >> driver jar which you attach to the Jackrabbit-Server bundle. >> >> The postgresql bundle contains the required drivers as private packages >> (no need to Export-Package them) and the framework will take care to add >> them to the class loader of the jackrabbit server bundle for the >> Jackrabbit Core to see the classes. >> >> Hope this helps. >> >> Regards >> Felix >> >
