This content has been marked as final.
Show 2 replies
-
1. Re: Changing Test DataSource
thejavafreak Mar 11, 2008 3:07 AM (in response to jyelloz)Show us your persistence.xml here
-
2. Re: Changing Test DataSource
wujekleon Jun 18, 2009 11:31 PM (in response to jyelloz)Hello
I am facing a similar problem I am using Seam 2.1.1GA. I want to use a different database for testing. I have tried various locations and configurations, but didn't succeed.
Steps that i have taken:
- I have created a Seam project useing JBoss Seam tools (EAR with Test project)
- I hava generated a entities useing Seam Generate Entities
- I have taken a glance in Seam tutorail and it said:
By default, a generated project will use the java:/DefaultDS (a built in HSQL datasource in Embedded JBoss) for testing. If you want to use another datasource place the foo-ds.xml into bootstrap/deploy directory.So I have moved to bootstrap/deploy following file:
test-src/META-INF/forms-test-ds.xml
<datasources> <local-tx-datasource> <jndi-name>formsDatasourceTest</jndi-name> <connection-url>jdbc:mysql://localhost:3306/formsTest</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>formsTest</user-name> <password></password> </local-tx-datasource> </datasources>
While Application datasource files in project-ear/rsources/ has following content
<datasources> <local-tx-datasource> <jndi-name>formsDatasource</jndi-name> <connection-url>jdbc:mysql://localhost:3306/forms</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>forms</user-name> <password>forms</password> </local-tx-datasource> </datasources>
as result i have recieved following stack trace
org.jboss.deployment.DeploymentException: Error during install jboss.jca:service=ManagedConnectionFactory,name=formsDatasourceTest at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:52) at org.jboss.system.ServiceController.install(ServiceController.java:277)
persitance.xml in project-ejb/ehbModule/META-INF has following content:
<persistence-unit name="forms"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/formsDatasource</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="validate"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/formsEntityManagerFactory"/> </properties> </persistence-unit>
I would be very gratefull for your help.
best regrads
Mathew