ICIJ / datashare

A self-hosted search engine for documents.
https://datashare.icij.org
GNU Affero General Public License v3.0
596 stars 53 forks source link

[Java] Injector problem - No enum constant #1338

Closed naga-re closed 8 months ago

naga-re commented 8 months ago

Describe the bug After installing Datashare on Mac, unable to launch it, errors appear in Terminal.

To Reproduce

Last login: Sat Feb 24 10:15:42 on ttys000USER@MBP-de-USER ~ % /Applications/Datashare.app/Contents/MacOS/Datashare.command ; 
exit;Using Java at /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javaJava HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "org.icij.datashare.DynamicClassLoader"). 
To use archived non-system classes, this property must not be set2024-02-24 10:16:38,808 [main] INFO  Main - Running datashare web server2024-02-24 10:16:38,810 [main] INFO  Main - JVM version 17.0.102024-02-24 10:16:38,810 [main] INFO  Main - JVM charset encoding UTF-82024-02-24 10:16:38,811 [main] INFO  Main - Log level set to INFO2024-02-24 10:16:38,814 [main] INFO  PropertiesProvider - reading properties from /Users/USER/Library/Datashare/dist/datashare.conf2024-02-24 10:16:38,818 [main] INFO  PropertiesProvider - adding properties from env vars {}2024-02-24 10:16:38,818 [main] INFO  PropertiesProvider - properties set to {parserParallelism=1, cors=no-cors, dataDir=/Users/USER/Datashare, parallelism=16, scrollSlices=1, elasticsearchDataPath=/Users/USER/Library/Datashare/index, elasticsearchAddress=http://localhost:9200, protectedUriPrefix=/api/, redisPoolSize=1, mode=EMBEDDED, clusterName=datashare, nlpParallelism=1, defaultProject=local-datashare, busType=memory, scrollSize=1000, ocr=true, settings=./dist/datashare.conf, messageBusAddress=redis://redis:6379, dataSourceUrl=jdbc:sqlite:file:/Users/USER/Library/Datashare/dist/datashare.db, defaultUserName=local, extensionsDir=/Users/USER/Library/datashare/extensions, batchDownloadMaxNbFiles=10000, tcpListenPort=8080, queueName=extract:queue, redisAddress=redis://redis:6379, pluginsDir=/Users/USER/Library/datashare/plugins, batchDownloadTimeToLive=24, queueType=memory, browserOpenLink=true, batchDownloadMaxSize=100M, sessionTtlSeconds=43200}2024-02-24 10:16:38,819 [main] INFO  PropertiesProvider - merged properties (without override) with {charset=UTF-8, parserParallelism=1, batchDownloadDir=/Users/USER/Library/Datashare/app/tmp, cors=no-cors, dataDir=/Users/USER/Datashare, parallelism=16, batchQueueType=MEMORY, scrollSlices=1, elasticsearchDataPath=/Users/USER/Library/Datashare/index, elasticsearchAddress=http://elasticsearch:9200, protectedUriPrefix=/api/, redisPoolSize=5, mode=EMBEDDED, digestProjectName=local-datashare, logLevel=INFO, clusterName=datashare, nlpParallelism=1, busType=MEMORY, defaultProject=local-datashare, noDigestProject=false, scrollSize=1000, ocr=true, embeddedDocumentDownloadMaxSize=1G, settings=/Users/USER/Library/Datashare/dist/datashare.conf, messageBusAddress=redis://redis:6379, dataSourceUrl=jdbc:sqlite:file:/Users/USER/Library/Datashare/dist/datashare.db, defaultUserName=local, extensionsDir=/Users/USER/Library/Datashare/extensions, batchDownloadMaxNbFiles=10000, digestAlgorithm=SHA-384, nlpPipeline=CORENLP, tcpListenPort=8080, sessionStoreType=MEMORY, queueName=extract:queue, batchDownloadTimeToLive=24, pluginsDir=/Users/USER/Library/Datashare/plugins, redisAddress=redis://redis:6379, queueType=MEMORY, browserOpenLink=true, batchDownloadMaxSize=100M, sessionTtlSeconds=43200}2024-02-24 10:16:39,011 [main] INFO  Node - version[7.17.9], pid[3046], build[unknown/unknown/unknown/unknown], OS[Mac OS X/13.1/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/17.0.10/17.0.10+11-LTS-240]2024-02-24 10:16:39,012 [main] INFO  Node - JVM home [/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home]2024-02-24 10:16:39,014 [main] WARN  Node - no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release2024-02-24 10:16:39,015 [main] INFO  Node - JVM arguments [--add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.util=ALL-UNNAMED, -DPROD_MODE=true, -Dfile.encoding=UTF-8, -Djava.system.class.loader=org.icij.datashare.DynamicClassLoader, -Djava.net.preferIPv4Stack=true, -Xmx32768m]2024-02-24 10:16:39,113 [main] INFO  PluginsService - no modules loaded2024-02-24 10:16:39,114 [main] INFO  PluginsService - loaded plugin [org.elasticsearch.analysis.common.CommonAnalysisPlugin]2024-02-24 10:16:39,114 [main] INFO  PluginsService - loaded plugin [org.elasticsearch.join.ParentJoinPlugin]2024-02-24 10:16:39,114 [main] INFO  PluginsService - loaded plugin [org.elasticsearch.painless.PainlessPlugin]2024-02-24 10:16:39,114 [main] INFO  PluginsService - loaded plugin [org.elasticsearch.reindex.ReindexPlugin]2024-02-24 10:16:39,114 [main] INFO  PluginsService - loaded plugin [org.elasticsearch.transport.Netty4Plugin]2024-02-24 10:16:39,142 [main] INFO  NodeEnvironment - using [1] data paths, mounts [[/System/Volumes/Data (/dev/disk1s2)]], net usable_space [859.8gb], net total_space [1.8tb], types [apfs]2024-02-24 10:16:39,143 [main] INFO  NodeEnvironment - heap size [32gb], compressed ordinary object pointers [false]2024-02-24 10:16:39,225 [main] INFO  Node - node name [datashare], node ID [wU_m22BxQMmUCdiUScwqEQ], cluster name [datashare], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]2024-02-24 10:16:41,449 [main] INFO  NettyAllocator - creating NettyAllocator with the following configs: [name=elasticsearch_configured, chunk_size=1mb, suggested_max_allocation_size=1mb, factors={es.unsafe.use_netty_default_chunk_and_page_size=false, g1gc_enabled=true, g1gc_region_size=16mb}]2024-02-24 10:16:41,477 [main] INFO  RecoverySettings - using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]2024-02-24 10:16:41,513 [main] INFO  DiscoveryModule - using discovery type [zen] and seed hosts providers [settings]2024-02-24 10:16:41,752 [main] INFO  DanglingIndicesState - gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually2024-02-24 10:16:41,871 [main] INFO  Node - initialized2024-02-24 10:16:41,871 [main] INFO  Node - starting ...2024-02-24 10:16:41,955 [main] INFO  TransportService - publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}2024-02-24 10:16:42,228 [main] INFO  Coordinator - cluster UUID [XsBzF8PTR0uWe39mTSiSVA]2024-02-24 10:16:42,236 [main] INFO  ClusterBootstrapService - no discovery configuration found, will perform best-effort cluster bootstrapping after [3s] unless existing master is discovered2024-02-24 10:16:42,369 [elasticsearch[datashare][masterService#updateTask][T#1]] INFO  MasterService - elected-as-master ([1] nodes joined)[{datashare}{wU_m22BxQMmUCdiUScwqEQ}{N6po_E-fTX62SM6xrL0KSw}{127.0.0.1}{127.0.0.1:9300}{cdfhimrsw} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 6, version: 11, delta: master node changed {previous [], current [{datashare}{wU_m22BxQMmUCdiUScwqEQ}{N6po_E-fTX62SM6xrL0KSw}{127.0.0.1}{127.0.0.1:9300}{cdfhimrsw}]}2024-02-24 10:16:42,462 [elasticsearch[datashare][clusterApplierService#updateTask][T#1]] INFO  ClusterApplierService - master node changed {previous [], current [{datashare}{wU_m22BxQMmUCdiUScwqEQ}{N6po_E-fTX62SM6xrL0KSw}{127.0.0.1}{127.0.0.1:9300}{cdfhimrsw}]}, term: 6, version: 11, reason: Publication{term=6, version=11}2024-02-24 10:16:42,485 [main] INFO  AbstractHttpServerTransport - publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}2024-02-24 10:16:42,485 [main] INFO  Node - started2024-02-24 10:16:42,485 [main] INFO  PropertiesProvider - overriding properties with {elasticsearchAddress=http://localhost:9200}2024-02-24 10:16:42,554 [elasticsearch[datashare][masterService#updateTask][T#1]] INFO  GatewayService - recovered [0] indices into cluster_statefévr. 24, 2024 10:16:42 AM com.google.inject.internal.MessageProcessor visitINFO: An exception was caught and reported. Message: java.lang.IllegalArgumentException: No enum constant org.icij.datashare.cli.QueueType.memoryjava.lang.IllegalArgumentException: No enum constant org.icij.datashare.cli.QueueType.memory    at java.base/java.lang.Enum.valueOf(Enum.java:273)  at org.icij.datashare.cli.QueueType.valueOf(QueueType.java:3)   at org.icij.datashare.mode.CommonMode.configureIndexingQueues(CommonMode.java:182)  at org.icij.datashare.mode.CommonMode.configure(CommonMode.java:177)    at org.icij.datashare.mode.LocalMode.configure(LocalMode.java:18)   at org.icij.datashare.mode.EmbeddedMode.configure(EmbeddedMode.java:20) at com.google.inject.AbstractModule.configure(AbstractModule.java:62)   at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)    at com.google.inject.spi.Elements.getElements(Elements.java:110)    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)   at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)   at com.google.inject.Guice.createInjector(Guice.java:99)    at com.google.inject.Guice.createInjector(Guice.java:73)    at com.google.inject.Guice.createInjector(Guice.java:62)    at org.icij.datashare.mode.CommonMode.<init>(CommonMode.java:91)    at org.icij.datashare.mode.LocalMode.<init>(LocalMode.java:13)  at org.icij.datashare.mode.EmbeddedMode.<init>(EmbeddedMode.java:10)    at org.icij.datashare.mode.CommonMode.create(CommonMode.java:113)   at org.icij.datashare.WebApp.start(WebApp.java:42)  
at org.icij.datashare.Main.main(Main.java:25)
2024-02-24 10:16:42,966 [main] ERROR EmbeddedMode - cannot create injector: [An exception was caught and reported. Message: No enum constant org.icij.datashare.cli.QueueType.memory]
2024-02-24 10:16:42,966 [main] ERROR EmbeddedMode - exception: com.google.inject.CreationException: Unable to create injector, see the following errors:
1) An exception was caught and reported. Message: No enum constant org.icij.datashare.cli.QueueType.memory  
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
1 error at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)   
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)    
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)   
at com.google.inject.Guice.createInjector(Guice.java:99)    
at com.google.inject.Guice.createInjector(Guice.java:73)    
at com.google.inject.Guice.createInjector(Guice.java:62)    
at org.icij.datashare.mode.CommonMode.<init>(CommonMode.java:91)    
at org.icij.datashare.mode.LocalMode.<init>(LocalMode.java:13)  
at org.icij.datashare.mode.EmbeddedMode.<init>(EmbeddedMode.java:10)    
at org.icij.datashare.mode.CommonMode.create(CommonMode.java:113)   
at org.icij.datashare.WebApp.start(WebApp.java:42)  
at org.icij.datashare.Main.main(Main.java:25)Caused by: java.lang.IllegalArgumentException: No enum constant org.icij.datashare.cli.QueueType.memory    
at java.base/java.lang.Enum.valueOf(Enum.java:273)  at org.icij.datashare.cli.QueueType.valueOf(QueueType.java:3)   
at org.icij.datashare.mode.CommonMode.configureIndexingQueues(CommonMode.java:182)  
at org.icij.datashare.mode.CommonMode.configure(CommonMode.java:177)    
at org.icij.datashare.mode.LocalMode.configure(LocalMode.java:18)   
at org.icij.datashare.mode.EmbeddedMode.configure(EmbeddedMode.java:20) 
at com.google.inject.AbstractModule.configure(AbstractModule.java:62)   
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)    
at com.google.inject.spi.Elements.getElements(Elements.java:110)    
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)   
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)   
... 9 common frames omittedException in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:
1) An exception was caught and reported. Message: No enum constant org.icij.datashare.cli.QueueType.memory  
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
1 error at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)   
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)    
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)   
at com.google.inject.Guice.createInjector(Guice.java:99)    
at com.google.inject.Guice.createInjector(Guice.java:73)    
at com.google.inject.Guice.createInjector(Guice.java:62)    
at org.icij.datashare.mode.CommonMode.<init>(CommonMode.java:91)    
at org.icij.datashare.mode.LocalMode.<init>(LocalMode.java:13)  
at org.icij.datashare.mode.EmbeddedMode.<init>(EmbeddedMode.java:10)    
at org.icij.datashare.mode.CommonMode.create(CommonMode.java:113)   
at org.icij.datashare.WebApp.start(WebApp.java:42)  
at org.icij.datashare.Main.main(Main.java:25)Caused by: java.lang.IllegalArgumentException: No enum constant org.icij.datashare.cli.QueueType.memory    
at java.base/java.lang.Enum.valueOf(Enum.java:273)  
at org.icij.datashare.cli.QueueType.valueOf(QueueType.java:3)   
at org.icij.datashare.mode.CommonMode.configureIndexingQueues(CommonMode.java:182)  
at org.icij.datashare.mode.CommonMode.configure(CommonMode.java:177)    
at org.icij.datashare.mode.LocalMode.configure(LocalMode.java:18)   
at org.icij.datashare.mode.EmbeddedMode.configure(EmbeddedMode.java:20) 
at com.google.inject.AbstractModule.configure(AbstractModule.java:62)   
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)    
at com.google.inject.spi.Elements.getElements(Elements.java:110)    
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)   
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)   
... 9 more

