Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In spite of that I am using Spring 3.1.2, I am running into the same problem in case i place my executor and scheduler tag in ApplicationContext.xml. i have two xml configuration file for spring in my project which are : </p> <ol> <li>applicationContext.xml</li> <li>dispatcher-servlet.xml</li> </ol> <p>So try to move your configuration to the last configuration file which spring reads. in my case it is start working by moving my configuration to dispatcher-servlet.xml</p> <p>here is my example:</p> <p><strong>applicationContext.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"&gt; &lt;bean id="config" class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt; &lt;property name="location" value="/WEB-INF/configuration.properties" /&gt; &lt;/bean&gt; &lt;!-- To fix the problem with Unicode characters in ajax responses --&gt; &lt;bean class = "org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt; &lt;property name="messageConverters"&gt; &lt;array&gt; &lt;bean class = "org.springframework.http.converter.StringHttpMessageConverter"&gt; &lt;property name="supportedMediaTypes" value = "text/plain;charset=UTF-8" /&gt; &lt;/bean&gt; &lt;bean id="byteArrayMessageConverter" class="org.springframework.http.converter.ByteArrayHttpMessageConverter" /&gt; &lt;/array&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!-- Hibernate Configuration p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/iss" p:username="root" p:password="root" --&gt; &lt;bean name="DataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" p:driverClassName="org.postgresql.Driver" p:url="jdbc:postgresql://localhost:5432/iss" p:username="postgres" p:password="" /&gt; &lt;!--&lt;bean name="SessionFactory" class="org.springframework.orm.hibernate4.annotation.AnnotationSessionFactoryBean"&gt;--&gt; &lt;bean name="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt; &lt;property name="dataSource"&gt; &lt;ref bean="DataSource" /&gt; &lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;!--&lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;--&gt; &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/prop&gt; &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt; &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; &lt;!--&lt;prop key="hibernate.current_session_context_class"&gt;thread&lt;/prop&gt;--&gt; &lt;!--&lt;prop key="hibernate.current_session_context_class"&gt;managed&lt;/prop&gt;--&gt; &lt;!--&lt;prop key="hibernate.search.default.indexBase"&gt;/tmp/hibernate/indexes/&lt;/prop&gt;--&gt; &lt;!--&lt;prop key="hibernate.flushMode"&gt;AUTO&lt;/prop&gt;--&gt; &lt;prop key="hibernate.connection.useUnicode"&gt;true&lt;/prop&gt; &lt;prop key="hibernate.connection.characterEncoding"&gt;UTF-8&lt;/prop&gt; &lt;prop key="hibernate.cache.use_second_level_cache"&gt;false&lt;/prop&gt; &lt;prop key="hibernate.cache.use_query_cache"&gt;false&lt;/prop&gt; &lt;prop key="hibernate.connection.autocommit"&gt;false&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;property name="packagesToScan" value="iss.DB" /&gt; &lt;/bean&gt; &lt;bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt; &lt;property name="sessionFactory" ref="sessionFactory" /&gt; &lt;/bean&gt; &lt;mvc:interceptors&gt; &lt;bean class="org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor"&gt; &lt;property name="sessionFactory" ref="sessionFactory" /&gt; &lt;/bean&gt; &lt;/mvc:interceptors&gt; &lt;tx:annotation-driven transaction-manager="txManager" proxy-target-class="true"/&gt; &lt;!-- in this file it wont work &lt;task:executor id="myExecutor" pool-size="1" /&gt; &lt;task:scheduler id="myScheduler" pool-size="1" /&gt; &lt;task:annotation-driven executor="myExecutor" scheduler="myScheduler"/&gt; --&gt; &lt;/beans&gt; </code></pre> <p><strong>dispatcher-servlet.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" xmlns:context="http://www.springframework.org/schema/context"&gt; &lt;bean class="org.springframework.web.servlet.mvc.support.AnnotationControllerTypePredicate"/&gt; &lt;context:component-scan base-package="iss"/&gt; &lt;context:component-scan base-package="com.hazhir"/&gt; &lt;!--Internationalization --&gt; &lt;bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"&gt; &lt;property name="basename" value="iss.languages.text" /&gt; &lt;/bean&gt; &lt;bean id="localChangeInterseptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt; &lt;property name="paramName" value="language" /&gt; &lt;/bean&gt; &lt;bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver"&gt; &lt;property name="defaultLocale" value="en_US" /&gt; &lt;property name="cookieName" value="clientLanguage" /&gt; &lt;property name="cookieMaxAge" value="99999999"/&gt; &lt;/bean&gt; &lt;bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt; &lt;property name="alwaysUseFullPath" value="true" /&gt; &lt;property name="interceptors"&gt; &lt;list&gt; &lt;ref bean="localChangeInterseptor" /&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"&gt; &lt;property name="exposeContextBeansAsAttributes" value="true" /&gt; &lt;/bean&gt; &lt;!-- Multipart form data --&gt; &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt; &lt;property name="maxUploadSize" value="1000000000" /&gt; &lt;/bean&gt; &lt;context:annotation-config /&gt; &lt;!-- here is a right place for such configuration --&gt; &lt;task:executor id="myExecutor" pool-size="1" /&gt; &lt;task:scheduler id="myScheduler" pool-size="1" /&gt; &lt;task:annotation-driven executor="myExecutor" scheduler="myScheduler"/&gt; &lt;/beans&gt; </code></pre> <p>hope it helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload