Hi Rupert,

I do not have dbpedia index available on ManagedSolrServer. Could you
please guide me how to achieve that? Do I need to install any bundle
to my OSGi environment?

Regards,
Manish

Note: If I include dependency like
org.apache.stanbol.commons.solr.managed in my module's pom file, then
it do not compile as it has in turn dependent on osgi.core.





On Mon, May 5, 2014 at 3:35 PM, Rupert Westenthaler
<rupert.westentha...@gmail.com> wrote:
> Hi Manish
>
> You should use  the RegisteredSolrServerTracker [1] for that
>
> If you have the dbpedia index available on the ManagesSolrServer you
> can simple use
>
>     RegisteredSolrServerTracker indexTracker =
>         new RegisteredSolrServerTracker(bc, IndexReference.parse("dbpedia"));
>     indexTracker.open();
>
> in the activate method of your OSGI component (or the BundleActivator
> if you like)
>
> best
> Rupert
>
>
> [1] 
> http://stanbol.apache.org/docs/trunk/utils/commons-solr#tracking-solr-indexes
>
> On Mon, May 5, 2014 at 11:19 AM, Manish Aggarwal <mani.i...@gmail.com> wrote:
>> Hi,
>>
>> I have created a customized java module (see code extract below) which
>> initialized the SolrYard and query dbpedia index file. It uses stanbol
>> 0.12.0 packages. Everything works fine.
>> Now, I am trying to include this custom module in an OSGi environment
>> but getting the following error:
>>
>> Caused by: org.apache.solr.common.SolrException: Error instantiating
>> shardHandlerFactory class
>> [org.apache.solr.handler.component.HttpShardHandlerFactory]: Error
>> loading class 'org.apache.solr.handler.component.HttpShardHandlerFactory'
>>        at 
>> org.apache.solr.handler.component.ShardHandlerFactory.newInstance(ShardHandlerFactory.java:54)
>>        at org.apache.solr.core.CoreContainer.load(CoreContainer.java:204)
>>        at 
>> com.abc.g11n.queryDbpedia.QueryDbpediaDirect.initYardNew(QueryDbpediaDirect.java:146)
>>        at 
>> com.abc.g11n.queryDbpedia.QueryDbpediaDirect.init(QueryDbpediaDirect.java:119)
>>        at 
>> com.adc.sharedcloud.worker.manthanta.DefaultCommand.<clinit>(DefaultCommand.java:59)
>>        ... 103 more
>>
>> I was reading about StandaloneEmbeddedSolrServerProvider and I found
>> out that it is intended to be used outside of an OSGI environment as
>> specified at 
>> (http://www.go5th.com/jdocs/stanbol/commons/solr/managed/org/apache/stanbol/commons/solr/managed/standalone/StandaloneEmbeddedSolrServerProvider.html)
>>
>> Could you please help me on how to initialize a SolrYard (to query
>> dbpedia index file) in an OSGi environment?
>>
>>
>> (Code that I am currently using to initialize the SolrYard)
>>
>>     private static Yard yard;
>>     private static final String DBP_RES_ID = "Dbp_Res_ID";
>>     private static final String YARD_ID = "DbpYard";
>>     private static final String SOLR_CORE_NAME = "dbpedia";
>>     private static StandaloneEmbeddedSolrServerProvider solrServerProvider;
>>     private static SolrServer server;
>>     public static boolean dbpediaInitialised = false;
>>
>> private static void initYard(String solrServerDir) throws
>> YardException, IOException {
>>         SolrYardConfig config = new SolrYardConfig(YARD_ID, SOLR_CORE_NAME);
>>         config.setName("Dbpedia Solr Yard");
>>         config.setDescription("The Solr Yard for querying dbpedia");
>>         config.setAllowInitialisation(false);
>>         System.setProperty(ManagedSolrServer.MANAGED_SOLR_DIR_PROPERTY,
>> solrServerDir);
>>         IndexReference solrServerRef =
>> IndexReference.parse(config.getSolrServerLocation());
>>         solrServerProvider = 
>> StandaloneEmbeddedSolrServerProvider.getInstance();
>>         server = solrServerProvider.getSolrServer(solrServerRef,
>>                 config.isAllowInitialisation() ?
>> config.getIndexConfigurationName() : null);
>>         //Optional support for the nsPrefix service
>>         final NamespacePrefixService nsPrefixService;
>>         ServiceLoader<NamespacePrefixService> spsl =
>> ServiceLoader.load(NamespacePrefixService.class);
>>         Iterator<NamespacePrefixService> it = spsl.iterator();
>>         if(it.hasNext()){
>>             nsPrefixService = it.next();
>>         } else {
>>             nsPrefixService = null;
>>         }
>>         yard = new SolrYard(server, config, nsPrefixService);
>>     }
>>
>>
>> Regards,
>> Manish
>
>
>
> --
> | Rupert Westenthaler             rupert.westentha...@gmail.com
> | Bodenlehenstraße 11                              ++43-699-11108907
> | A-5500 Bischofshofen
> | REDLINK.CO 
> ..........................................................................
> | http://redlink.co/

Reply via email to