Desktop:

pirhoo commented 8 months ago

Hello, thanks for reporting the issue, we are on it!

pirhoo commented 8 months ago

@naga-re did you use Datashare already on the same laptop where you had the error (before 14.0.x)?

naga-re commented 8 months ago

@naga-re did you use Datashare already on the same laptop where you had the error (before 14.0.x)?

It's very plausible that a previous version (before the 14.x.x branch) was installed, one day, on this machine, according to the owner of the Mac (I speak on behalf of the person who has this problem and who's not on GitHub)

pirhoo commented 8 months ago

It looks like there is a conflicts with the previous and new launcher. Something might have gone wrong when uninstalling the previous version.

Could you show us the content of /Applications/Datashare.app/Contents/MacOS/Datashare.command?

If you can't, I believe uninstalling/installing Datashare should solve your issue. Please note we are about to release a new version (14.1.3) which fix a compatibility problem on Apple Silicon Macs.

naga-re commented 8 months ago

Ok.

Here's the content of the file Datashare.command :

#!/bin/bash

# Get the path to the PID file
pid_file="/tmp/datashare.pid"
pid=$(cat $pid_file 2>/dev/null)
# Collect Datashare conviguration env
datashare_version="13.1.2"
datashare_data_path="/Users/${USER}/Datashare"
datashare_index_path="/Users/${USER}/Library/Datashare/index"
datashare_plugins_path="/Users/${USER}/Library/datashare/plugins"
datashare_extensions_path="/Users/${USER}/Library/datashare/extensions"
# Java binary to use to start Datashare
jre_version=11
java_bin="$(/usr/libexec/java_home -F -v $jre_version)/bin/java"

