Need help upgrading BitBucket

Frank Stauber March 4, 2021

Hi!

 

We have an installation of BitBucket 5.16.11 on an old RHEL6 server.

Now the server must be replaced, with a new RHEL8 one, so I'm trying to get the application running on the new server.

First I needed to download a new version of the MySQL-Connector, and it worked, but on RHEL8 is GIT 2.27.0 installed, and BitBucket 5.16 cannot use it, so I _must_ update the application...

 

I tried to upgrade to the last version 7 and it does not work, so I tried with an upgrade to version 6, but I get the same problems...

In the logs I see these errors:

 

2021-03-04 09:02:08,256 WARN [spring-startup] o.h.internal.SessionFactoryRegistry HHH000374: Could not unbind factory from JNDI
org.hibernate.engine.jndi.JndiException: Error performing unbind [bitbucket.core]
at org.hibernate.engine.jndi.internal.JndiServiceImpl.unbind(JndiServiceImpl.java:213)
at org.hibernate.internal.SessionFactoryRegistry.removeSessionFactory(SessionFactoryRegistry.java:124)
at org.hibernate.internal.SessionFactoryImpl.close(SessionFactoryImpl.java:816)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:386)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:615)
at com.atlassian.stash.internal.hibernate.ExtendedLocalSessionFactoryBean.buildSessionFactory(ExtendedLocalSessionFactoryBean.java:101)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:599)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at java.lang.Thread.run(Thread.java:748)
... 40 frames trimmed
Caused by: javax.naming.NameNotFoundException: Name [bitbucket.core] is not bound in this Context. Unable to find [bitbucket.core].
at org.apache.naming.NamingContext.unbind(NamingContext.java:282)
at org.apache.naming.SelectorContext.unbind(SelectorContext.java:260)
at javax.naming.InitialContext.unbind(InitialContext.java:445)
at org.hibernate.engine.jndi.internal.JndiServiceImpl.unbind(JndiServiceImpl.java:210)
... 14 common frames omitted
2021-03-04 09:02:08,269 WARN [spring-startup] o.s.w.c.s.XmlWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdAliasDao': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [attribute_value] in table [cwd_directory_attribute]; found [varchar (Types#VARCHAR)], but expecting [longtext (Types#CLOB)]
2021-03-04 09:02:08,271 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Releasing lock on /data/www/vhosts/vhost13/data/bitbucket/shared
2021-03-04 09:02:08,278 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Releasing lock on /data/www/vhosts/vhost13/data/bitbucket
2021-03-04 09:02:08,279 ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdAliasDao': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [attribute_value] in table [cwd_directory_attribute]; found [varchar (Types#VARCHAR)], but expecting [longtext (Types#CLOB)]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:676)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at java.lang.Thread.run(Thread.java:748)
... 18 frames trimmed
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [attribute_value] in table [cwd_directory_attribute]; found [varchar (Types#VARCHAR)], but expecting [longtext (Types#CLOB)]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:378)
... 5 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [attribute_value] in table [cwd_directory_attribute]; found [varchar (Types#VARCHAR)], but expecting [longtext (Types#CLOB)]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745)
... 5 common frames omitted
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [attribute_value] in table [cwd_directory_attribute]; found [varchar (Types#VARCHAR)], but expecting [longtext (Types#CLOB)]
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateColumnType(AbstractSchemaValidator.java:159)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:143)
at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:42)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:89)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:68)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:191)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:615)
at com.atlassian.stash.internal.hibernate.ExtendedLocalSessionFactoryBean.buildSessionFactory(ExtendedLocalSessionFactoryBean.java:101)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:599)
... 5 common frames omitted

 

can someone help me?

Thank you very very much!

1 answer

0 votes
Frank Stauber March 5, 2021

So, I got it working...

The problem was, that the program does not automatically update some tables, used by the Crowd integration...

I needed to call these queries and finally I was able to use the new version:

ALTER TABLE cwd_directory_attribute MODIFY COLUMN attribute_value LONGTEXT;
ALTER TABLE cwd_granted_perm ADD COLUMN `group_name` varchar(255) COLLATE utf8_bin NOT NULL AFTER `permission_id`;
ALTER TABLE cwd_granted_perm CHANGE COLUMN `group_mapping` `app_dir_mapping_id` bigint(20) NOT NULL;
ALTER TABLE cwd_user_attribute ADD COLUMN `attribute_numeric_value` bigint(20) DEFAULT NULL AFTER `attribute_lower_value`;
ALTER TABLE repository ADD COLUMN `store_id` bigint(20) DEFAULT NULL AFTER `is_public`;
ALTER TABLE repository ADD COLUMN `description` varchar(255) COLLATE utf8_bin DEFAULT NULL AFTER `store_id`;
ALTER TABLE bb_comment ADD COLUMN `resolved_timestamp` datetime DEFAULT NULL AFTER `updated_timestamp`;
ALTER TABLE bb_comment ADD COLUMN `resolver_id` int(11) DEFAULT NULL AFTER `resolved_timestamp`;
ALTER TABLE bb_comment ADD COLUMN `severity` int(11) NOT NULL AFTER `resolver_id`;
ALTER TABLE bb_comment ADD COLUMN `state` int(11) NOT NULL AFTER `severity`;
ALTER TABLE bb_proj_merge_config ADD COLUMN `commit_summaries` int(11) NOT NULL AFTER `default_strategy_id`;
ALTER TABLE bb_repo_merge_config ADD COLUMN `commit_summaries` int(11) NOT NULL AFTER `default_strategy_id`;
ALTER TABLE bb_scm_merge_config ADD COLUMN `commit_summaries` int(11) NOT NULL AFTER `default_strategy_id`;

Hope this help someone other...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events