seam & tomcat & no ejb3 -> EntityManager configuration problem
martinvich May 16, 2009 5:48 PMHello, i would like to try use Seam with Spring (and without ejb3) on Tomcat. There is not much information about using Seam without ejb3. I have some configuration issues, could you check if my configuration does make sense ?
I have this exception when server starts :
SEVERE: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener org.jboss.seam.InstantiationException: Could not instantiate Seam component: MY_EntityManagerFactory . . . Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named seamSpringProject-PU
context.xml
<Resource name="MyCustomContextRecource" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="root" password = "root" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/recepce"/>
persistence.xml
<persistence-unit name="seamSpringProject-PU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:comp/env/MyCustomContextRecource</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> </properties> </persistence-unit>
components.xml
<core:init debug="true" jndi-pattern="java:comp/env/#{ejbName}"/> <component name="org.jboss.seam.debug.hotDeployFilter"> <property name="urlPattern">*.seam</property> </component> <transaction:entity-transaction entity-manager="#{MY_entityManager}"/> <persistence:managed-persistence-context name="MY_entityManager" auto-create="true" entity-manager-factory="#{MY_EntityManagerFactory}"/> <persistence:entity-manager-factory name="MY_EntityManagerFactory" persistence-unit-name="seamSpringProject-PU"/> <core:manager concurrent-request-timeout="500" conversation-timeout="120000" conversation-id-parameter="cid" parent-conversation-id-parameter="pid"/>
I would like to use configuration described above to create a small web application.
I need Seam because is easy for me to implement all ajax/pageflow things, and when i will need implement some transaction things i can easily use Spring.