Artifactory could not be initialized
I was playing a bit with JFrog's Artifactory 6.10 (Open Source edition, debian package) and after rebooting the server it's installed on, the website was greeting me with a nice JSON message:
{
"errors" : [ {
"status" : 500,
"message" : "Artifactory failed to initialize: check Artifactory logs for errors."
} ]
}
In the logs (/var/opt/jfrog/artifactory/logs/artifactory.log
) I found:
2019-06-03 09:57:05,074 [art-init] [ERROR] (o.a.w.s.ArtifactoryContextConfigListener:96) - Application could not be initialized: No content to map due to end-of-input
at [Source: (byte[])""; line: 1, column: 0]
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.configure(ArtifactoryContextConfigListener.java:211)
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.access$200(ArtifactoryContextConfigListener.java:67)
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener$1.run(ArtifactoryContextConfigListener.java:92)
Caused by: org.jfrog.common.JsonParsingException: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
at [Source: (byte[])""; line: 1, column: 0]
at org.jfrog.common.MapperUtilsBase.unchecked(MapperUtilsBase.java:233)
at org.jfrog.common.MapperUtilsBase.readValue(MapperUtilsBase.java:203)
at org.jfrog.common.JsonUtils.readValue(JsonUtils.java:27)
at org.artifactory.storage.db.migration.service.MigrationStatusStorageServiceImpl.findMigrationByIdWithInfoBlob(MigrationStatusStorageServiceImpl.java:56)
at org.artifactory.metadata.service.MetadataMigrationHelper.getMigrationStatus(MetadataMigrationHelper.java:194)
at org.artifactory.metadata.service.MetadataMigrationHelper.shouldMigrate(MetadataMigrationHelper.java:65)
at org.artifactory.metadata.service.MetadataMigrationHelper.migrateOrStartEventPipe(MetadataMigrationHelper.java:52)
at org.artifactory.metadata.service.MetadataEventServiceImpl.onContextCreated(MetadataEventServiceImpl.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
at com.sun.proxy.$Proxy240.onContextCreated(Unknown Source)
at org.artifactory.spring.ArtifactoryApplicationContext.contextCreated(ArtifactoryApplicationContext.java:285)
at org.artifactory.spring.ArtifactoryApplicationContext.<init>(ArtifactoryApplicationContext.java:146)
... 7 common frames omitted
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
at [Source: (byte[])""; line: 1, column: 0]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4133)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3988)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3079)
at org.jfrog.common.MapperUtilsBase.lambda$readValue$14(MapperUtilsBase.java:203)
at org.jfrog.common.MapperUtilsBase.unchecked(MapperUtilsBase.java:231)
... 23 common frames omitted
So I downloaded Artifactory's source code to have a look and it seems that some kind of migration information retrieved from the database in the migration_status
table was empty. Artifactory's default installation uses Apache Derby 10.14 as database, could be interesting to see what's in the migration_status
table:
turn off artifactory:
sudo service artifactory stop
download Apache Derby 10.14:
$ cd /tmp $ wget http://mirrors.ircam.fr/pub/apache//db/derby/db-derby-10.14.2.0/db-derby-10.14.2.0-bin.tar.gz
check the MD5 hash against the official MD5:
md5sum db-derby-10.14.2.0-bin.tar.gz
prepare Derby to be used:
$ tar -xvzf db-derby-10.14.2.0-bin.tar.gz $ export DERBY_HOME="/tmp/db-derby-10.14.2.0-bin" $ export PATH="$DERBY_HOME/bin:$PATH"
look into the database with Derby's command line tool
ij
:$ cd /var/opt/jfrog/artifactory/data $ sudo ij > connect 'jdbc:derby:derby'; > select * from migration_status; IDENTIFIER |STARTED |FINISHED |MIGRATION_INFO_BLOB ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- metadata-service-migration |1557483350162 |1557483350162 | 1 row selected
the
migration_info_blob
is empty and given that there's only one row in this table, it's probably the culprit, let's try deleting it and restart Artifactory:> delete from migration_status where identifier = 'metadata-service-migration'; > exit; $ sudo rm derby.log $ sudo service artifactory start $ sudo tail -f /var/opt/jfrog/artifactory/logs/artifactory.log (…) ########################################################### ### Artifactory successfully started (16.622 seconds) ### ###########################################################
On the website everything was back to normal 👍.
Comments Add one by sending me an email.
Hi Matthew,
Thank you for your comment, I'm glad to hear that this post was useful to you and that you didn't have to spend the same amount of time as me on that issue 😉.
Laurent.