Configuring Eclipse, JBoss & MySQL for EJB3 application development.
Rajeev R Tumkur
Greenhorn
Joined: Sep 13, 2007
Posts: 17
posted
0
Hi, I tried developing a simple EJB3 application provided in Mikalai Zaikin's SCBCD 5.0 study guide. The following are the steps to be followed for configuring Eclipse, JBoss & MySQL.
Softwares Used: Eclipse 3.3, MySQL 5.0, JBoss 5.0.X beta.
Steps Followed. ---------------------
1. Extract the JBoss tools features & plugins in to the same Eclipse folders respectively.
2. Install MySQL 5.0.
3. UnZip the JBoss server. Follow the below steps to configure mysql database as default database.
4. Remove the hsqldb.jar & hsqldb-plugin.jar from jboss-5.0.0.Beta4\server\default\lib.
5. Copy the driver libraries to jboss-5.0.0.Beta4\server\default\lib
6. You may want to edit jboss-5.x\serverdefault\deploy\jboss-ds.xml depending on database you
choose. Pre-configured *-ds.xml are available in jboss-5.x\docs\examples\jca.
7. Copy the mysql-ds.xml to jboss-5.0.0.Beta4\server\default\deploy. Remove the file hsqldb-ds.xml.
9. Delete the file server/xxx/deploy/messaging/hsqldb-persistence-service.xml
10. Copy the file examples/config/mysql-persistence-service.xml from the JBoss Messaging binary
download to the server/xxx/deply/messaging directory [Replace the file hsqldb-persistence-service.xml with mysql-persistence-service.xml C:\JBoss\jboss-5.0.0.Beta4\server\all\deploy\messaging]
11. Switch-off the clustering in the file mysql-persistence-service.xml.
Normally, you don't want a clustered post office. So, set it to false in the file mysql-persistence
-service.xml (section --> Messaging Post Office MBean configuration )
<attribute name="Clustered">false</attribute>
_ _____________ _ <br />Regards,<br />Rajeev
Daniel Jabonete
Ranch Hand
Joined: Apr 01, 2007
Posts: 74
posted
0
Hi Rajeev,
I've also doing this kind of stuff but some question raises as I go along that maybe you can help me out with.
As with regards to your post above, for EJB3 development what is the format of your persistence.xml.
And also can we have multiple <datasource> in JBoss?
Is it possible to use multiple *-ds.xml files in the deploy directory? If so, how would Jboss read them if there is a same datesource in both of them? Thanks in advance.
Yes you can place multiple *-ds.xml files in the deploy directory. Just make sure that each one uses a different <jndi-name> entry. Your apps then look up the one they want by the JNDI name.
Thanks for your reply. But, From which *-ds.xml my app will look up if I have given two <jndi-name> entires with same name, each in two different *-ds.xml, say my-ds.xml and your-ds.xml? Thanks in advance
satya anvesh wrote:But, From which *-ds.xml my app will look up if I have given two <jndi-name> entires with same name, each in two different *-ds.xml, say my-ds.xml and your-ds.xml? Thanks in advance
You should not do that. That's an error - having multiple datasources mapping to the same jndi name.
P.S: I haven't checked if it throws an error in such case, but it might end up overwriting the jndi entry with the last deployed datasource. In any case, you should not be doing that.
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
The first one will deploy (assuming it has no other problems). The second one will get a deployment error due to the duplicate name, and will not deploy.
Satya: I think you're assuming that your application will be somehow looking for the datasource by its file name (...-ds.xml),
but the file name is not relevant. Applications will look up the data source by their JNDI name, which is specified inside the XML file.