Wednesday, September 13, 2006

Programming: Steps for Building an Enterprise Application for JBoss Using NetBeans

Summary of steps to create a working Java EE 5 application using NetBeans, to be deployed to a JBoss application server, and persist data in a Microsoft SQL Server 2000 database.

(1) Downloads: NetBeans 5.5 Beta 2 with JBoss 4.0.4GA, Sun Java EE 5 SDK. Must have a database. I use Microsoft SQL Server 2000. Install the IDE, JDK.

(2) Install a J2SE 1.5+-aware JDBC driver, such as jTDS (extract the archive to the application server library).

(3) Data source: In the AS deploy directory, create a *-ds.xml file with configuration and JNDI information for accessing the database. Suppose the database is called [JEE5], the file shall contain:
[datasources]
[local-tx-datasource]
[jndi-name]JEE5[/jndi-name]
[connection-url]jdbc:jtds:sqlserver://localhost:1433/JEE5;tds=8.0;lastupdatecount=true[/connection-url]
[driver-class]net.sourceforge.jtds.jdbc.Driver[/driver-class>
[user-name]sa[/user-name]
[password]*****[/password]
[/local-tx-datasource]
[/datasources]
(4) Follow the steps in the EJB 3.0 Enterprise Beans for JBoss Application Server tutorial.

Only disappointments so far: the JBoss application server is not fully Java EE 5 compliant. At this time, it only supports EJB 3.0 and Hibernate 3.0.
It is advisable that you restart the server after deploying your application. For a while, my tables remained empty (no exceptions for failure to create/insert entities) until I restarted JBoss.

Notes: In #3, the data source name to use is java:/JEE5.

No comments: