Page 1 of 1

MySQL Migration in 3.0 GA version

Posted: Mon Jul 08, 2013 1:58 pm
by Sambhav
Hi

I am using 3.0 GA version of broadleaf.
After following instruction at http://docs.broadleafcommerce.org/current/Switch-To-MySQL-Tutorial.html,

I am getting these errors:-

    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'broadleaf.blc_sku' doesn't exist
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'system_sequences' in information_schema
    com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '-1' for key 'PRIMARY'

this is how my common-shared.properties file looks like:-

Code: Select all

# Settings for the default persistence unit
blPU.hibernate.hbm2ddl.auto=create
#blPU.hibernate.dialect=org.hibernate.dialect.HSQLDialect
blPU.hibernate.show_sql=true
blPU.hibernate.cache.use_second_level_cache=true
blPU.hibernate.cache.use_query_cache=true
blPU.hibernate.hbm2ddl.import_files=null

# Settings for the CMS storage persistence unit
blCMSStorage.hibernate.hbm2ddl.auto=create
#blCMSStorage.hibernate.dialect=org.hibernate.dialect.HSQLDialect
blCMSStorage.hibernate.show_sql=false
blCMSStorage.hibernate.cache.use_second_level_cache=true
blCMSStorage.hibernate.cache.use_query_cache=true
blCMSStorage.hibernate.hbm2ddl.import_files=null


# Settings for the secure persistence unit
blSecurePU.hibernate.hbm2ddl.auto=create
#blSecurePU.hibernate.dialect=org.hibernate.dialect.HSQLDialect
blSecurePU.hibernate.show_sql=true
blSecurePU.hibernate.cache.use_second_level_cache=false
blSecurePU.hibernate.cache.use_query_cache=false
blSecurePU.hibernate.hbm2ddl.import_files=null

auto.correct.sequence.generator.inconsistencies=true

# ##################################### #
# Thymeleaf View Resolver               #
# ##################################### #

thymeleaf.view.resolver.cache=true

blPU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blSecurePU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blCMSStorage.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect



Plese help me to overcome these.

Thanks

Re: MySQL Migration in 3.0 GA version

Posted: Mon Jul 08, 2013 2:15 pm
by phillipuniverse
Check to make sure that the Hibernate dialect is not being overridden in development-shared.properties or development.properties.

Re: MySQL Migration in 3.0 GA version

Posted: Tue Jul 09, 2013 11:36 am
by Sambhav
Hi

The dialect properties are correct.

The problem starts with this exception:-

[ERROR] 21:54:32 SchemaUpdate - HHH000319: Could not get database metadata
[artifact:mvn] com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'system_sequences' in information_schema

Why that table is unknown and how come it works with HSQL db configuration?


Thanks

Re: MySQL Migration in 3.0 GA version

Posted: Tue Jul 09, 2013 12:50 pm
by phillipuniverse
That error means that Hibernate is trying to use the HSQLDB dialect. HSQL uses that table (system_sequences) internally.

Somewhere a Hibernate dialect was not overridden. Did you redo a maven install on the whole project (core included) after updating the properties files?

Re: MySQL Migration in 3.0 GA version

Posted: Thu Jul 11, 2013 8:28 pm
by cygnusxo
I have the same problem.

Also when i try to : ant build-create-sql, i get an error like this:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blVariableExpressionEvaluator': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'blVariableExpressions' is defined
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.broadleafcommerce.common.extensibility.context.MergeFileSystemAndClassPathXMLApplicationContext.<init>(MergeFileSystemAndClassPathXMLApplicationContext.java:94)
at org.broadleafcommerce.common.util.sql.HibernateToolTask.execute(HibernateToolTask.java:143)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'blVariableExpressions' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:568)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1102)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:442)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:550)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)
... 28 more

Re: MySQL Migration in 3.0 GA version

Posted: Thu Jul 11, 2013 8:31 pm
by cygnusxo
OK... the mvn install on the parent did it...!!!

Thanks for this...

You have any idea why the build-create-sql does not works?

Re: MySQL Migration in 3.0 GA version

Posted: Mon Jul 22, 2013 11:50 am
by priyeshgpatel
Hi,
The fix was committed in 3.0x, so it should be in next GA.

The build-create-sql and build-update-sql should work now. There were missing applicationContext files, so the hibernatetool would not come up.

Re: MySQL Migration in 3.0 GA version

Posted: Tue Jul 23, 2013 10:19 am
by cygnusxo
Great thanks

Re: MySQL Migration in 3.0 GA version

Posted: Fri Aug 01, 2014 6:10 am
by mathias.lin
There is a related issue in this forum: viewtopic.php?f=14&t=607