function on_exit_remove_pid_file {
    rm -f $pid_file
}

function save_pid {
    echo $$ > "$pid_file"
}

function start_datashare {
    mkdir -p "${datashare_index_path}" "${datashare_plugins_path}" "${datashare_extensions_path}"

    if [[ -z "${DS_JAVA_OPTS}" ]]; then
        mem_allocated=$(sysctl -a | grep hw.memsize | awk '{print $2"/(2*1024^2)"}' | bc)
        DS_JAVA_OPTS="-Xmx${mem_allocated}m"
    fi

    cd "/Users/${USER}/Library/Datashare" || exit # needed for /dist

    $java_bin \
        --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED \
        -DPROD_MODE=true \
        -Dfile.encoding=UTF-8 \
        -Djava.system.class.loader=org.icij.datashare.DynamicClassLoader \
        -cp "./dist:/Applications/Datashare.app/Contents/Resources/datashare-dist-${datashare_version}-all.jar" org.icij.datashare.Main \
        --dataDir "$datashare_data_path" \
        --queueType MEMORY \
        --busType MEMORY \
        --dataSourceUrl jdbc:sqlite:file:"/Users/${USER}/Library/Datashare/dist/datashare.db" \
        --settings ./dist/datashare.conf \
        --mode EMBEDDED \
        --browserOpenLink true \
        --elasticsearchDataPath "$datashare_index_path" \
        --pluginsDir "${datashare_plugins_path}" \
        --extensionsDir "${datashare_extensions_path}"
}

# Ensure the PID file is removed when the script exits
trap on_exit_remove_pid_file EXIT

# Check if the PID file exists and is already running
if [ -f "$pid_file" ] && kill -0 $pid > /dev/null 2>&1
then
    echo "Datashare is already running (PID: $pid)" 
else
    # If the PID file does not exist, store its PID in the PID file
    save_pid
    # Finally, start Datashare
    start_datashare
fi

I also advised my friend to properly and completely uninstall Datashare and its dependencies before attempting to reinstall the App

And it's noted for the next update. ;)

Thanks !

pirhoo commented 8 months ago

The launcher is indeed for 13.1.2 which is not compatible with Datashare 14 and higher. Very strange that it did not get overridden by the installer!

I'm closing this issue for now but let us know if the problem is still persists.

naga-re commented 8 months ago

Update :

Completely uninstalling the application and its dependencies and reinstalling Datashare worked. ! Thanks again to the person who was affected by this problem.