• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Configuring Eclipse, JBoss & MySQL for EJB3 application development.

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Change the below parameters in mysql-ds.xml

<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>root</user-name>
<password>root</password>

8. Download the binary files for JBoss Messaging from the below link. Make sure you get the correct

version.
http://repository.jboss.com/jboss/messaging/1.4.0.SP3-brew/resources/

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>
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Thanks in advance!

Daniel
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Daniel Jabonete:

And also can we have multiple <datasource> in JBoss?



You mean multiple datasources in a single -ds.xml? Yes, that's possible.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
satya anvesh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter

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

Anvesh
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic