Announcement Announcement Module
Collapse
No announcement yet.
Intgrating Sping and Gwt:A bean connot been created Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Intgrating Sping and Gwt:A bean connot been created

    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:

    applicationContext.xml

    Code:
    <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
    Code:
    <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>
    persistence.xml
    Code:
    <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:
    Code:
    @Repository("customerDAO")
    public class CustomerDAO extends JpaDAO {
    
    @PersistenceUnit(unitName = "amine")
    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:
    Code:
    @RemoteServiceRelativePath("springGwtServices/customerService")
    public interface CustomerService extends RemoteService
    ServiceImpl:

    Code:
    @Service("customerService")
    
    
    public class CustomerServiceImpl implements CustomerService {
    
    @Autowired
    private CustomerDAO CustomerDAO;
    
    @PostConstruct
    public void init() throws Exception {
    }
    
    @PreDestroy
    public void destroy() {
    }
    error log:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerDAO': Injection of persistence dependencies failed; nested exception is 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
    at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:341)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1055)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
    at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Working...
X