You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Jérémy Soula <js...@ebusinessinformation.fr> on 2005/04/25 10:48:05 UTC

Re:null pointer when enabling contentindexer

Hi all,

I have the same error with the same config.

Any idea?



Hi all,

I am running slide 2.1 with a txfilestore on weblogic 8.1, i am trying
to enable the contentindexer, in my domain xml i have uncommented=20

   <contentindexer
classname=3D"org.apache.slide.index.SampleTxtContainsIndexer">
    <parameter name=3D"indexpath">store/index</parameter>
   </contentindexer>

i have lucene on my classpath, i dont understand why when slide loads up
i get this exception

21 Feb 2005 18:34:28 - org.apache.slide.common.Domain - ERROR -
java.lang.NullPointerException
java.lang.NullPointerException
at java.io.File.<init>(File.java:180)
at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:173)
at
org.apache.slide.index.SampleTxtContainsIndexer.initialize(SampleTxtCont
ainsIndexer.java:73)
at
org.apache.slide.store.AbstractStore.initialize(AbstractStore.java:265)
at
org.apache.slide.common.Namespace.initializeServices(Namespace.java:488)
at org.apache.slide.common.Namespace.loadDefinition(Namespace.java:755)
at org.apache.slide.common.Domain.initNamespace(Domain.java:840)
at org.apache.slide.common.Domain.init(Domain.java:432)
at org.apache.slide.common.Domain.init(Domain.java:366)
at org.apache.slide.common.Domain.init(Domain.java:329)
at org.apache.slide.webdav.WebdavServlet.init(WebdavServlet.java:253)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at org.apache.slide.webdav.WebdavServlet.init(WebdavServlet.java:195)
at
weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletS
tubImpl.java:1018)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118
)
at
weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.
java:894)
at
weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImp
l.java:873)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl
.java:812)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServ
letContext.java:3281)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppSer
vletContext.java:3226)
at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppSe
rvletContext.java:3207)
at
weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:69
4)
at
weblogic.servlet.internal.WebService.preloadResources(WebService.java:48
3)
at
weblogic.servlet.internal.ServletInitService.resume(ServletInitService.j
ava:30)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: null pointer when enabling contentindexer

Posted by Stefan Lützkendorf <lu...@apache.org>.
The SampleTxtContainsIndexer is a sample only. In Slide 2.2 there will be an improved
implementation of a lucene based content indexer, but it is currently only available from the cvs head

See http://wiki.apache.org/jakarta-slide/DaslConfiguration

Stefan


Jérémy Soula wrote:
> Thanks for reply
> 
> Yes i use the lastest release version of slide and the version 1.3 of 
> SampleTxtContainsIndexer.
> Too i create the index and specify an absolute directory.
> But i still have the NPE.
> 
> Triing to debug, i notice that the variable indexpath is null when i 
> reach the line 173, so the NPE.
> I thinked that this variable must be set with the parameter specify in 
> the Domain.xml but it seems not.
> 
> (My Domain.xml is the default one).
> 
> And when, before the line 173, i initialize the variable indexpath with 
> the absolute directory
> like this
> <code>
>    public void initialize(NamespaceAccessToken token)
>        throws ServiceInitializationFailedException
>    {
>        indexpath = token.getNamespaceConfig().getParameter (INDEX_PATH);
>        IndexWriter indexWriter = null;
>        this.indexpath="./index";
>        try
>        {
>                      indexWriter = new IndexWriter(indexpath, new 
> StandardAnalyzer(), false);
>        }
>        // will fail, if not yet exists
>        catch (IOException e)
>        {
>            try
>            {
>                // create index
>                indexWriter = new IndexWriter(indexpath, new 
> StandardAnalyzer(), true);
>            }
>            catch (IOException ex)
>            {
>                throw new ServiceInitializationFailedException (this, ex);
>            }
>        }
>              try
>        {
>            indexWriter.close();
>        }
>        catch (IOException e)
>        {
>            throw new ServiceInitializationFailedException (this, e);
>        }
>    }
> </code>
> , an index is created and the search with lucene works.
> Maybe a bug when the configuration is parsed?
> 
> Regards,
> Jérémy
> 
> 
> 
> 
> 
> 
> Martin Kalén wrote:
> 
>> Jérémy Soula wrote:
>>
>>> I have the same error with the same config.
>>
>>
>> <snip/>
>>
>>> java.lang.NullPointerException
>>> at java.io.File.<init>(File.java:180)
>>> at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)
>>> at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:173)
>>> at
>>> org.apache.slide.index.SampleTxtContainsIndexer.initialize(SampleTxtCont
>>> ainsIndexer.java:73)
>>
>>
>>
>> Are you running 2.1 final release?
>>
>> I checked CVS for line 73 of SampleTxtContainsIndexer.java and saw that
>> there was a bugfix for a local vs global variable, as you can see here
>> (note "String indexPath" vs "indexpath"):
>> http://cvs.apache.org/viewcvs.cgi/jakarta-slide/src/stores/org/apache/slide/index/SampleTxtContainsIndexer.java?r1=1.2&r2=1.3&diff_format=h 
>>
>>
>>
>> If you still get exceptions with v2.1 release, I would assume that Lucene
>> throws this NPE if the directory does not exist.
>>
>> Since you are using a relative directory "store/index", make sure that
>> this directory exists relative to where you start the JVM with WebLogic.
>>
>> Alternatively, specify an absolute directory as indexpath.
>>
>> Regards,
>>  Martin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: null pointer when enabling contentindexer

