TheHive-Project / TheHiveDocs

Documentation of TheHive
https://docs.strangebee.com/
GNU Affero General Public License v3.0
393 stars 280 forks source link

Error when migrating to TheHive4 #176

Open ksamag opened 4 years ago

ksamag commented 4 years ago

Hi,

I started a kubernetes pod with the docker image thehiveproject/thehive4 and run the following in its command line:

/usr/bin/env bash /opt/thehive/bin/migrate \
--output /etc/thehive/application.conf \
--main-organisation MyOrg \
--es-uri http://elasticsearch:9200/

But it gives the following error to me:

[info] a.r.a.t.ArteryTcpTransport - Remoting started with transport [Artery tcp]; listening on address [akka://TheHiveMigration@127.0.0.1:45201] with UID [2321852244682779330]
[info] a.c.Cluster - Cluster Node [akka://TheHiveMigration@127.0.0.1:45201] - Starting up, Akka version [2.6.3] ...
[info] a.c.Cluster - Cluster Node [akka://TheHiveMigration@127.0.0.1:45201] - Registered cluster JMX MBean [akka:type=Cluster]
[info] a.c.Cluster - Cluster Node [akka://TheHiveMigration@127.0.0.1:45201] - Started up successfully
[info] a.c.Cluster - Cluster Node [akka://TheHiveMigration@127.0.0.1:45201] - No downing-provider-class configured, manual cluster downing required, see https://doc.akka.io/docs/akka/current/typed/cluster.html#downing
[info] a.c.Cluster - Cluster Node [akka://TheHiveMigration@127.0.0.1:45201] - No seed-nodes configured, manual cluster join required, see https://doc.akka.io/docs/akka/current/typed/cluster.html#joining

[info] c.s.e.h.ElasticClient$ - Creating HTTP client on http://elasticsearch:9200
[info] o.r.Reflections - Reflections took 2083 ms to scan 1 urls, producing 133 keys and 2115 values
Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Error injecting constructor, java.lang.IllegalArgumentException: Could not find implementation class: org.janusgraph.diskstorage.inmemory.InMemoryStoreManager
  at org.thp.scalligraph.janus.JanusDatabase.<init>(JanusDatabase.scala:68)
  at org.thp.scalligraph.janus.JanusDatabase.class(JanusDatabase.scala:53)
  while locating org.thp.scalligraph.janus.JanusDatabase
  while locating org.thp.scalligraph.models.Database
    for the 2nd parameter of org.thp.thehive.models.SchemaUpdater.<init>(SchemaUpdater.scala:17)
  at org.thp.thehive.migration.th4.Output$$anon$1.configure(Output.scala:97)
  while locating org.thp.thehive.models.SchemaUpdater
Caused by: java.lang.IllegalArgumentException: Could not find implementation class: org.janusgraph.diskstorage.inmemory.InMemoryStoreManager
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:60)
    at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:440)
    at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:411)
    at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:50)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:161)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:132)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:112)
    at org.thp.scalligraph.janus.JanusDatabase$.openDatabase(JanusDatabase.scala:48)
    at org.thp.scalligraph.janus.JanusDatabase.<init>(JanusDatabase.scala:69)
    at org.thp.scalligraph.janus.JanusDatabase$$FastClassByGuice$$113881e3.newInstance(<generated>)
    at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:211)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:182)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
    at com.google.inject.Guice.createInjector(Guice.java:87)
    at com.google.inject.Guice.createInjector(Guice.java:69)
    at org.thp.thehive.migration.th4.Output$.buildApp(Output.scala:68)
    at org.thp.thehive.migration.th4.Output$.apply(Output.scala:108)
    at org.thp.thehive.migration.Migrate$.$anonfun$new$1(Migrate.scala:90)
    at org.thp.thehive.migration.Migrate$.$anonfun$new$1$adapted(Migrate.scala:82)
    at scala.Option.foreach(Option.scala:407)
    at org.thp.thehive.migration.Migrate$.delayedEndpoint$org$thp$thehive$migration$Migrate$1(Migrate.scala:82)
    at org.thp.thehive.migration.Migrate$delayedInit$body.apply(Migrate.scala:17)
    at scala.Function0.apply$mcV$sp(Function0.scala:39)
    at scala.Function0.apply$mcV$sp$(Function0.scala:39)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
    at scala.App.$anonfun$main$1$adapted(App.scala:80)
    at scala.collection.immutable.List.foreach(List.scala:392)
    at scala.App.main(App.scala:80)
    at scala.App.main$(App.scala:78)
    at org.thp.thehive.migration.Migrate$.main(Migrate.scala:17)
    at org.thp.thehive.migration.Migrate.main(Migrate.scala)
Caused by: java.lang.ClassNotFoundException: org.janusgraph.diskstorage.inmemory.InMemoryStoreManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:56)
    ... 46 more

