-
15. Re: Migration to MySQL
genman May 21, 2007 6:20 PM (in response to bartek.polakowski)What's the content of your -ds.xml file? What MBean does this create when deployed?
This is really simply stuff people... -
16. Re: Migration to MySQL
bartek.polakowski May 22, 2007 4:40 AM (in response to bartek.polakowski)This is my mysql-ds file
<datasources> <local-tx-datasource> <jndi-name>MySqlDS</jndi-name> <connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>jboss</user-name> <password>jboss</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> <!-- should only be used on drivers after 3.22.1 with "ping" support <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name> --> <!-- sql to call when connection is created <new-connection-sql>some arbitrary sql</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>mySQL</type-mapping> </metadata> </local-tx-datasource> <local-tx-datasource> <jndi-name>Publication</jndi-name> <connection-url>jdbc:mysql://mysql-hostname:3306/ld_publication</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>java</user-name> <password>java</password> <min-pool-size>5</min-pool-size> <max-pool-size>15</max-pool-size> <idle-timeout-minutes>5</idle-timeout-minutes> <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name> <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name> </local-tx-datasource> </datasources>
-
17. Re: Migration to MySQL
bartek.polakowski May 22, 2007 5:30 AM (in response to bartek.polakowski)Ok one more time from the beginning. This is what I do:
1)I have mySQL ver 5.0.24a-community-nt so I copy the MySQL JDBC driver (mysql-connector-java-5.0.6-bin.jar) to the $JBOSS_HOME/server/default/lib
2)I delete $JBOSS_HOME/server/default/deploy/hsqldb-ds.xml
3)I copy $JBOSS_HOME/docs/examples/jca/mysql-ds.xml to $JBOSS_HOME/server/default/deploy and modify the <local-tx-datasource> element with my MySQL connection settings:<jndi-name>MySqlDS</jndi-name> <connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>jboss</user-name> <password>jboss</password>
4)In $JBOSS_HOME/server/default/conf/standardjaws.xml I change the <type-mapping> element to mySQL:<datasource>java:/DefaultDS</datasource> <type-mapping>mySQL</type-mapping>
5)In standardjbosscmp-jdbc.xml I change the following
<datasource>java:/DefaultDS</datasource> <datasource-mapping>mySQL</datasource-mapping> <fk-constraint>true</fk-constraint>
6)I add the following within the element of login-config.xml:<application-policy name = "MySqlDbRealm"> <authentication> <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required"> <module-option name = "principal">jboss</module-option> <module-option name = "userName">jboss</module-option> <module-option name ="password">jboss</module-option> <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option> </login-module> </authentication> </application-policy>
7) I Replace file $JBOSS_HOME/server/default/deploy/jms/hsql-jdbc2-service.xml by file $JBOSS_HOME/docs/examples/jms/mysql-jdbc2-service.xml
8) Change MySqlDS to DefaultDS in $JBOSS_HOME/server/default/deploy/jms/mysql-jdbc2-service.xml:<depends optional-attribute-name="ConnectionManager">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
9) I rename hsqldb-jdbc-state-service.xml to mysql-jdbc-state-service.xml.
And still the same:/ Maybe I use some incompatible versions of jboss and mysql or the driver is wrong? -
18. Re: Migration to MySQL
bartek.polakowski May 22, 2007 5:56 AM (in response to bartek.polakowski)Ive upgraded to mysql-5.0.41 any nothing:/
-
19. Re: Migration to MySQL
vickyk May 22, 2007 6:04 AM (in response to bartek.polakowski)1) Check the ejb-deployer.xml file you can still see the dependency on jboss.jca:service=DataSourceBinding,name=DefaultDS .
Did you applied the earlier comments which I have pointed , you don't seem to be reading the comments properly :(
I am not going to explain this again now , read it again and see what other dependencies are in Jboss which depends on java:DefaultDS jndi . -
20. Re: Migration to MySQL
bartek.polakowski May 22, 2007 6:19 AM (in response to bartek.polakowski)I can see this dependency in ejb-deployer.xml and uuid-key-generator.sar/META-INF/jboss-service.xml but Im not sure what should I do with it.
-
21. Re: Migration to MySQL
bartek.polakowski May 22, 2007 6:57 AM (in response to bartek.polakowski)Could you rephrase your advice because the problem can be my english:)
-
22. Re: Migration to MySQL
vickyk May 22, 2007 8:22 AM (in response to bartek.polakowski)I can see this dependency in ejb-deployer.xml and uuid-key-generator.sar/META-INF/jboss-service.xml but Im not sure what should I do with it.
Change the DefaultDS to MySQLDS in both the xml files ?
The MBeans in these two files are dependent on the DefaultDS which you have removed by knocking off hsqldb-ds.xml from the $JBOSS_HOME\server\default\deploy directory . -
23. Re: Migration to MySQL
bartek.polakowski May 22, 2007 8:43 AM (in response to bartek.polakowski)After Ive changed everything to MySqlDS I got:
2007-05-22 14:37:52,920 ERROR [org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin] Cannot create timer table org.jboss.deployment.DeploymentException: Error while checking if table aleady exists TIMERS; - nested throwable: (org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.UnknownHostException MESSAGE: mysql-hostname: mysql-hostname STACKTRACE: java.net.UnknownHostException: mysql-hostname: mysql-hostname
-
24. Re: Migration to MySQL
vickyk May 22, 2007 9:22 AM (in response to bartek.polakowski)<connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url>
mysql-hostname appears to me a bad IP , you can test this by pinging it . -
25. Re: Migration to MySQL
bartek.polakowski May 22, 2007 5:06 PM (in response to bartek.polakowski)Wow How could I forget it. Ok so after changing it to localhost and changing jndi name to DefaultDS there are no errors:)
The fragment of the log looks like this22:49:56,803 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jc :service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS' 22:50:01,560 INFO [A] Bound to JNDI name: queue/A 22:50:01,570 INFO [B] Bound to JNDI name: queue/B 22:50:01,570 INFO [C] Bound to JNDI name: queue/C 22:50:01,570 INFO [D] Bound to JNDI name: queue/D
Is it ok? Imasking because before there were some information that sth is CONFIGURED and now its just this. -
26. Re: Migration to MySQL
vickyk May 23, 2007 1:36 PM (in response to bartek.polakowski)Yes this is ok .
-
27. Re: Migration to MySQL
bartek.polakowski May 23, 2007 2:45 PM (in response to bartek.polakowski)Thank you for help and patience:)
-
28. Re: Migration to MySQL
faisalhelpline May 31, 2007 4:37 AM (in response to bartek.polakowski)hey
can you please repeat the entire steps with name of files you modified..
to run jboss4.0.5 with mysql. -
29. Re: Migration to MySQL
bartek.polakowski Jun 1, 2007 10:13 AM (in response to bartek.polakowski)You do everything like here:
http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpMysqlAsDefaultDS
But there is one mistake. Dont change the datasource's name to mySQL in mysql-ds.xml. It should be kept as Default.