Hi All,

TJ Ninneman's solution has worked. When Python is setup with Mod_WSGI on
Apache2, it is a recommeded to create a WSGI file in the application and
provide it as the root in the Apache2 mod_wsgi settings.

These should be called in the wsgi file at the earliest.
import lucene
lucene.initVM(classpath=lucene.CLASSPATH, maxheap="512m")
lucene.getVMEnv().attachCurrentThread()

and then include:
lucene.getVMEnv().attachCurrentThread()
in the every requested function (i.e. in the requests coming from Apache2 if
the request function is accessing any of the Lucene's funcationalities).

These two things solve the problem.

If there are anyside effects, pls do let me know. Andi, if you wish, there
can be a document or README like thing to include these points so that it
helps any new commer hereafter.

Thanks.

Regards,
Vin

On Tue, Aug 31, 2010 at 1:12 AM, TJ Ninneman <t...@twopeasinabucket.com>wrote:

> I've been running PyLucene within the Pylons framework under mod_wsgi for
> almost 2 years without any problems.
>
> I call the initVM within my .wsgi file:
>
> import lucene
>
> from paste.deploy import loadapp
>
> lucene.initVM(classpath=lucene.CLASSPATH, maxheap="512m")
> lucene.getVMEnv().attachCurrentThread()
>
> application = loadapp('config:/usr/local/www/myapp/trunk/apache.ini')
>
> And in my base controller I call attachCurrentThread on each request:
>
>  def __before__(self):
>        # Bind to JavaVM
>        lucene.getVMEnv().attachCurrentThread()
>
> I'm not sure how this compares to how it would be done in Django but it
> sure is flawless in my threaded Pylons setup.
>
> TJ
>
>
>
>

Reply via email to