java.lang.NumberFormatException: For input string


#1

Project running failed.

hibernate.version : 5.2.8.Final
hibernate-search-orm : 5.8.2.Final
lucene.version : 5.5.5

StackTrace:

Caused by: org.hibernate.search.exception.SearchException: HSEARCH000103: Unable to initialize IndexManager named 'package.entity.MyEntity'
	at org.hibernate.search.indexes.impl.IndexManagerGroupHolder.doCreateIndexManager(IndexManagerGroupHolder.java:197)
	at org.hibernate.search.indexes.impl.IndexManagerGroupHolder.getOrCreateIndexManager(IndexManagerGroupHolder.java:154)
	at org.hibernate.search.indexes.impl.NotShardedEntityIndexBinder.bind(NotShardedEntityIndexBinder.java:34)
	at org.hibernate.search.indexes.impl.IndexManagerGroupHolder.bind(IndexManagerGroupHolder.java:99)
	at org.hibernate.search.indexes.impl.IndexManagerHolder.buildEntityIndexBinding(IndexManagerHolder.java:99)
	at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:427)
	at org.hibernate.search.spi.SearchIntegratorBuilder.createNewFactoryState(SearchIntegratorBuilder.java:243)
	at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199)
	at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:127)
	at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.boot(HibernateSearchSessionFactoryObserver.java:113)
	at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:79)
	at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:366)
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
	... 236 more
Caused by: java.lang.NumberFormatException: For input string: "13o.gz"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Long.parseLong(Long.java:589)
	at org.apache.lucene.index.SegmentInfos.generationFromSegmentsFileName(SegmentInfos.java:260)
	at org.apache.lucene.index.SegmentInfos.getLastCommitGeneration(SegmentInfos.java:199)
	at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:719)
	at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:50)
	at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:63)
	at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.readerFactory(SharingBufferReaderProvider.java:131)
	at org.hibernate.search.indexes.impl.SharingBufferReaderProvider$PerDirectoryLatestReader.<init>(SharingBufferReaderProvider.java:206)
	at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.createReader(SharingBufferReaderProvider.java:108)
	at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.initialize(SharingBufferReaderProvider.java:91)
	at org.hibernate.search.indexes.impl.PropertiesParseHelper.createDirectoryBasedReaderProvider(PropertiesParseHelper.java:175)
	at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.createIndexReader(DirectoryBasedIndexManager.java:222)
	at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:93)
	at org.hibernate.search.indexes.impl.IndexManagerGroupHolder.doCreateIndexManager(IndexManagerGroupHolder.java:194)
	... 250 more

26-Sep-2018 09:33:57.944 INFO [http-nio-80-exec-30] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext

Try with luke:

Invalid directory at the location, check console for more information. Last exception:
java.lang.NumberFormatException: For input string: "13o.gz"

#2

If even Luke cannot open your index, it’s likely corrupted. You probably did something wrong. But since you don’t provide details about what you did, I can’t tell you what.


#3

I checked index files, yes index corrupted by OS operation.