title: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]
body: <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'xaDataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xaDataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'xaDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'driverClassName' of bean class [org.postgresql.xa.PGXADataSource]: Bean property 'driverClassName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p>http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
                          <a href="http://www.springframework.org/schema/util" rel="nofollow">http://www.springframework.org/schema/util</a> <a href="http://www.springframework.org/schema/util/spring-util-4.1.xsd" rel="nofollow">http://www.springframework.org/schema/util/spring-util-4.1.xsd</a>
                          <a href="http://www.springframework.org/schema/aop" rel="nofollow">http://www.springframework.org/schema/aop</a>
                          <a href="http://www.springframework.org/schema/aop/spring-aop-4.1.xsd" rel="nofollow">http://www.springframework.org/schema/aop/spring-aop-4.1.xsd</a>"></p>
  
  <pre><code>&lt;bean id="requestHandler" class="org.dejach.marketServer.requesthandler.RequestHandler"  init-method="init"&gt;
      &lt;property name="factory" ref="marketApiFactory"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="RequestProcessor" class="org.dejach.marketServer.processor.RequestProcessor"&gt;
      &lt;property name="handler" ref="requestHandler" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="marketApiFactory" class="org.dejach.marketServer.processor.MarketApiFactory"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;bean
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="locations"&gt;
          &lt;value&gt;WEB-INF/marketApi.properties&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="nullValue" value="@null" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="properties"
      class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;
      &lt;property name="location" value="WEB-INF/marketApi.properties" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="dataSource" class="org.postgresql.xa.PGXADataSource"&gt;
      &lt;!-- &lt;property name="pinGlobalTxToPhysicalConnection" value="true" /&gt; --&gt;
      &lt;property name="driverClassName" value="org.postgresql.Driver" /&gt;
      &lt;property name="url" value="${jdbcUrl}" /&gt;
      &lt;property name="user" value="${username}" /&gt;
      &lt;property name="password" value="${password}" /&gt;
  
  &lt;/bean&gt;
  
  &lt;!-- configure an Atomikos JTA-aware datasource --&gt;
  &lt;bean id="xaDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
      init-method="init" destroy-method="close"&gt;
      &lt;property name="uniqueResourceName" value="xaDatasource" /&gt;
      &lt;property name="xaDataSource" ref="dataSource" /&gt;
      &lt;property name="poolSize" value="${poolSize}" /&gt;
  &lt;/bean&gt;
  
  &lt;!-- http://fogbugz.atomikos.com/default.asp?community.6.702.5 --&gt;
  &lt;bean id="userTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp"
      init-method="init" destroy-method="shutdownForce"&gt;
      &lt;constructor-arg&gt;
          &lt;props&gt;
              &lt;prop key="com.atomikos.icatch.log_base_name"&gt;${com.atomikos.icatch.log_base_name}&lt;/prop&gt;
              &lt;prop key="com.atomikos.icatch.log_base_dir"&gt;${com.atomikos.icatch.log_base_dir}&lt;/prop&gt;
              &lt;prop key="com.atomikos.icatch.max_timeout"&gt;3600000&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  
  &lt;bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
      init-method="init" destroy-method="close" depends-on="userTransactionService"&gt;
      &lt;property name="forceShutdown" value="false" /&gt;
      &lt;property name="startupTransactionService" value="true" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.J2eeUserTransaction"&gt;
      &lt;property name="transactionTimeout" value="${transactionTimeout}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="transactionManager"
      class="org.springframework.transaction.jta.JtaTransactionManager"
      depends-on="atomikosTransactionManager,atomikosUserTransaction"&gt;
      &lt;property name="transactionManager" ref="atomikosTransactionManager" /&gt;
      &lt;property name="userTransaction" ref="atomikosUserTransaction" /&gt;
      &lt;property name="allowCustomIsolationLevels" value="true" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="jpaVendor"
      class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
      &lt;property name="showSql" value="${showSql}" /&gt;
      &lt;property name="databasePlatform" value="${databasePlatform}" /&gt;
      &lt;property name="generateDdl" value="${generateDdl}" /&gt;
      &lt;property name="database" value="${database}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property name="dataSource" ref="xaDataSource" /&gt;
      &lt;property name="packagesToScan" value="${marketPackage}" /&gt;
      &lt;property name="jpaVendorAdapter" ref="jpaVendor" /&gt;
      &lt;property name="jpaProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}&lt;/prop&gt;
              &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <hr>
  
  <pre><code>username=postgres
  password=$$$$$$$
  hibernate.hbm2ddl.auto=create
  hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
  
  # package scan for entities
  marketPackage=org.dejach
  transactionTimeout=300
  showSql=true
  #databasePlatform=org.hibernate.dialect.MySQL5InnoDBDialect
  databasePlatform=org.hibernate.dialect.PostgreSQLDialect
  #database=org.springframework.orm.jpa.vendor.Database.MYSQL
  #database=MYSQL
  database=POSTGRESQL
  generateDdl=false
  poolSize=30
  #XA datasource
  #XADataSource=${mysqlDataSource}
  XADataSource=${postgresqlDataSource}
  #mysqlDataSource=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
  postgresqlDataSource=org.postgresql.xa.PGXADataSource
  H2xadatasource=org.h2.jdbcx.JdbcDataSource
  postgresqlUrl = jdbc:postgresql://localhost:5432/ethiopianMarketdb
  H2url=jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
  jdbcUrl=${postgresqlUrl}
  blobFieldName=xmlData
  #Atomikus properties
  #see http://www.atomikos.com/Documentation/JtaProperties                                                                 com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory
  
  
  com.atomikos.icatch.console_file_name
  
  #Specifies the console log level. Defaults to WARN. Should be one of: WARN,  INFO or DEBUG.
  com.atomikos.icatch.log_base_name=tmlog
  com.atomikos.icatch.log_base_dir=target
  #com.atomikos.icatch.log_base_dir=/transactionLogs/
  #com.atomikos.icatch.tm_unique_name=
  com.atomikos.icatch.max_timeout=3600000
  </code></pre>