Hi:

Has anyone been able to make Spring2-JPA running on tomcat 6?

I try to upgrade a jsf application on tomcat. It was compiled but stuck
at Spring JPA configuration. Any suggestions?

Environment: jdk-1.6U2, tomcat-6.0.13, jsf-1.2, myfaces-1.2.0,
trimidad-1.2.1, facelets-1.1.11, Shale-1.0.4, Spring-2.0.5,
toplink-2.41, Oracle-XE. More detailed is in the enclosed txt file.

Thanks

Hi:

I try to upgrade a jsf application on tomcat. It was compiled but stuck at 
Spring configuration. Any suggestion?

Environment: jdk-1.6U2, tomcat-6.0.13, jsf-1.2, myfaces-1.2.0, trinidad-1.2.1, 
facelets-1.1.11, Shale-1.0.4, Spring-2.0.5, topLink-2.41, Oracle-XE.

1) tomcat-6/lib/spring-tomcat-waever-2.0.5.jar, ojdbc14_g-1.4.jar, 
toplink-essentials-2.41.jar and the context.xml has: 

  <Context path="" docBase="ROOT" crossContext="true" debug="0"
    reloadable="true" >
    <Loader 
loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"
 useSystemClassLoaderAsParent="false" />
  </Context>

2) ant-1.7.0 has used this persistence.xml to generate schema and populate data

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence";>
  <persistence-unit name="BUDHNET" transaction-type="RESOURCE_LOCAL">

    <class>com.dbgroups.core.data.Activity</class>
    ...

  <!-- required for toplink to work with Ant in database creation
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <properties>
      <property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
      ...
    </properties>
  -->  

  </persistence-unit>
</persistence>
 As reported by someone that Spring-JPA only looks at the class root for 
/META-INF/persistence.xml so we also have 
/WEB-INF/classes/META-INF/persistence.xml

3) Setting up Spring beans

<beans xmlns="http://www.springframework.org/schema/beans";
       ...
       default-init-method="init"  default-destroy-method="destroy" >

  <bean id="userDao" scope="singleton" class="com.dbgroups.core.user.UserDao"/>
  <bean id="userService" class="com.dbgroups.core.user.UserService" >
    <property name="userDao" ref="userDao"/>
  </bean>

  <bean id="transactionManager" scope="singleton"
    class="org.springframework.orm.jpa.JpaTransactionManager" >
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
  </bean>

  <bean 
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
  <bean 
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
  <tx:annotation-driven />  

  <bean id="entityManagerFactory" 
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="BUDHNET"/>
    <property name="dataSource" ref="dataSource"/>
    <property name="loadTimeWeaver">
      <bean 
class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver" />
    </property>
    <property name="jpaVendorAdapter" ref="vendorAdapter"/>
  </bean>
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@collab.budhnet.com:1521:XE"/>
    <property name="username" value="XX"/>
    <property name="password" value="XXXXXXX"/>
  </bean>
  <bean id="vendorAdapter" 
class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
     <property name="databasePlatform" 
value="oracle.toplink.essentials.platform.database.oracle.OraclePlatform"/>
     <property name="showSql" value="true"/>
     <property name="generateDdl" value="false"/>
  </bean>

</beans>

4) web.xml has both spring ContextLoaderListener and RequestContextListener.

Someone has tried this and make it work on windows with the addition of 
javaagent (that I do not yet understand):

   http://asrijaffar.blogspot.com/2007/02/spring-jpa-tomcat.html 

I am working on CentOS-4 and has the followings:

INFO: Bean factory for application context [EMAIL PROTECTED]: [EMAIL PROTECTED]
Jul 23, 2007 7:32:21 PM 
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
 postProcessAfterInitialization
INFO: Bean 'dataSource' is not eligible for getting processed by all 
BeanPostProcessors (for example: not eligible for auto-proxying)
Jul 23, 2007 7:32:21 PM 
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
 postProcessAfterInitialization
INFO: Bean 
'org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver#36d047' 
is not eligible for getting processed by all BeanPostProcessors (for example: 
not eligible for auto-proxying)
Jul 23, 2007 7:32:21 PM 
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
 postProcessAfterInitialization
INFO: Bean 'vendorAdapter' is not eligible for getting processed by all 
BeanPostProcessors (for example: not eligible for auto-proxying)
Jul 23, 2007 7:32:21 PM 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry 
destroySingletons
INFO: Destroying singletons in [EMAIL PROTECTED]: defining beans 
[userDao,userService,entityManagerFactory,dataSource,vendorAdapter,transactionManager,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor,adService,checkoutData,payBillData,wireTransferData];
 root of factory hierarchy
Jul 23, 2007 7:32:21 PM org.springframework.web.context.ContextLoader 
initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'entityManagerFactory' defined in ServletContext resource 
[/WEB-INF/xmlConfig/core.xml]: Invocation of init method failed; nested 
exception is java.lang.StackOverflowError
Caused by: java.lang.StackOverflowError
        at org.apache.xerces.util.URI.isConformantSchemeName(URI.java:1213)
        at org.apache.xerces.util.URI.setScheme(URI.java:904)
        at org.apache.xerces.util.URI.initializeScheme(URI.java:576)
        at org.apache.xerces.util.URI.initialize(URI.java:400)
        at org.apache.xerces.util.URI.<init>(URI.java:211)
        at org.apache.xerces.util.URI.<init>(URI.java:195)
        at 
org.apache.xerces.impl.XMLEntityManager.expandSystemId(XMLEntityManager.java:1140)

Reply via email to