On Sat, 5 Feb 2011, Roman Chyla wrote:
Hi Andi, all,
I have just came across behaviour which seems strange -- I have built
lucene and wrapped solr + my own extension with JCC (ver. 2.7; OS is
Mac, Python 32bi 2.6; using generics in all of the packages) All of
the packages are compiled in the shared mode -- I import them in the
correct order of: lucene, solr, my extension.
Now i realized it was not possible to initialize a HashMap until the
first extension (in this case lucene) is started
Is this the effect of building them in the shared mode - where one
depends on one another?
Are you using the --import flag with JCC to build your modules ?
This flag helps to avoid duplication of classes and wrappers and such
confusion.
1. build lucene as usual
2. build other modules that depend on lucene with --import lucene
If you're already doing so, maybe you need to add HashMap to the list of
classes being wrapped in lucene's Makefile (not there currently, only
HashSet is).
Andi..
Thank you,
roman
In [1]: from solrpie import initvm
Warning: we add the default folder to sys.path:
/x/dev/workspace/sandbox/solrpie/build/dist
In [2]: sj = initvm.solrpie_java
In [3]: sj.initVM()
Out[3]: <jcc.JCCEnv object at 0x194b70>
In [4]: sj.Hash
sj.HashDocSet sj.HashMap sj.HashSet sj.Hashtable
In [4]: sj.HashMap().of_(sj.String, sj.String)
---------------------------------------------------------------------------
InvalidArgsError Traceback (most recent call last)
/x/dev/workspace/sandbox/solrpie/python/<ipython console> in <module>()
InvalidArgsError: (<type 'HashMap'>, 'of_', (<type 'String'>, <type 'String'>))
In [5]: import lucene
In [6]: sj.HashMap().of_(lucene.String, lucene.String)
---------------------------------------------------------------------------
InvalidArgsError Traceback (most recent call last)
/x/dev/workspace/sandbox/solrpie/python/<ipython console> in <module>()
InvalidArgsError: (<type 'HashMap'>, 'of_', (<type 'String'>, <type 'String'>))
In [7]: lucene.HashMap().of_(lucene.String, lucene.String)
---------------------------------------------------------------------------
InvalidArgsError Traceback (most recent call last)
/x/dev/workspace/sandbox/solrpie/python/<ipython console> in <module>()
InvalidArgsError: (<type 'HashMap'>, 'of_', (<type 'String'>, <type 'String'>))
In [8]: lucene.initVM()
Out[8]: <jcc.JCCEnv object at 0x194cd0>
In [9]: lucene.HashMap().of_(lucene.String, lucene.String)
Out[9]: <HashMap: {}>
In [10]: sj.HashMap().of_(sj.String, sj.String)
Out[10]: <HashMap: {}>