Converting from Hypersonic to MYSQL
seabird Jun 17, 2004 4:23 PMThis is actually a series of messages strung together from a posting at "theserverside.com" I didn't get many helpful answers here, so I am submitting the evidence to this august group and begging for assistance.
Sorry the post is so long, I wanted to offer as much evidence as I could.
"I had a good working demo of an EJB/CMP application on the Hypersonic DB. However, Hypersonic didn't do some of the things I needed, so I "upgraded" to mysql on a windows platform.
My development environment is Eclipse 2.1.3 and Lomboz 2.1.3.
My problem comes in creating the DDs for both the mysql world and the beans themselves. I have modified the xdoclet.xml file to put in what I thought were the right pieces of data for the generation of the jbosscmp-jdbc.xml file.
Some key parts of that are as follows:
<jbosscmp-jdbc>
mySQLDS
<datasource-mapping>mySQL</datasource-mapping>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
-------------------------------------------------------
The following is the log output from the deployment in jboss
Depends On Me: , ObjectName: jboss.j2ee:jndiName=RoleBean,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc
.xml : datasource-mapping mySQLDS not found, ObjectName: jboss.j2ee:jndiName=Per
sonBean,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc
.xml : datasource-mapping mySQLDS not found]
-----------------------------------------------------------
The following is the sum total of my mysql-service.xml file. This file is in the jboss/server/default/deploy folder. I found the skeleton of this file in the jboss/docs/examples/jca directory. There was a recommendation on one site (I have forgotten which) that I modify this file. It is somewhat worrying that the comments in the file suggest that it is for mySQL 2.011 and I am using release 3.2.3 of JBOSS.
Any help would be greatly appreciated. I am fast losing hair - I keep tearing it out!
Chris Bird - see XML below.
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- $Id: mysql-ds.xml,v 1.1 2002/07/22 22:57:24 d_jencks Exp $ -->
<!-- ==================================================================== -->
<!-- Datasource config for MySQL using 2.0.11 driver -->
<!-- ==================================================================== -->
<local-tx-datasource>
<jndi-name>mySQLDS</jndi-name>
<connection-url>jdbc:mysql://localhost/kipoko</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>chris</user-name>
</local-tx-datasource>
I then followed the Chapter 8 - Using Other Databases of the JBoss 3.2 Getting Started PDF file located here http://www.jboss.org/docs/index to setup MySQL database to use with JBosss.
I changed my jbosscmp-jdbc.xml to look like the following:
-----------------------------------------------------------------------------
<jbosscmp-jdbc>
java:/DefaultDS
<datasource-mapping>mySQL</datasource-mapping>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
-----------------------------------------------------------------------------
The mysql-service.xml (in the deploy directory) looks like the following. Note that apart from comments this is the whole file. It would appear to me that there ought to be more than this.
-----------------------------------------------------------------------------
<local-tx-datasource>
<jndi-name>DefaultDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/kipoko</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>chris</user-name>
</local-tx-datasource>
-------------------------------------------------------------------------------
When i go to http://localhost:8080/jmx-console to look at what has been deployed, I am not exactly sure what to look for, but here are some indications that things are not right:
In the section jboss.jdbc there is 1 service: text says
service=SQLExceptionProcessor
If I go to the JNDIView service, I would expect to see a DefaultDS service under the java namespace. It isn't there. That confirms the error messages from the jbossdeployer, but doesn't solve the problem for me! My guess is that the mysql-service.xml did not deploy correctly, but the log file entries don't confirm that. Here is the extract from the log....
------------------------------------------------------------------------------
2004-06-17 10:03:44,310 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/D:/jboss/jboss-3.2.3/server/default/deploy/mysql-service.xml
2004-06-17 10:03:44,360 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/D:/jboss/jboss-3.2.3/server/default/deploy/mysql-service.xml
-------------------------------------------------------------------------------
The actual error messages in the log for the failure to deploy my beans are:
-----------------------------------------------------------------------------
ObjectName: jboss.j2ee:jndiName=PersonBean,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Error: can't find data source: java:/DefaultDS; - nested throwable: (javax.naming.NameNotFoundException: DefaultDS not bound)]
-----------------------------------------------------------------------------
Any (and all) further help greatly appreciated. If anyone would prefer to get in touch offline, then feel free to email me at:
seabird(nospam)@msn.com.
Of course, you would need to remove the (nospam) entry!
There is clearly something squirrely here. It doesn't seem to matter what entry I put in here
<driver-class>com.mysql.jdbc.Driver</driver-class>
Even if I comment out this line, jboss claims to deploy it correctly (according to the log). So I am truly confused. "
Thanks in advance:
Chris