Search code examples
upgradeartifactory

Upgrading artifactory 6.x to 7.12/latest (with intermediate step (7.8/7.5)?)?


Dears,

I'm trying to upgrade artifactory 6.16.2 to 7.12.6 (eventually), upgrading to the latest (or a later) version is also an option.

I've tried to upgrade from 6.16.2 to 7.8.8, but got following errors:

This is the first error that shows up in the artifactory-service.err.log:

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/access]]
    at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:614)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1822)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jerseyConfig' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-application-5.7.8.jar!/org/jfrog/access/rest/config/JerseyConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'httpServiceImpl' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/service/http/HttpServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'internalConfigurationServiceImpl' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/service/configuration/InternalConfigurationServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accessConfigurationStorageServiceImpl' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/service/db/AccessConfigurationStorageServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accessConfigsDao' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/db/dao/AccessConfigsDao.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessJdbcHelperImpl': Invocation of init method failed; nested exception is org.flywaydb.core.internal.dbsupport.FlywaySqlException: 
Unable to insert row for version '3.15' in metadata table [dbo].[access_schema_version]
---------------------------------------------------------------------------------------
SQL State  : 23000
Error Code : 515
Message    : Cannot insert the value NULL into column 'installed_on', table 'artifactory_backup.dbo.access_schema_version'; column does not allow nulls. INSERT fails.

    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5144)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 10 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jerseyConfig' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-application-5.7.8.jar!/org/jfrog/access/rest/config/JerseyConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'httpServiceImpl' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/service/http/HttpServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'internalConfigurationServiceImpl' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/service/configuration/InternalConfigurationServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accessConfigurationStorageServiceImpl' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/service/db/AccessConfigurationStorageServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accessConfigsDao' defined in URL [jar:file:/C:/tools/jfrog/artifactory/artifactory-pro-7.7.8/app/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-core-5.7.8.jar!/org/jfrog/access/server/db/dao/AccessConfigsDao.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessJdbcHelperImpl': Invocation of init method failed; nested exception is org.flywaydb.core.internal.dbsupport.FlywaySqlException: 
Unable to insert row for version '3.15' in metadata table [dbo].[access_schema_version]
---------------------------------------------------------------------------------------
SQL State  : 23000
Error Code : 515
Message    : Cannot insert the value NULL into column 'installed_on', table 'artifactory_backup.dbo.access_schema_version'; column does not allow nulls. INSERT fails.

There are (a lot of) similar ones,

if needed I can provide other logs, I'm not really upgrading artifactory a lot so help in pinning down the problem would be nice as well...

This is the migration log:

2021-04-07T14:35:08 [INFO ] [migrate.bat  ] [main]- Detected artifactory 6.16.2, initiating migration  
 
*************************** STARTING MIGRATION ******************************* 
 
2021-04-07T14:35:09 [INFO ] [migrate.bat  ] [main]- system.yaml will be created in path [C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\var\etc\system.yaml]  
 
*************************** PROCESSING MIGRATION OF PROPERTY FILES ******************************* 
 
 
*************** Processing Migration of dbProperty ****************** 
 
2021-04-07T14:35:09 [INFO ] [migrate.bat  ] [main]- File [db.properties] found in path [C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\var\etc\artifactory\old]  
2021-04-07T14:35:10 [INFO ] [migrate.bat  ] [main]- Setting [shared.database.type] with value of the property [type] in system.yaml  
2021-04-07T14:35:11 [INFO ] [migrate.bat  ] [main]- Setting [shared.database.driver] with value of the property [driver] in system.yaml  
2021-04-07T14:35:11 [INFO ] [migrate.bat  ] [main]- Setting [shared.database.url] with value of the property [url] in system.yaml  
2021-04-07T14:35:12 [INFO ] [migrate.bat  ] [main]- Setting [shared.database.username] with value of the property [username] in system.yaml  
2021-04-07T14:35:12 [INFO ] [migrate.bat  ] [main]- Setting [shared.database.password] with value of the property [password] in system.yaml  
2021-04-07T14:35:12 [INFO ] [migrate.bat  ] [main]- Property [pool.type] not found in the file [db.properties]  
2021-04-07T14:35:13 [INFO ] [migrate.bat  ] [main]- Property [pool.max.active] not found in the file [db.properties]  
2021-04-07T14:35:13 [INFO ] [migrate.bat  ] [main]- Property [pool.max.idle] not found in the file [db.properties]  
2021-04-07T14:35:13 [INFO ] [migrate.bat  ] [main]- Property [lockingdb.username] not found in the file [db.properties]  
2021-04-07T14:35:13 [INFO ] [migrate.bat  ] [main]- Property [lockingdb.password] not found in the file [db.properties]  
2021-04-07T14:35:14 [INFO ] [migrate.bat  ] [main]- Property [lockingdb.type] not found in the file [db.properties]  
2021-04-07T14:35:14 [INFO ] [migrate.bat  ] [main]- Property [lockingdb.url] not found in the file [db.properties]  
2021-04-07T14:35:14 [INFO ] [migrate.bat  ] [main]- Property [lockingdb.driver] not found in the file [db.properties]  
 
