This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Deploying EJB using MySql as a datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Deploying EJB using MySql as a datasource" Watch "Deploying EJB using MySql as a datasource" New topic

Deploying EJB using MySql as a datasource

Mary Taylor
Ranch Hand

Joined: Sep 11, 2000
Posts: 327
JBoss is giving the following two errors when deploying an Entity Bean using MySql as the data source. I can send any additional configuration files you wish to see. I do have an application.xml file in the location where JBoss indicates the file is missing.
In reference to the first error, I did a search within the configuration files to find where JBoss might be requesting the "30.mysql-ds.xml" file and found no file calling for such a file. There is a "mysql-ds.xml" file in the location where JBoss says it is looking for the "30.mysql-ds.xml" file.
Here are the log file errors from JBoss. Thank you for any assistance. I have been working on this diligently for two grad school assignments but am stymied with the projects due next Monday. I've researched JBoss and MySql issues for a week now. Appreciate any direction.
JBoss jboss-3.2.1_tomcat-4.1.24
MySql 4.-.13-nt
MyEclipse 3.0
2:56:52,964 ERROR [MainDeployer] Could not make local copy for
file:/C:/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/mysql-ds.xml C:\jboss-3.2.1_tomcat-4.1.24\server\default\tmp\deploy\server\default\deploy\mysql-ds.xml\30.mysql-ds.xml (The system cannot find the path specified)
2004-03-04 23:24:48,073 ERROR [org.jboss.deployment.scanner.URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@1ffaef8{ url=file:/C:/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/MSCO676Lab3.ear/, deployedLastModified=0 }
org.jboss.deployment.DeploymentException: exception in init of file:/C:/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/MSCO676Lab3.ear/; - nested throwable: (org.jboss.deployment.DeploymentException: No META-INF/application.xml found)
Here is the mysql-ds.xml:
Here is the application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "">
<module id="myeclipse.1075431673085">
<module id="myeclipse.1075431673846">

Here is my login-conf.xml also:
<?xml version='1.0'?>
"-//JBoss//DTD JBOSS Security Config 3.0//EN"
<!-- The XML based JAAS login configuration read by the mbean. Add
an application-policy element for each security domain.
The outline of the application-policy is:
<application-policy name="security-domain-name">
<login-module code="" flag="control_flag">
<module-option name = "option1-name">option1-value</module-option>
<module-option name = "option2-name">option2-value</module-option>
<login-module code="" flag="control_flag">
$Revision: $
<!-- Used by clients within the application server VM such as
mbeans and servlets that access EJBs.
<application-policy name = "client-login">
<login-module code = ""
flag = "required">
<!-- Security domain for JBossMQ -->
<application-policy name = "jbossmq">
<login-module code = ""
flag = "required">
<module-option name = "unauthenticatedIdentity">guest</module-option>
<module-option name = "sm.objectname"></module-option>
<!-- Security domains for testing new jca framework -->
<application-policy name = "HsqlDbRealm">
<login-module code = ""
flag = "required">
<module-option name = "principal">sa</module-option>
<module-option name = "userName">sa</module-option>
<module-option name = "password"></module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
<application-policy name = "FirebirdDBRealm">
<login-module code = ""
flag = "required">
<module-option name = "principal">sysdba</module-option>
<module-option name = "userName">sysdba</module-option>
<module-option name = "password">masterkey</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=XaTxCM,name=FirebirdDS</module-option>
<application-policy name = "JmsXARealm">
<login-module code = ""
flag = "required">
<module-option name = "principal">guest</module-option>
<module-option name = "userName">guest</module-option>
<module-option name = "password">guest</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=TxCM,name=JmsXA</module-option>
<!-- A template configuration for the jmx-console web application. This
defaults to the UsersRolesLoginModule the same as other and should be
changed to a stronger authentication mechanism as required.
<application-policy name = "jmx-console">
<login-module code=""
flag = "required" />
<!-- The default login configuration used by any security domain that
does not have a application-policy entry with a matching name
<application-policy name = "other">
<!-- A simple server login module, which can be used when the number
of users is relatively small. It uses two properties files:, which holds users (key) and their password (value)., which holds users (key) and a comma-separated list of their roles (value).
The unauthenticatedIdentity property defines the name of the principal that will be used when a null username and password are presented as is the case for an unuathenticated web client or MDB. If you want to allow such users to be authenticated add the property, e.g.,
<login-module code = ""
flag = "required" />
I read that I can use the getConnection(user,pswd) for login without defining a security domain in the login-config.xml, but that if I did define one, it would take precedence. As you can see, I have not done so.
Thanks to anyone who can read through all this and assist.
[ March 05, 2004: Message edited by: Betty Schwartz ]
[ March 05, 2004: Message edited by: Betty Schwartz ]
[ March 05, 2004: Message edited by: Betty Schwartz ]
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Moving to the JBoss forum...
Mary Taylor
Ranch Hand

Joined: Sep 11, 2000
Posts: 327
If I do need to create an entry in login-conf.xml,I would appreciate some clarification on the entries. The module-opion name of "principal" - how is that created in the database? I assume the username and password are those I use in my getConnection request. I guess I don't understand the connection between the login-conf and my application. My next class is a database admin class; but, meanwhile, I'm a bit rusty and have been looking on the web but not finding information aout the simple things sometimes.
A message at indicates I do not have to have a login-conf.xml entry for MySql, but some seem to think I cannot accomplish the deployment without one. As always there are many paths to go down.
Thanks again,
Rashmi Banthia
Ranch Hand

Joined: Dec 22, 2003
Posts: 79
I also have similar configuration. Here is what I did :
Modified login-config.xml, standardjbosscmp-jdbc.xml and mysql_db-service.xml (listed below only the modification) :
<!-- login-config.xml -----changes only ----->
<application-policy name="MySqlDbRealm">
<login-module code="" flag="required">
<module-option name="principal">rashmi</module-option>
<module-option name="userName">rashmi</module-option>
<module-option name="password">rashmi</module-option>
<module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
<!---standardjbosscmp-jdbc.xml -----changes only --->



<cmp-field><field-name>emp_id</field-name> </cmp-field>
<cmp-field> <field-name>ssn</field-name> </cmp-field>
<cmp-field> <field-name>firstname</field-name> </cmp-field>
<cmp-field> <field-name>lastname</field-name> </cmp-field>
<cmp-field> <field-name>streetaddress</field-name> </cmp-field>
<cmp-field> <field-name>city</field-name> </cmp-field>
<cmp-field> <field-name>state</field-name> </cmp-field>
<cmp-field> <field-name>zip</field-name> </cmp-field>
<cmp-field> <field-name>comments</field-name> s</cmp-field>
<!--- mysql_db-service.xml -----changes only ---->
<!--embedded mbean-->
<mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=MySqlDS">
<attribute name="JndiName">MySqlDS</attribute>
<attribute name="ManagedConnectionFactoryProperties">
<config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/learnejb</config-property>
<config-property name="DriverClass" type="java.lang.String"></config-property>
<!--set these only if you want only default logins, not through JAAS -->
<config-property name="UserName" type="java.lang.String">rashmi</config-property>
<config-property name="Password" type="java.lang.String">rashmi</config-property>
Hope it helps.
I agree. Here's the link:
subject: Deploying EJB using MySql as a datasource
It's not a secret anymore!