aspose file tools
The moose likes JBoss and the fly likes Configuring Eclipse, JBoss & MySQL for EJB3 application development. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "Configuring Eclipse, JBoss & MySQL for EJB3 application development." Watch "Configuring Eclipse, JBoss & MySQL for EJB3 application development." New topic
Author

Configuring Eclipse, JBoss & MySQL for EJB3 application development.

Rajeev R Tumkur
Greenhorn

Joined: Sep 13, 2007
Posts: 17
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>


_ _____________ _ <br />Regards,<br />Rajeev
Daniel Jabonete
Ranch Hand

Joined: Apr 01, 2007
Posts: 74
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
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8145
    
  52

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.


[My Blog] [JavaRanch Journal]
satya anvesh
Greenhorn

Joined: Sep 23, 2008
Posts: 16
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.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5536

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.


JBoss In Action
satya anvesh
Greenhorn

Joined: Sep 23, 2008
Posts: 16
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
Marshal

Joined: Jul 20, 2005
Posts: 8145
    
  52

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
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configuring Eclipse, JBoss & MySQL for EJB3 application development.
 
Similar Threads
javax.jms.JMSSecurityException: User null is NOT authenticated
configure jboss 6 with mysql
problem in setting mySql as default database server
Error in LookUP in JBOSS 5.0.0.Beta4 EJB3.0
MySql and JBoss