2) Error injecting constructor, java.lang.IllegalArgumentException: Could not find implementation class: org.janusgraph.diskstorage.inmemory.InMemoryStoreManager
  at org.thp.scalligraph.janus.JanusDatabase.<init>(JanusDatabase.scala:68)
  at org.thp.scalligraph.janus.JanusDatabase.class(JanusDatabase.scala:53)
  while locating org.thp.scalligraph.janus.JanusDatabase
  while locating org.thp.scalligraph.models.Database
    for the 2nd parameter of org.thp.thehive.models.SchemaUpdater.<init>(SchemaUpdater.scala:17)
  at org.thp.thehive.migration.th4.Output$$anon$1.configure(Output.scala:97)
  while locating org.thp.thehive.models.SchemaUpdater
    for the 1st parameter of org.thp.thehive.connector.cortex.models.SchemaUpdater.<init>(SchemaUpdater.scala:20)
  at org.thp.thehive.migration.th4.Output$$anon$1.configure(Output.scala:98)
  while locating org.thp.thehive.connector.cortex.models.SchemaUpdater
Caused by: java.lang.IllegalArgumentException: Could not find implementation class: org.janusgraph.diskstorage.inmemory.InMemoryStoreManager
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:60)
    at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:440)
    at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:411)
    at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:50)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:161)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:132)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:112)
    at org.thp.scalligraph.janus.JanusDatabase$.openDatabase(JanusDatabase.scala:48)
    at org.thp.scalligraph.janus.JanusDatabase.<init>(JanusDatabase.scala:69)
    at org.thp.scalligraph.janus.JanusDatabase$$FastClassByGuice$$113881e3.newInstance(<generated>)
    at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:211)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:182)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
    at com.google.inject.Guice.createInjector(Guice.java:87)
    at com.google.inject.Guice.createInjector(Guice.java:69)
    at org.thp.thehive.migration.th4.Output$.buildApp(Output.scala:68)
    at org.thp.thehive.migration.th4.Output$.apply(Output.scala:108)
    at org.thp.thehive.migration.Migrate$.$anonfun$new$1(Migrate.scala:90)
    at org.thp.thehive.migration.Migrate$.$anonfun$new$1$adapted(Migrate.scala:82)
    at scala.Option.foreach(Option.scala:407)
    at org.thp.thehive.migration.Migrate$.delayedEndpoint$org$thp$thehive$migration$Migrate$1(Migrate.scala:82)
    at org.thp.thehive.migration.Migrate$delayedInit$body.apply(Migrate.scala:17)
    at scala.Function0.apply$mcV$sp(Function0.scala:39)
    at scala.Function0.apply$mcV$sp$(Function0.scala:39)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
    at scala.App.$anonfun$main$1$adapted(App.scala:80)
    at scala.collection.immutable.List.foreach(List.scala:392)
    at scala.App.main(App.scala:80)
    at scala.App.main$(App.scala:78)
    at org.thp.thehive.migration.Migrate$.main(Migrate.scala:17)
    at org.thp.thehive.migration.Migrate.main(Migrate.scala)
Caused by: java.lang.ClassNotFoundException: org.janusgraph.diskstorage.inmemory.InMemoryStoreManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:56)
    ... 54 more

2 errors
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:543)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
    at com.google.inject.Guice.createInjector(Guice.java:87)
    at com.google.inject.Guice.createInjector(Guice.java:69)
    at org.thp.thehive.migration.th4.Output$.buildApp(Output.scala:68)
    at org.thp.thehive.migration.th4.Output$.apply(Output.scala:108)
    at org.thp.thehive.migration.Migrate$.$anonfun$new$1(Migrate.scala:90)
    at org.thp.thehive.migration.Migrate$.$anonfun$new$1$adapted(Migrate.scala:82)
    at scala.Option.foreach(Option.scala:407)
    at org.thp.thehive.migration.Migrate$.delayedEndpoint$org$thp$thehive$migration$Migrate$1(Migrate.scala:82)
    at org.thp.thehive.migration.Migrate$delayedInit$body.apply(Migrate.scala:17)
    at scala.Function0.apply$mcV$sp(Function0.scala:39)
    at scala.Function0.apply$mcV$sp$(Function0.scala:39)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
    at scala.App.$anonfun$main$1$adapted(App.scala:80)
    at scala.collection.immutable.List.foreach(List.scala:392)
    at scala.App.main(App.scala:80)
    at scala.App.main$(App.scala:78)
    at org.thp.thehive.migration.Migrate$.main(Migrate.scala:17)
    at org.thp.thehive.migration.Migrate.main(Migrate.scala)

After that, the running process still does not exit and I don't know whether it's working or not. Any ideas on that?

jaredjennings commented 4 years ago

"Could not find implementation class: org.janusgraph.diskstorage.inmemory.InMemoryStoreManager"

Perhaps you are missing a classpath entry?

EDITED TO ADD: This comment is probably not helpful at all. The classpath used would be built into the executable being run, not specified by the user.

n3wb1 commented 4 years ago

I'm having the same issue. Has this been resolved?

milesflo commented 4 years ago

I'm having the same issue

0cta commented 4 years ago

Same exact error message here. (Env: RHEL 7.3, TheHive 4.0.0-1, java-1.8.0-openjdk) No luck in getting the migration to work.

xme commented 3 years ago

Hello, a newcomer in this discussion... I'm facing the exact same situation... TH4 started (everything in docker). I can use it, but the migration script does not work... :(

bangejsans commented 3 years ago

I am in the same boat.

jhalstead3 commented 2 years ago

I ran with elevated privileges (sudo) and it worked after getting this error. I'm assuming the error comes up because a regular user doesn't have permissions to the config files.