DuplicateMappingException after migrating to 3.1.8

Forum for questions and issues related to 3.0 migration.

Those wishing to upgrade should start by looking at the migration documents published on the Broadleaf Commerce documentation site.

Moderator: jocanas

gowthamgutha
Intermediate
Intermediate
Posts: 98
Joined: Sat Mar 01, 2014 6:19 am

DuplicateMappingException after migrating to 3.1.8

Postby gowthamgutha » Sun Sep 21, 2014 4:46 am

I've changed the broadleaf version to 3.1.8-GA in the pom.xml file and rectified Java errors that occurred after migration. Now when I execute the demo site, I am getting the following exception.

Here is the root cause of the error

org.hibernate.DuplicateMappingException: Duplicate query mapping BC_READ_GIFT_CARD_BY_REFERENCE_NUMBER

and the stack trace..

Code: Select all

[artifact:mvn] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blEntityManagerFactorySecureInfo' defined in resource loaded from byte array: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: blSecurePU] Unable to build EntityManagerFactory
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
[artifact:mvn]    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
[artifact:mvn]    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
[artifact:mvn]    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
[artifact:mvn]    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
[artifact:mvn]    at org.broadleafcommerce.common.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListener.java:50)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:766)2014-09-21 15:11:20.218:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/,file:/D:/Documents%20and%20Settings/Gutha/My%20Documents/Downloads/Compressed/eclipse-workspace/DemoSite/site/target/mycompany/},file:/D:/Documents%20and%20Settings/Gutha/My%20Documents/Downloads/Compressed/eclipse-workspace/DemoSite/site/target/mycompany/
[artifact:mvn]    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:406)
[artifact:mvn] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blEntityManagerFactorySecureInfo' defined in resource loaded from byte array: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: blSecurePU] Unable to build EntityManagerFactory   at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:758)
[artifact:mvn]    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:242)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
[artifact:mvn]    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
[artifact:mvn]    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:701)
[artifact:mvn]    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:475)
[artifact:mvn]    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
[artifact:mvn]    at org.eclipse.jetty.server.Server.doStart(Server.java:272)
[artifact:mvn]    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
[artifact:mvn]    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
[artifact:mvn]    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
[artifact:mvn]    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
[artifact:mvn]    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
[artifact:mvn]    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
[artifact:mvn]    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
[artifact:mvn]    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
[artifact:mvn]    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
[artifact:mvn]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[artifact:mvn]    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
[artifact:mvn]    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
[artifact:mvn]    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
[artifact:mvn]    at org.broadleafcommerce.common.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListener.java:50)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:766)
[artifact:mvn]    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:406)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:758)
[artifact:mvn]    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:242)
[artifact:mvn]    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:701)
[artifact:mvn]    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:475)
[artifact:mvn]    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[artifact:mvn]    at java.lang.reflect.Method.invoke(Method.java:601)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[artifact:mvn]    at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
[artifact:mvn] Caused by: javax.persistence.PersistenceException: [PersistenceUnit: blSecurePU] Unable to build EntityManagerFactory
[artifact:mvn]    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
[artifact:mvn]    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
[artifact:mvn]    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
[artifact:mvn]    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:290)
[artifact:mvn]    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
[artifact:mvn]    ... 56 more
[artifact:mvn] Caused by: org.hibernate.DuplicateMappingException: Duplicate query mapping BC_READ_GIFT_CARD_BY_REFERENCE_NUMBER
[artifact:mvn]    at org.hibernate.cfg.Configuration$MappingsImpl.checkQueryName(Configuration.java:2686)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
[artifact:mvn]    at org.hibernate.cfg.Configuration$MappingsImpl.applyQuery(Configuration.java:2680)
[artifact:mvn]    at org.hibernate.cfg.Configuration$MappingsImpl.addDefaultQuery(Configuration.java:2691)
[artifact:mvn]    at org.hibernate.cfg.annotations.QueryBinder.bindQuery(QueryBinder.java:83)
[artifact:mvn]    at org.hibernate.cfg.AnnotationBinder.bindDefaults(AnnotationBinder.java:232)
[artifact:mvn]    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1322)
[artifact:mvn]    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1729)
[artifact:mvn]    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
[artifact:mvn]    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
[artifact:mvn]    ... 62 more


Thanks in advance. Hope you will reply as soon as possible.

phillipuniverse
Team Member
Team Member
Posts: 1563
Joined: Tue Dec 20, 2011 12:11 pm

Re: DuplicateMappingException after migrating to 3.1.8

Postby phillipuniverse » Sun Sep 21, 2014 2:57 pm

Just verified in the Broadleaf project, we only have a single instance of this query name in the framework. Can you verify that you don't have a query with this name anywhere in your project?

gowthamgutha
Intermediate
Intermediate
Posts: 98
Joined: Sat Mar 01, 2014 6:19 am

Re: DuplicateMappingException after migrating to 3.1.8

Postby gowthamgutha » Mon Sep 22, 2014 5:16 am

I searched for the BC_READ_GIFT_CARD_BY_REFERENCE_NUMBER in my workspace. I haven't found any duplicate. Surprisingly, it was actually in the orm.xml file in the config/bc/jpa folder which didn't exist in broadleaf-3.1.8-GA and too my surprise, I removed that folder and packed the core-1.0.jar file and put it into the site/lib and worked out. It didn't. All I did was commented it out in the orm.xml file. I have got several of such exceptions, regarding CreditCardPayment etc.

I commented them and they worked fine. Is it likely to raise QueryNotFoundException problem in the future when those queries are called?

Thanks in advance.


Return to “3.0 Upgrade and Migration”

Who is online

Users browsing this forum: No registered users and 1 guest