*************** Processing Migration of haNodeProperty ****************** 
 
2021-04-07T14:35:15 [INFO ] [migrate.bat  ] [main]- File [ha-node.properties] was not found in path [C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\var\etc\artifactory\old] to migrate  
 
*************** Processing Migration of accessDbProperty ****************** 
 
2021-04-07T14:35:15 [INFO ] [migrate.bat  ] [main]- File [db.properties] was not found in path [C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\var\etc\access\old] to migrate  
 
*************************** PROCESSING MIGRATION OF YAML FILES ******************************* 
 
 
*************** Processing Migration of replicatorYaml ****************** 
 
2021-04-07T14:35:16 [INFO ] [migrate.bat  ] [main]- File [replicator.yaml] was not found in path [C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\var\etc\replicator\old] to migrate  
 
*************** PROCESSING MIGRATION OF XML FILES ****************** 
 
 
*************** Processing Migration of server.xml ****************** 
 
2021-04-07T14:35:17 [INFO ] [migrate.bat  ] [main]- File [server.xml] found in path [C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\var\work\old]  
2021-04-07T14:35:19 [INFO ] [migrate.bat  ] [main]- Setting [artifactory.port] with value [8081] in system.yaml  
2021-04-07T14:35:20 [INFO ] [migrate.bat  ] [main]- Setting [artifactory.tomcat.connector.maxThreads] with value [200] in system.yaml  
2021-04-07T14:35:21 [INFO ] [migrate.bat  ] [main]- Setting [artifactory.tomcat.connector.sendReasonPhrase] with value [true] in system.yaml  
2021-04-07T14:35:22 [INFO ] [migrate.bat  ] [main]- Setting [artifactory.tomcat.connector.relaxedPathChars] with value ["""[]"""] in system.yaml  
2021-04-07T14:35:22 [INFO ] [migrate.bat  ] [main]- Setting [artifactory.tomcat.connector.relaxedQueryChars] with value ["""[]"""] in system.yaml  
2021-04-07T14:35:24 [INFO ] [migrate.bat  ] [main]- Setting [artifactory.tomcat.connector.extraConfig] with connector attributes in system.yaml  
2021-04-07T14:35:25 [INFO ] [migrate.bat  ] [main]- Setting [access.http.port] with value [8040] in system.yaml  
2021-04-07T14:35:26 [INFO ] [migrate.bat  ] [main]- Setting [access.tomcat.connector.maxThreads] with value [50] in system.yaml  
2021-04-07T14:35:27 [INFO ] [migrate.bat  ] [main]- Setting [access.tomcat.connector.sendReasonPhrase] with value [true] in system.yaml  
2021-04-07T14:35:29 [INFO ] [migrate.bat  ] [main]- Artifactory 8081 and Access 8040 default port are found  
 
*************************** MIGRATION COMPLETED SUCCESSFULLY ******************************* 
 

it eventually fails with:

2021-04-07T13:08:28.578Z [1;32m[jfrt ][0;39m [1;31m[ERROR][0;39m [4a86b1b8681e3d99] [actoryContextConfigListener:91] [ocalhost-startStop-2] - Failed initializing Artifactory context: Artifactory home not initialized.

Any help very much appreciated!!!

EDIT: it's on a windows system (with microsoft sql database)

EDIT 2:

this is also a problem that the upgrade script reports:

SQL State  : S0004
Error Code : 2705
Message    : Column names in each table must be unique. Column name 'router_id' in table 'access_topology' is specified more than once.
Location   : db/mssql/migration/V3_15__Topology_add_router_id.sql (C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\app\bin\file:\C:\tools\jfrog\artifactory\artifactory-pro-7.7.8\app\artifactory\tomcat\webapps\access\WEB-INF\lib\access-server-core-5.7.8.jar!\db\mssql\migration\V3_15__Topology_add_router_id.sql)
Line       : 1
Statement  : ALTER TABLE access_topology ADD router_id VARCHAR(255);

These two errors are the ones occuring actually (both of them multiple times).

Can you also provide a solution for the second error?


Solution

  • You can simply adjust the schema on your sql server.

    change 'artifactory_backup.dbo.access_schema_version' and remove the nonnull constraint from the 'installed_on' column (best with you sql gui).

    or you can use sql (i am not 100% sure if the data type 'datetime' is correct):

    ALTER TABLE 'artifactory_backup.dbo.access_schema_version' 
        ALTER COLUMN installed_on datetime NULL;
    

    This happens with quite a few upgrade scripts that some historic column interferes. ( not only in artifactory)

    As for your second problem:

    Statement  : ALTER TABLE access_topology ADD router_id VARCHAR(255);
    

    Just remove the column from the table (again either through a mssql tool) or by:

    ALTER TABLE 'artifactory_backup.dbo.access_topology' 
        DROP COLUMN router_id;
    

    This will fix that error.