Announcement Announcement Module
Collapse
No announcement yet.
Cannot parse persistence unit from class path resource [META-INF/persistence.xml] Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot parse persistence unit from class path resource [META-INF/persistence.xml]

    Hello,
    So I have this problem with my app ( no matter which tutorial i follow to implement JPA result is the same), it looks like my spring could not find persistence.xml file

    here's the error i get:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'caChainDao' defined in file [E:\STS\vfabric-tc-server-developer-2.7.2.RELEASE\zz\wtpwebapps\FCAWSv4\WEB-INF\classes\pl\some\test\ws\db\dao\caChainDao.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Cannot parse persistence unit from class path resource [META-INF/persistence.xml]
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
    	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
    	org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
    	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
    	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
    	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
    	javax.servlet.GenericServlet.init(GenericServlet.java:160)
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    	java.lang.Thread.run(Thread.java:722)
    here's my persistence.xml which is in the src/main/resources/META-INF folder

    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
        <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_2_0.xsd"
        version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
    
        <persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL" />
    
    </persistence>
    here's my Spring-ws-servlet.xml config
    Code:
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    		p:driverClassName="org.postgresql.Driver" p:url="jdbc:postgresql://localhost:5432/database"
    		p:username="postgres" p:password="pwd" p:initialSize="5" p:maxActive="10">
    	</bean>
    
    	<bean
    		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
    		id="entityManagerFactory">
    		<property name="dataSource" ref="dataSource" />
    	</bean>
    
    	<context:component-scan base-package="pl.some.test.ws.db.dao">
    		<context:include-filter type="annotation"
    			expression="org.springframework.stereotype.Repository" />
    	</context:component-scan>
    
    	<bean class="org.springframework.orm.jpa.JpaTransactionManager"
    		id="transactionManager">
    		<property name="entityManagerFactory" ref="entityManagerFactory" />
    	</bean>
    
    	<tx:annotation-driven mode="aspectj"
    		transaction-manager="transactionManager" />
    
       <context:spring-configured />
    	<context:annotation-config />
    any hints for me?
Working...
X