Announcement Announcement Module
Collapse
No announcement yet.
persistence.xml location Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • persistence.xml location

    I defined by bean as below

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityMana gerFactoryBean">
    <property name="persistenceUnitName" value="testerx" />
    </bean>

    i put my persistence.xml in /web-inf/classes/META-INF/persistence.xml

    when run, i get below error,


    body><h2>HTTP ERROR: 500</h2><pre>Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/gwt-rpc-servlet.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named testerx</pre>
    <p>RequestURI=/gwt-rpc/com/userx/client/ServerService</p><h3>Caused by:</h3><pre>org.springframework.beans.factory.BeanCrea tionException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/gwt-rpc-servlet.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named shit
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1330)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:411)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:382)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 71)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:268 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:170)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:464)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplication

  • #2
    Can you post your persistence.xml file?

    Comment


    • #3
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="1.0"
      xmlns="http://java.sun.com/xml/ns/
      persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
      http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
      <persistence-unit name="testerx" transaction-type="RESOURCE_LOCAL">
      <provider>org.hibernate.ejb.HibernatePersistence </provider>
      <properties>

      <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/gwt_ok" />
      <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
      <property name="hibernate.connection.password" value="" />

      <property name="hibernate.connection.username" value="root" />


      <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" />

      <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" />
      <property name="hibernate.hbm2ddl.auto" value="update" />

      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

      <!-- SQL stdout logging -->
      <property name="hibernate.show_sql" value="true" />
      <property name="hibernate.format_sql" value="true" />
      <property name="use_sql_comments" value="true" />

      <!-- Scan for annotated classes and Hibernate mapping XML
      files -->
      <property name="hibernate.archive.autodetection" value="class, hbm" />

      </properties>
      </persistence-unit>
      </persistence>
      i posted the persistence.xml

      Comment


      • #4
        Can you post your gwt-rpc-servlet.xml file too?

        The error trace you posted contains this weird line:
        No Persistence provider for EntityManager named shit
        Do you have a reference to "shit" there?

        Comment


        • #5
          pls ignored the "shit" keyword. i renamed it to "testerx".


          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          
          <beans xmlns="http://www.springframework.org/schema/beans"
          
          	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          
          	xmlns:aop="http://www.springframework.org/schema/aop"
          
          	xmlns:context="http://www.springframework.org/schema/context"
          
          	xmlns:jee="http://www.springframework.org/schema/jee"
          
          	xmlns:lang="http://www.springframework.org/schema/lang"
          
          	xmlns:p="http://www.springframework.org/schema/p"
          
          	xmlns:tx="http://www.springframework.org/schema/tx"
          
          	xmlns:util="http://www.springframework.org/schema/util"
          
          	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          
          		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
          
          		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
          
          		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
          
          		http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
          
          		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
          
          		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
          
          
          
          
          
          
          
          
          
          
          
          <context:annotation-config />
          	<context:component-scan base-package="com.teoh.server" />
          
          	<bean class="com.teoh.server.GwtAnnotationHandlerMapping">
          		<property name="prefix" value="/gwt-rpc/" />
          		<property name="order" value="0" />
          		<property name="alwaysUseFullPath" value="true" />
          	</bean>
          
          	<bean class="com.teoh.server.GwtRpcEndPointHandlerAdapter" />
          
          
          
          
          
          
          
          
          
          
          
          
          
          	<!-- Spring JPA Entity Manager Factory -->
          	<bean id="entityManagerFactory"
          		class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
          		<property name="persistenceUnitName" value="testerx" />	
          	</bean>
          	
          	
          	
          	
          
          
          
          	
          	
          	
          
          	<!-- Spring JPA Transaction Manager -->
          	<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
          		<property name="entityManagerFactory" ref="entityManagerFactory" />
          	</bean>
          
          	<!-- JPA annotations bean post processor -->
          	<!-- Required to load the EntityManager in the DAO -->
          	<bean
          		class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
          
          
          	<bean id="courseDao" class="com.teoh.server.service.CourseDaoImpl" />
          
          	<!-- SERVICE LAYER for Transaction Demaracation -->
          	<bean id="courseManager" class="com.teoh.server.service.CourseManagerImpl">
          		<property name="courseDao" ref="courseDao" />
          	</bean>
          
          	<!-- AOP Transaction Injection -->
          	<aop:config>
          		<aop:pointcut id="courseManagerMethods"
          			expression="execution(*
          			com.teoh.server.service.CourseManager.*(..))" />
          		<aop:advisor advice-ref="txAdvice" pointcut-ref="courseManagerMethods" />
          	</aop:config>
          	
          	
              
              
          
          	<!-- Transaction Propogation advice for the SERVICE layer -->
          	<tx:advice id="txAdvice" transaction-manager="txManager">
          		<tx:attributes>
          			<tx:method name="persist*" propagation="REQUIRES_NEW" />
          			<tx:method name="testSpringMvcJpaIntegration*" propagation="REQUIRED" />
          			<tx:method name="*" propagation="SUPPORTS" read-only="true" />
          		</tx:attributes>
          	</tx:advice> 
          
          
          
          
          	
          </beans>

          Comment

          Working...
          X