lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: NumericField exception java.lang.IllegalStateException: call set???Value() before usage in lucene 3.5
Date Tue, 27 Mar 2012 09:31:14 GMT
The bug mentioned in this link was a multithread bug (what I asked you). If
you reuse Documents and Fields this can happen, otherwise not. This code is
heavily tested and the code you sent cannot fail. Maybe its different to the
one you actually use?

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: jianwen lou [mailto:loujanwen@gmail.com]
> Sent: Tuesday, March 27, 2012 9:49 AM
> To: java-user@lucene.apache.org
> Subject: Re: NumericField exception java.lang.IllegalStateException: call
> set???Value() before usage in lucene 3.5
> 
> No,There is no multi-thread building index at same time, I google and get
the
> result, i use 64 bit jvm. It matters?
> 
>
http://lucene.472066.n3.nabble.com/Lucene-3-4-shift-bug-in-possibly-invalid-
> use-of-NumericTokenStream-td3592962.html
> 
> F:\Java\open-source\lucene>java -version java version "1.6.0_25"
> Java(TM) SE Runtime Environment (build 1.6.0_25-b06) Java HotSpot(TM) 64-
> Bit Server VM (build 20.0-b11, mixed mode)
> 
> 
> On Tue, Mar 27, 2012 at 3:24 PM, Uwe Schindler <uwe@thetaphi.de> wrote:
> 
> > Hi,
> >
> > Are you sure that you are not reusing the same NumericField instances
> > across different threads?
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> >
> >
> > > -----Original Message-----
> > > From: jianwen lou [mailto:loujanwen@gmail.com]
> > > Sent: Tuesday, March 27, 2012 9:21 AM
> > > To: java-user@lucene.apache.org
> > > Subject: NumericField exception java.lang.IllegalStateException:
> > > call
> > > set???Value() before usage in lucene 3.5
> > >
> > > I want to store the long type value to my index files like follwing:
> > >
> > >                 NumericField priceField = new NumericField("price");
> > >                 priceField.setDoubleValue(temp.getCurrentprice());
> > >                 document.add(priceField);
> > >
> > >                 NumericField salesField = new
NumericField("salescount");
> > >                 priceField.setLongValue(temp.getSalescount());
> > >                 document.add(salesField);
> > >
> > >                 NumericField ontimefiled = new NumericField("ontime");
> > >                 ontimefiled.setLongValue(temp.getOntime().getTime());
> > >                 document.add(ontimefiled);
> > >
> > > when writer add document i get the exception info:there is wrong
> > > with my using NumbericField? thanks
> > >
> > >
> > > java.lang.IllegalStateException: call set???Value() before usage
> > >     at
> > > org.apache.lucene.analysis.NumericTokenStream.reset(NumericTokenStre
> > > am.j
> > > ava:196)
> > >     at
> > >
> >
> > org.apache.lucene.index.DocInverterPerField.processFields(DocInverterP
> > erFiel
> > d
> > > .java:130)
> > >     at
> > > org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(D
> > > ocFie
> > > ldProcessorPerThread.java:278)
> > >     at
> > >
> org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWrit
> > > er
> > > .java:766)
> > >     at
> > > org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2066)
> > >     at
> > >
> com.beike.common.lucene.dao.IndexDaoImpl.saveGoodsIndex4Mobile(Index
> > > Da
> > > oImpl.java:308)
> > >     at
> > > com.beike.common.lucene.dao.IndexStrategyServiceImpl.indexGoods4Mobi
> > > le(I
> > > ndexStrategyServiceImpl.java:118)
> > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >     at
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > 39)
> > >     at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > ssorI
> > > mpl.java:25)
> > >     at java.lang.reflect.Method.invoke(Method.java:597)
> > >     at
> > >
> > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflectio
> > n(Aop
> > > Utils.java:307)
> > >     at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJ
> > > oinpo
> > > int(ReflectiveMethodInvocation.java:182)
> > >     at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:149)
> > >     at
> > >
> >
> > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > oke(Tr
> > a
> > > nsactionInterceptor.java:106)
> > >     at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:171)
> > >     at
> > >
> >
> > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > oke(Tr
> > a
> > > nsactionInterceptor.java:106)
> > >     at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:171)
> > >     at
> > >
> >
> > org.springframework.transaction.interceptor.TransactionInterceptor.inv
> > oke(Tr
> > a
> > > nsactionInterceptor.java:106)
> > >     at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:171)
> > >     at
> > >
com.beike.ds.DataSourceInterceptor.invoke(DataSourceInterceptor.java:42)
> > >     at
> > > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> > > (Refl
> > > ectiveMethodInvocation.java:171)
> > >     at
> > >
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynam
> > > ic
> > > AopProxy.java:204)
> > >     at $Proxy53.indexGoods4Mobile(Unknown Source)
> > >     at
> > >
> > com.beike.lucene.test.TestLuceneIndex.initGoodsIndex4Mobile(TestLucene
> > Inde
> > > x.java:45)
> > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >     at
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > 39)
> > >     at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > ssorI
> > > mpl.java:25)
> > >     at java.lang.reflect.Method.invoke(Method.java:597)
> > >     at
> > >
> > org.springframework.test.context.junit4.SpringTestMethod.invoke(Spring
> > TestM
> > > ethod.java:160)
> > >     at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.runTestMeth
> > od(S
> > > pringMethodRoadie.java:233)
> > >     at
> > > org.springframework.test.context.junit4.SpringMethodRoadie$RunBefore
> > > sThen
> > > TestThenAfters.run(SpringMethodRoadie.java:333)
> > >     at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepe
> > titio
> > > ns(SpringMethodRoadie.java:217)
> > >     at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.runTest(Spr
> > ingM
> > > ethodRoadie.java:197)
> > >     at
> > >
> > org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringM
> > etho
> > > dRoadie.java:143)
> > >     at
> > >
> >
> > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invoke
> > TestMe
> > > thod(SpringJUnit4ClassRunner.java:160)
> > >     at
> > >
> >
> > org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRun
> > ner.ja
> > v
> > > a:51)
> > >     at
> > >
> >
> > org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.j
> > ava:44
> > )
> > >     at
> > >
> > org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java
> > :27)
> > >     at
> > >
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
> > >     at
> > >
> > org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.jav
> > a:42)
> > >     at
> > >
> >
> > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(Sp
> > ringJU
> > n
> > > it4ClassRunner.java:97)
> > >     at
> > >
> >
> > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4T
> > estRef
> > ere
> > > nce.java:38)
> > >     at
> > >
> >
> > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.
> > java:3
> > 8)
> > >     at
> > >
> >
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> > TestRu
> > > nner.java:460)
> > >     at
> > >
> >
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> > TestRu
> > > nner.java:673)
> > >     at
> > >
> >
> >
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> > > java:386)
> > >     at
> > >
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> > Runne
> > > r.java:196)
> > >
> > >
> > >
> > > --
> > > *
> > > *twitter.com/loujianwen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
> 
> 
> --
> *
> *twitter.com/loujianwen


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


Mime
View raw message