You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Manish Aggarwal <ma...@gmail.com> on 2014/05/05 11:19:57 UTC

stanbol

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

Re: stanbol

Posted by Rupert Westenthaler <ru...@gmail.com>.
Hi Manish

I think I do not fully understand your actual question/problem so I
tried to answer single questions instead.


> On Thu, May 15, 2014 at 4:20 PM, Manish Aggarwal <ma...@gmail.com> wrote:
>> 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?

DBpedia is available in the default Stanbol launchers. So you just
need to copy the full dbpedia.solrindex.zip to the datafile directory.
If you have your own launcher configuration that does not include
DBpedia you need to install [1]

[1] http://dev.iks-project.eu/downloads/stanbol-indices/dbpedia-3.7/org.apache.stanbol.data.site.dbpedia-1.0.0.jar

>> 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.

I do not know what you mean by that.

On Fri, May 16, 2014 at 8:51 AM, Manish Aggarwal <ma...@gmail.com> wrote:
> Rupert,
>
> I have dbpedia index but does not know how to make use (install and
> configured) of ManagedSolrServer in our osgi environment.
> I googled but didn't find much on it except the link that you
> forwarded me in your earlier mail but it had a high level view.
> I am unable to find how exactly should I install and configure it in my OSGi.
>

The  o.a.stanbol.commons.solr.core and
o.a.stanbol.commons.solr.managed provide the implementations. A
"default" Managed SolrServer instance is provides by the
o.a.stanbol.commons.solr.default module. So if you want to have the
default you do also need to include this Bundle. As an alternative you
can also configure your own (and even multiple instances) by creating
configurations for the
org.apache.stanbol.commons.solr.managed.impl.ManagedSolrServerImpl
service. As example you can use the one provided by this module.

Hope this helps
best
Rupert

-- 
| Rupert Westenthaler             rupert.westenthaler@gmail.com
| Bodenlehenstraße 11                              ++43-699-11108907
| A-5500 Bischofshofen
| REDLINK.CO ..........................................................................
| http://redlink.co/

Re: stanbol

Posted by Manish Aggarwal <ma...@gmail.com>.
Rupert,

I have dbpedia index but does not know how to make use (install and
configured) of ManagedSolrServer in our osgi environment.
I googled but didn't find much on it except the link that you
forwarded me in your earlier mail but it had a high level view.
I am unable to find how exactly should I install and configure it in my OSGi.

Regards,
Manish



On Thu, May 15, 2014 at 4:20 PM, Manish Aggarwal <ma...@gmail.com> wrote:
> 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
> <ru...@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 <ma...@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.westenthaler@gmail.com
>> | Bodenlehenstraße 11                              ++43-699-11108907
>> | A-5500 Bischofshofen
>> | REDLINK.CO ..........................................................................
>> | http://redlink.co/

Re: stanbol

Posted by Manish Aggarwal <ma...@gmail.com>.
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
<ru...@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 <ma...@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.westenthaler@gmail.com
> | Bodenlehenstraße 11                              ++43-699-11108907
> | A-5500 Bischofshofen
> | REDLINK.CO ..........................................................................
> | http://redlink.co/

Re: stanbol

Posted by Rupert Westenthaler <ru...@gmail.com>.
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 <ma...@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.westenthaler@gmail.com
| Bodenlehenstraße 11                              ++43-699-11108907
| A-5500 Bischofshofen
| REDLINK.CO ..........................................................................
| http://redlink.co/