Posted by Jérémy Soula <js...@ebusinessinformation.fr>.
Thanks for reply

Yes i use the lastest release version of slide and the version 1.3 of 
SampleTxtContainsIndexer.
Too i create the index and specify an absolute directory.
But i still have the NPE.

Triing to debug, i notice that the variable indexpath is null when i 
reach the line 173, so the NPE.
I thinked that this variable must be set with the parameter specify in 
the Domain.xml but it seems not.

(My Domain.xml is the default one).

And when, before the line 173, i initialize the variable indexpath with 
the absolute directory
like this
<code>
    public void initialize(NamespaceAccessToken token)
        throws ServiceInitializationFailedException
    {
        indexpath = token.getNamespaceConfig().getParameter (INDEX_PATH);
        IndexWriter indexWriter = null;
        this.indexpath="./index";
        try
        {
           
            indexWriter = new IndexWriter(indexpath, new 
StandardAnalyzer(), false);
        }
        // will fail, if not yet exists
        catch (IOException e)
        {
            try
            {
                // create index
                indexWriter = new IndexWriter(indexpath, new 
StandardAnalyzer(), true);
            }
            catch (IOException ex)
            {
                throw new ServiceInitializationFailedException (this, ex);
            }
        }
       
        try
        {
            indexWriter.close();
        }
        catch (IOException e)
        {
            throw new ServiceInitializationFailedException (this, e);
        }
    }
</code>
, an index is created and the search with lucene works.
Maybe a bug when the configuration is parsed?

Regards,
Jérémy






Martin Kalén wrote:

> Jérémy Soula wrote:
>
>> I have the same error with the same config.
>
> <snip/>
>
>> java.lang.NullPointerException
>> at java.io.File.<init>(File.java:180)
>> at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)
>> at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:173)
>> at
>> org.apache.slide.index.SampleTxtContainsIndexer.initialize(SampleTxtCont
>> ainsIndexer.java:73)
>
>
> Are you running 2.1 final release?
>
> I checked CVS for line 73 of SampleTxtContainsIndexer.java and saw that
> there was a bugfix for a local vs global variable, as you can see here
> (note "String indexPath" vs "indexpath"):
> http://cvs.apache.org/viewcvs.cgi/jakarta-slide/src/stores/org/apache/slide/index/SampleTxtContainsIndexer.java?r1=1.2&r2=1.3&diff_format=h 
>
>
>
> If you still get exceptions with v2.1 release, I would assume that Lucene
> throws this NPE if the directory does not exist.
>
> Since you are using a relative directory "store/index", make sure that
> this directory exists relative to where you start the JVM with WebLogic.
>
> Alternatively, specify an absolute directory as indexpath.
>
> Regards,
>  Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: null pointer when enabling contentindexer

Posted by Martin Kalén <mk...@apache.org>.
Jérémy Soula wrote:
> I have the same error with the same config.
<snip/>
> java.lang.NullPointerException
> at java.io.File.<init>(File.java:180)
> at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)
> at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:173)
> at
> org.apache.slide.index.SampleTxtContainsIndexer.initialize(SampleTxtCont
> ainsIndexer.java:73)

Are you running 2.1 final release?

I checked CVS for line 73 of SampleTxtContainsIndexer.java and saw that
there was a bugfix for a local vs global variable, as you can see here
(note "String indexPath" vs "indexpath"):
http://cvs.apache.org/viewcvs.cgi/jakarta-slide/src/stores/org/apache/slide/index/SampleTxtContainsIndexer.java?r1=1.2&r2=1.3&diff_format=h


If you still get exceptions with v2.1 release, I would assume that Lucene
throws this NPE if the directory does not exist.

Since you are using a relative directory "store/index", make sure that
this directory exists relative to where you start the JVM with WebLogic.

Alternatively, specify an absolute directory as indexpath.

Regards,
  Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org