-
May 10th, 2012, 01:15 PM
#1
Changing a Jboss ear file into multiple war files and deploying into Tomcat
I currently have spring beans that use hibernate to access our database. How can I deploy to tomcat so that my 3 war files have access to one instance of spring database beans? My old jboss deployment used a beanRefContext.xml located in earfile.ear containing this:
<bean id="ear.context" class="org.springframework.context.support.ClassPa thXmlApplicationContext">
<constructor-arg>
<list>
<value>services-context.xml</value>
</list>
</constructor-arg>
</bean>
A services-context.xml contained stuff like this:
<beans>
<context
roperty-placeholder
location="classpath*:/blah/jpaserverdatamodel/resources/postgres.persistence.properties"/>
<context:annotation-config/>
<context:spring-configured/>
<import resource="classpath*:commons-services.xml" />
<import resource="classpath*:data-listener-services.xml" />
<import resource="classpath*:blah/jpadatamodel/resources/persistence-context.xml"/>
<import resource="classpath*:jpa-data-model-services.xml" />
<import resource="classpath*:jpa-server-data-model-services.xml" />
</beans>
I've copied my beanRefContext.xml and services-context.xml including spring jars into tomcat/lib, but on startup, my first war errors with this:
Error creating bean with name 'org.springframework.dao.annotation.PersistenceExc eptionTransla
tionPostProcessor#0' defined in URL [jar:file:/C:/liferay/liferay-portal-6.0.6/tomcat-6.0.29/lib/blah.jpadatamodel.jar!/blah/jpadatamodel/resources/persistence-context.xml]: Initialization of bean failed;
nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'disConOpsEMF' defined in URL [jar:file:/C:/liferay/liferay-portal-6.0.6/tomcat-6.0.29/lib/blah.jpadatamodel.jar!/blah/jpadatamodel/resources/persistence-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: INSTANCE
Contents of persistence-context.xml:
<bean id="disConOpsEMF" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="${jpa.persistenceXmlLocation}"/>
<property name="persistenceUnitName" value="DisConOpsPU"/>
<property name="dataSource" ref="disConOpsDS"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
<property name="databasePlatform"
value="${jpa.jpaVendorAdapter.databasePlatform}"/>
<property name="showSql" value="${jpa.jpaVendorAdapter.showSql}"/>
<property name="generateDdl" value="${jpa.jpaVendorAdapter.generateDdl}"/>
</bean>
</property>
</bean>
Any ideas would be appreciated. thanks.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules