Following the instructions found at http://docs.broadleafcommerce.org/core/ ... figuration (Note: version 2.2), I added the elements described in Additional Persistence Units, a minimal persistence unit definition in persistence.xml and resource definition in context.xml. When I start the application, I receive the following stack trace.
Code: Select all
[artifact:mvn] SEVERE: Exception sending context initialized event to listener instance of class org.broadleafcommerce.common.web.extensibility.MergeContextLoaderListener
[artifact:mvn] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactoryProfilePU' defined in resource loaded from byte array: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: @OneToOne or @ManyToOne on org.broadleafcommerce.profile.core.domain.CustomerImpl.challengeQuestion references an unknown entity: org.broadleafcommerce.profile.core.domain.ChallengeQuestionImpl
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
[artifact:mvn] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
[artifact:mvn] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)
[artifact:mvn] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915)
[artifact:mvn] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
[artifact:mvn] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
[artifact:mvn] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
[artifact:mvn] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
[artifact:mvn] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
[artifact:mvn] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
[artifact:mvn] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[artifact:mvn] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
[artifact:mvn] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
[artifact:mvn] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
[artifact:mvn] at java.util.concurrent.FutureTask.run(FutureTask.java:166)
[artifact:mvn] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[artifact:mvn] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[artifact:mvn] at java.lang.Thread.run(Thread.java:722)
[artifact:mvn] Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on org.broadleafcommerce.profile.core.domain.CustomerImpl.challengeQuestion references an unknown entity: org.broadleafcommerce.profile.core.domain.ChallengeQuestionImpl
[artifact:mvn] at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:107)
[artifact:mvn] at org.hibernate.cfg.Configuration.processEndOfQueue(Configuration.java:1580)
[artifact:mvn] at org.hibernate.cfg.Configuration.processFkSecondPassInOrder(Configuration.java:1503)
[artifact:mvn] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1419)
[artifact:mvn] at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
[artifact:mvn] at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1519)
[artifact:mvn] at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
[artifact:mvn] at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1100)
[artifact:mvn] at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689)
[artifact:mvn] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
[artifact:mvn] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:287)
[artifact:mvn] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
[artifact:mvn] ... 22 more
This seems to indicate an issue with relationships in the Broadleaf base entities. If I remove the entity manger factory bean for my new persistence unit, the application starts without the error. As I understand the configuration, this bean is necessary to use the new persistence unit. Suggestions? Did I miss something?
Snips...
applicationContext.xml
Code: Select all
<bean id="blMergedDataSources" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="jdbc/web" value-ref="webDS"/>
<entry key="jdbc/webSecure" value-ref="webSecureDS"/>
<entry key="jdbc/cmsStorage" value-ref="webStorageDS"/>
<entry key="jdbc/profile" value-ref="cmpProfileDS"/>
</map>
</property>
</bean>
<bean id="blMergedPersistenceXmlLocations" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<value>classpath*:/META-INF/persistence.xml</value>
</list>
</property>
</bean>
<bean id="entityManagerFactoryProfilePU" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager" ref="blPersistenceUnitManager"/>
<property name="persistenceUnitName" value="cmpProfilePU"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
</property>
</bean>
applicationContext-datasource.xml
Code: Select all
<jee:jndi-lookup id="webDS" jndi-name="jdbc/web"/>
<jee:jndi-lookup id="webSecureDS" jndi-name="jdbc/secure"/>
<jee:jndi-lookup id="webStorageDS" jndi-name="jdbc/storage"/>
<jee:jndi-lookup id="cmpProfileDS" jndi-name="jdbc/profile"/>
web.xml
Code: Select all
<resource-ref>
<res-ref-name>jdbc/web</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/profile</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
persistence.xml
Code: Select all
<persistence-unit name="cmpProfilePU" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>jdbc/profile</non-jta-data-source>
<exclude-unlisted-classes/>
</persistence-unit>
context.xml
Code: Select all
<Resource name="jdbc/profile"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
timeBetweenEvictionRunsMillis="30000"
maxActive="15"