Rafael Uchoa
Rafael Uchoa

Reputation: 115

Artifactory failed to initialize: Context is null

I have tried running artifactory 6.1.0 locally from my mac.

Running with

$ARTIFACTORY_HOME/bin/artifactoryctl start

and then

$ARTIFACTORY_HOME/bin/artifactoryctl check

tells me that artifactory is running normally, but the webpage won't even load.
Running with

$ARTIFACTORY_HOME/bin/artifactory.sh 

let's me load the webpage, but I get the following:

{
  "errors" : [ {
    "status" : 500,
    "message" : "Artifactory failed to initialize: check Artifactory logs for errors."
  } ]
}

Here are the last few sections of the logs:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer]: Factory method 'resourceConfigCustomizer' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 71 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
    at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:139)
    at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:126)
    at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$ObjectMapperCustomizer.addJaxbAnnotationIntrospector(JerseyAutoConfiguration.java:266)
    at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$ObjectMapperCustomizer.access$200(JerseyAutoConfiguration.java:262)
    at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer.addJaxbAnnotationIntrospectorIfPresent(JerseyAutoConfiguration.java:258)
    at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer.resourceConfigCustomizer(JerseyAutoConfiguration.java:244)
    at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$$EnhancerBySpringCGLIB$$13b0b2f2.CGLIB$resourceConfigCustomizer$0(<generated>)
    at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$$EnhancerBySpringCGLIB$$13b0b2f2$$FastClassBySpringCGLIB$$6acbd0b2.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$$EnhancerBySpringCGLIB$$13b0b2f2.resourceConfigCustomizer(<generated>)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 72 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlElement
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1291)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
    ... 88 more

Jul 27, 2018 6:07:39 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor [/Users/pairprogramming/artifactory-oss-6.1.0/tomcat/conf/Catalina/localhost/access.xml]
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/access]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1842)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.base/java.lang.Thread.run(Thread.java:844)

Jul 27, 2018 6:07:39 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deployment of configuration descriptor [/Users/pairprogramming/artifactory-oss-6.1.0/tomcat/conf/Catalina/localhost/access.xml] has finished in [25,971] ms
Jul 27, 2018 6:07:39 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [/Users/pairprogramming/artifactory-oss-6.1.0/tomcat/webapps/ROOT]
Jul 27, 2018 6:07:39 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [/Users/pairprogramming/artifactory-oss-6.1.0/tomcat/webapps/ROOT] has finished in [29] ms
Jul 27, 2018 6:07:39 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8081"]
Jul 27, 2018 6:07:39 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8040"]
Jul 27, 2018 6:07:39 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8019"]
2018-07-27 18:07:40,165 [http-nio-8081-exec-1] [ERROR] (o.a.w.s.ArtifactoryFilter:218) - Artifactory failed to initialize: Context is null

Upvotes: 0

Views: 8702

Answers (2)

Shree Prakash
Shree Prakash

Reputation: 2314

I faced same issue when I was trying to change db to postgres for artifactory metadata and I fixed as shown below

Platform Ubuntu

$ sudo su

$ cd /var/opt/jfrog/artifactory/tomcat/lib

$ wget https://jdbc.postgresql.org/download/postgresql-9.4.1212.jre6.jar

Note:- you can choose jar version according to your postgres version

https://jdbc.postgresql.org/download.html#current

$ systemctl restart artifactory.service

Upvotes: 0

Ivan
Ivan

Reputation: 8758

Artifactory 6.1.0 is not compatible with Java 9/10. There is an open issue when running on Java 9 (https://www.jfrog.com/jira/browse/RTFACT-15061) which also provides some workaround to try start it. According to your error message adding --add-modules java.xml.bind to start script for Artifactory may resolve your particular issue.

Also System requirements page recommends Java 8 https://www.jfrog.com/confluence/display/RTF/System+Requirements

You must run Artifactory with JDK 8, preferably JDK 8 update 45 and above

Upvotes: 2

Related Questions