I am trying to integrate Spring 3,Jpa and Gwt using Spring4gwt , but I am getting an exception while spring tries to create a Bean , my xml and the error stack trace below:
Note :I am not using maven
applicationContext.xml:
<context:component-scan base-package="man.artis" /> <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/> <task:executor id="myExecutor" pool-size="5"/> <task:scheduler id="myScheduler" pool-size="10"/> <tx:annotation-driven/> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <property name="persistenceUnitName" value="amine" /> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean>
web.xml:
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>springGwtRemoteServiceServlet</servlet-name> <servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>springGwtRemoteServiceServlet</servlet-name> <url-pattern>/rututto/springGwtServices/*</url-pattern>
</servlet-mapping><listener>
persistence.xml
<persistence-unit name="amine" transaction-type="RESOURCE_LOCAL" > <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>man.artis.shared.dto.CustomerDTO</class> <properties> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.show_sql" value="false"/> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/> <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /> <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost;databaseName=SPRING" /> <property name="hibernate.connection.username" value="artisanat" /> <property name="hibernate.connection.password" value="artisanat" /> <property name="hibernate.c3p0.min_size" value="5"/> <property name="hibernate.c3p0.max_size" value="20"/> <property name="hibernate.c3p0.timeout" value="300"/> <property name="hibernate.c3p0.max_statements" value="50"/> <property name="hibernate.c3p0.idle_test_period" value="3000"/> </properties> </persistence-unit>
DAO:
@Repository("customerDAO")
public class CustomerDAO extends JpaDAO {
@Autowired EntityManagerFactory EntityManagerFactory; @PostConstruct public void init(){ super.setEntityManagerFactory (EntityManagerFactory); } public abstract class JpaDAO<K, E> extends JpaDaoSupport { protected Class<E> entityClass; @SuppressWarnings("unchecked") public JpaDAO() { ParameterizedType genericSuperclass = (ParameterizedType) getClass() .getGenericSuperclass(); this.entityClass = (Class<E>) genericSuperclass .getActualTypeArguments()[1]; } public void persist(E entity) { getJpaTemplate().persist(entity); }
service:@RemoteServiceRelativePath("springGwtServices/customerService") public interface CustomerService extends RemoteService
ServiceImpl:
@Service("customerService") public class CustomerServiceImpl implements CustomerService { @Autowired private CustomerDAO CustomerDAO; @PostConstruct public void init() throws Exception { } @PreDestroy public void destroy() { }
Iam getting this error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named amine
Note:
- I am not using Maven.
- Is there any other way/tutorial to integrate Gwt,Spring & JPA/Hibernate?
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment