Reputation: 319
We had tomcat running just artifactory.war and it was all working great and we were using Active Directory too. However, after upgrading the war(s) to version 5.4.6
it fails to load.
We did check if it has single repository types using the Python tool (https://github.com/JFrogDev/artifactory-scripts/blob/master/4.x-migration/packageCheck.py
). We use apache-tomcat-8.5.20
, jdk1.8.0_144
, and jfrog-artifactory-oss-5.4.6.zip
on Windows (7 and 2008 have the same outcome)
The Tomcat was modified to use proper %JDK_HOME%
and %ARTIFACTORY_HOME%
Also, <Host>
element was updated with startStopThreads="2"
in server.xml
.
The %TOMCAT_HOME%\lib
folder contains derby-10.11.1.1.jar
,
artifactory.war
and access.war
were copied to Tomcat's webapps
folder
When we started the Tomcat the migration happened and all the repos are converted without an error, the failure is:
artifactory.log
2017-09-25 17:04:09,772 [art-init] [INFO ] (o.a.s.a.ArtifactoryAccessClientConfigStore:472) - Using Access Server URL: http://localhost:8080/access (bundled) source: detected
2017-09-25 17:04:11,484 [art-init] [INFO ] (o.a.s.a.AccessServiceImpl:233) - Waiting for access server...
2017-09-25 17:04:21,406 [art-init] [INFO ] (o.a.s.a.AccessServiceImpl:243) - Got response from Access server after 9921 ms, continuing.
2017-09-25 17:04:21,636 [art-init] [WARN ] (o.j.a.c.AccessClientBootstrap:92) - Access admin credentials not found, using default admin credentials.
2017-09-25 17:04:21,985 [art-init] [ERROR] (o.a.w.s.ArtifactoryContextConfigListener:97) - Application could not be initialized: HTTP response status 401:{"errors":[{"code":"UNAUTHORIZED","detail":"Bad credentials","message":"HTTP 401 Unauthorized"}]}
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.configure(ArtifactoryContextConfigListener.java:222) ~[artifactory-web-application-5.4.6.jar:na]
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.access$2(ArtifactoryContextConfigListener.java:184) ~[artifactory-web-application-5.4.6.jar:na]
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener$1.run(ArtifactoryContextConfigListener.java:93) ~[artifactory-web-application-5.4.6.jar:na]
Caused by: org.springframework.beans.factory.BeanInitializationException: Failed to initialize bean 'org.artifactory.security.access.AccessService'.; nested exception is java.lang.RuntimeException: Failed to generate service admin token using bootstrap credentials.
at org.artifactory.spring.ArtifactoryApplicationContext.refresh(ArtifactoryApplicationContext.java:230) ~[artifactory-core-5.4.6.jar:na]
at org.artifactory.spring.ArtifactoryApplicationContext.<init>(ArtifactoryApplicationContext.java:114) ~[artifactory-core-5.4.6.jar:na]
... 7 common frames omitted
Caused by: java.lang.RuntimeException: Failed to generate service admin token using bootstrap credentials.
at org.jfrog.access.client.AccessClientBootstrap.createAndStoreServiceAdminToken(AccessClientBootstrap.java:110) ~[access-client-core-2.0.2.jar:na]
We reached to jFrog and Aaron from jFrog has suggested it might be because of this bug. https://www.jfrog.com/jira/browse/RTFACT-14839
So, we went ahead and deleted the admin
entry from access_users
table using embedded Derby JDBC driver from %HOME%/.jfrog-access/data/derby
as suggested. We also placed bootstrap.creds
file in the %HOME%/.jfrog-access/etc
.
bootstrap.creds
admin=plaintextadminpasswordhere
Later we also added 2 properties to artifactory.system.properties
artifactory.system.properties
artifactory.access.server.bundled=true
artifactory.access.client.serverUrl.override=http://localhost:8080/access
as suggested in related issue https://www.jfrog.com/jira/browse/RTFACT-14477 (although it seemed not to be the issue)
When we started one more time the bootstrap.creds
file got processed (it disappeared) and the new admin
entry was created in the access_users
table. Nevertheless, the outcome is almost exactly the same:
2017-09-25 18:25:42,689 [art-init] [INFO ] (o.a.s.a.ArtifactoryAccessClientConfigStore:472) - Using Access Server URL: http://localhost:8080/access (bundled) source: system property
2017-09-25 18:25:43,600 [art-init] [INFO ] (o.a.s.a.AccessServiceImpl:233) - Waiting for access server...
2017-09-25 18:25:54,667 [art-init] [INFO ] (o.a.s.a.AccessServiceImpl:243) - Got response from Access server after 11065 ms, continuing.
2017-09-25 18:25:55,434 [art-init] [WARN ] (o.j.a.c.AccessClientBootstrap:92) - Access admin credentials not found, using default admin credentials.
2017-09-25 18:25:55,980 [art-init] [ERROR] (o.a.w.s.ArtifactoryContextConfigListener:97) - Application could not be initialized: HTTP response status 401:{"errors":[{"code":"UNAUTHORIZED","detail":"Bad credentials","message":"HTTP 401 Unauthorized"}]}
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.configure(ArtifactoryContextConfigListener.java:222) ~[artifactory-web-application-5.4.6.jar:na]
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.access$2(ArtifactoryContextConfigListener.java:184) ~[artifactory-web-application-5.4.6.jar:na]
at org.artifactory.webapp.servlet.ArtifactoryContextConfigListener$1.run(ArtifactoryContextConfigListener.java:93) ~[artifactory-web-application-5.4.6.jar:na]
Caused by: org.springframework.beans.factory.BeanInitializationException: Failed to initialize bean 'org.artifactory.security.access.AccessService'.; nested exception is java.lang.RuntimeException: Failed to generate service admin token using bootstrap credentials.
at org.artifactory.spring.ArtifactoryApplicationContext.refresh(ArtifactoryApplicationContext.java:230) ~[artifactory-core-5.4.6.jar:na]
at org.artifactory.spring.ArtifactoryApplicationContext.<init>(ArtifactoryApplicationContext.java:114) ~[artifactory-core-5.4.6.jar:na]
... 7 common frames omitted
Caused by: java.lang.RuntimeException: Failed to generate service admin token using bootstrap credentials.
at org.jfrog.access.client.AccessClientBootstrap.createAndStoreServiceAdminToken(AccessClientBootstrap.java:110) ~[access-client-core-2.0.2.jar:na]
at org.jfrog.access.client.AccessClientBootstrap.bootstrapServiceAdminToken(AccessClientBootstrap.java:79) ~[access-client-core-2.0.2.jar:na]
at org.jfrog.access.client.AccessClientBootstrap.<init>(AccessClientBootstrap.java:42) ~[access-client-core-2.0.2.jar:na]
at org.artifactory.security.access.AccessServiceImpl.initAccessService(AccessServiceImpl.java:227) ~[artifactory-core-5.4.6.jar:na]
at org.artifactory.security.access.AccessServiceImpl.initIfNeeded(AccessServiceImpl.java:216) ~[artifactory-core-5.4.6.jar:na]
at org.artifactory.security.access.AccessServiceImpl.init(AccessServiceImpl.java:211) ~[artifactory-core-5.4.6.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.artifactory.storage.fs.lock.aop.LockingAdvice.invoke(LockingAdvice.java:76) ~[artifactory-storage-common-5.4.6.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) ~[spring-aop-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at com.sun.proxy.$Proxy89.init(Unknown Source) ~[na:na]
at org.artifactory.spring.ArtifactoryApplicationContext.refresh(ArtifactoryApplicationContext.java:228) ~[artifactory-core-5.4.6.jar:na]
... 8 common frames omitted
Caused by: org.jfrog.access.client.AccessClientHttpException: HTTP response status 401:{"errors":[{"code":"UNAUTHORIZED","detail":"Bad credentials","message":"HTTP 401 Unauthorized"}]}
at org.jfrog.access.client.http.AccessHttpClient.createRestResponse(AccessHttpClient.java:312) ~[access-client-core-2.0.2.jar:na]
at org.jfrog.access.client.http.AccessHttpClient.restCall(AccessHttpClient.java:299) ~[access-client-core-2.0.2.jar:na]
at org.jfrog.access.client.http.AccessHttpClient.createToken(AccessHttpClient.java:133) ~[access-client-core-2.0.2.jar:na]
at org.jfrog.access.client.token.TokenClientImpl.create(TokenClientImpl.java:36) ~[access-client-core-2.0.2.jar:na]
at org.jfrog.access.client.AccessClientBootstrap.createAndStoreServiceAdminToken(AccessClientBootstrap.java:103) ~[access-client-core-2.0.2.jar:na]
... 28 common frames omitted
2017-09-25 18:25:56,687 [http-nio-8080-exec-5] [ERROR] (o.a.w.s.ArtifactoryFilter:188) - Artifactory failed to initialize: Context is null
Any suggestions what we should try next? Thanks in advance!
Upvotes: 1
Views: 579
Reputation: 1726
We had some problems migrating to Artifactory 5.4 at my workplace too: RTFACT-14690
My (limited) understanding is that the refactoring and split from artifactory.war into artifactory.war and access.war, starting from 5.4.0, opened a lot of issues for migrations.
Can you do the migration in two steps?
This worked for us and worked around our upgrade problem nicely.
Upvotes: 2