Docstoc

Installing an environment for developing J2EE applications

Document Sample
Installing an environment for developing J2EE applications Powered By Docstoc
					Installing an environment for developing
J2EE applications Enterprise Java Beans
Software
Component          Our choice Alternatives
Application                     JOnAS, Weblogic, IBM
                   JBoss
Server                          Websphere
Database           MySQL        Hypersonic, Cloudspace
Development        Eclipse +    Sun ONE Studio, netBeans,
Environment        JBoss-IDE    WebSphereStudio, JBuilder
Java-based build
                   Ant
tool
Code generation
                   XDoclet
tool



Database: MySQL 4.0 (http://www.mysql.com/)


We need a SQL-standard relational database that is accessible using JDBC. MySQL is
the most widely used and powerful Open Source database server.

Download

Download the application from here: Download

Installation

      Unzip mysql-4.0.14b-win-noinstall.zip to a directory on your
       machine – c:\ is recommended.
       NOTE: It is not recommended that you install MySQL in to a directory whose
       name contains a space. Therefore, do not use a directory such as c:\program
       files\mysql, instead use a directory such as c:\mysql or
       c:\programs\mysql.
      Note: the installation does not create a Program Folder. To do so:
           1. Create a Program Folder "MySQL 3.23.54"
           2. Create shortcut for: <install_dir>\bin\winmysqladmin.exe
   Environment Settings
    Add <install_dir>\bin to PATH (e.g. C:\MySQL\bin).
   Start Menu
    Add a shortcut to <install_dir>\bin\winmysqladmin.exe to the
    Startup menu, so it will be automatically started.
   Setup
        1. Run winmysqladmin.exe either from the start menu (Start-
           >Programs->MySQL 3.23.54->winmysqladmin) or from a command
           prompt (winmysqladmin).
        2. First time you invoke MySQLAdmin (i.e. whenever my.ini does not exist
           under C:\Windows), you will be prompted for the username/password to
           use for the administrator. Enter your choice (e.g. root/root or
           admin/admin).
        3. The MySQL admin window will come up and then immediately minimize
           into System Tray. So long as the light is green then it is running correctly
           and you can bring it up by: Right click on System Tray icon -> Option
           "Show me". If the light is red then you may want to see what errors were
           printed in the console and fix them before proceeding.
        4. By default, "mysqld" uses ISAM files, which do NOT support
           transactions. In order to support transactions that are required for
           enterprise applications, you must configure the "my.ini" file as follows:
               1. Select the "my.ini Setup" tab
               2. Check the "mysqld-max-nt" radio button,
               3. Press the "Pick-up and Edit my.ini values" button.
               4. Edit my.ini file by adding the following lines before the
                   "[WinMySQLadmin]" line. You may want to customize the
                   underlined fields; which specifies two 500MB database files are
                   created at C:\mysql\ibdata, and three 10MB log files are
                   created at C:\mysql\iblogs.

                   innodb_data_home_dir = C:\mysql\ibdata
                   innodb_data_file_path =
                   ibdata1:500M;ibdata2:500M
                   set-variable = innodb_buffer_pool_size=70M
                   set-variable =
                   innodb_additional_mem_pool_size=10M
                   innodb_log_group_home_dir = C:\mysql\iblogs
                   innodb_log_arch_dir = C:\mysql\iblogs
                   innodb_log_archive=0
                   set-variable = innodb_log_files_in_group=3
                   set-variable = innodb_log_file_size=10M
                   set-variable = innodb_log_buffer_size=8M
                   innodb_flush_log_at_trx_commit=1
                   set-variable = innodb_file_io_threads=4
                   set-variable = innodb_lock_wait_timeout=50
               5. Finally, press "Save Modification" button to save changes into
                   my.ini (under e.g. C:\Windows).
        5. Manually create the folder <ibdata location> and <iblogs
           location> (in the above "my.ini" file, it's C:\mysql\ibdata and
           C:\mysql\iblogs). You can create these directories from windows
           explorer.
        6. Now go back to the MySQLAdmin tool to re-start the MySQL service. To
           do that:
               1. Right click on the window -> Option "Win NT" -> item "Stop the
                   service".
               2. Then Right click again -> Option "Win NT" -> item "Start the
                   service".

    Note that it will take a moment to create the database files and log files as
    configured.

   Test and Validation:
       1. Make sure service "Mysql" is started. The green light in the upper right
           hand corner of the winmysqladmin window means that the service is
           started; a red light means it is stopped. If its stopped then start it by right
           click on the window -> Option "Win NT" -> item "Start the service".
       2. Test whether MySQL is working by executing the following commands
           from a Command prompt:

            >   mysqlshow
            >   mysqlshow -u root mysql
            >   mysqladmin version status proc
            >   mysql test

        3. Try to login.
              1. Open a Command window, try "mysql -u <username> -p".
                   You'll be prompted for password (use the one you specified in
                   my.ini, e.g. root/root); which will put you into the mysql
                   console.
              2. In the mysql console, enter SELECT user();. (Be sure to end
                   your SQL with semicolon.)
              3. Create the database for JBoss, for instance test.
                   CREATE DATABASE test;
              4. Add a user with host="localhost", user="jboss", and
                   password="11223344" and grant that user all privileges in the
                   table test. To do that, enter the following commands in the
                   mysql console:

                    INSERT INTO mysql.user (host,user,password)
                    VALUES ('localhost', 'jboss', '11223344');
                    GRANT ALL PRIVILEGES ON test.* TO
                      jboss@localhost IDENTIFIED BY '11223344';
                      GRANT ALL PRIVILEGES ON test.* TO jboss@'%'
                      IDENTIFIED BY "11223344";

           4. Try to login to database "test" as user "jboss": In DOS, enter "mysql
              -u jboss -p test" (Note: test here is the database name, NOT the
              password. You will be prompted for the password. After giving the
              password (11223344), you should be logged into the test database as
              the jboss user.

MySQL Control Center 0.9.3

Graphical client GUI interface to administer MySQL and data.

Download

Download the application from here: Download

Installation

Simply run the Setup.exe.

Configuration

The first time you launch the ControlCenter you have to specify how to connect to the
database.

      Name: root@localhost:3306
      Host Name: localhost
      User Name: root
      Password: root (enter the appropriate password of your configuration for the
       root user!!)

MySQL Connector/J 3.0 : official JDBC driver

Official API (Application Programming Interface)

Download

Download the API from here: Download

Installation

Unzip the downloader archive. Find the mysql-connector-java.3.0.8-
stable-bin.jar file , which will be used in the JBoss configuration.
Application Server: JBoss 3.2.2 (http://www.jboss.org/)

JBoss is an Open Source, standards-compliant, application server implemented in 100%
Pure Java and distributed for free.

Download

jboss-3.2.2.zip : includes Tomcat 4.1.27 JBossWeb HTTP server and
JSP/Servlet engine, EJB, CMP2.0, JCA, IIOP, Clustering, JTS, JMX and more

Download the application from here: Download

Installation

Simply unzip the downloaded jboss-3.2.2.zip file to your hard disk (for instance
in C:\).

Environment Settings

It may be useful to create an environment variable JBOSS_HOME with the value
c:\jboss-3.2.2.

Running

The command c:\jboss-3.2.2RC3\bin\run launches the application server.

Configuration of JBoss 3.2.2 for working with an external relational database,
MySQL, by default

      Remove Hypersonic DataSource by deleting
       \server\default\deploy\hsqldb-ds.xml
       Replace it by copying the file \docs\examples\jca\mysql-ds.xml into
       \server\default\deploy
       Edit it, i.e. it to have following content:
       <datasources>
       <local-tx-datasource>
       <jndi-name>DefaultDS</jndi-name>
       <connection-
       url>jdbc:mysql://localhost/test</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>jboss</user-name>
       <password>11223344</password>
    <security-domain>MySqlDbRealm</security-domain>
    </local-tx-datasource>

    </datasources>

   Copy mysql-connector-java.3.0.8-stable-bin.jar to
    \server\default\lib
   Edit \server\default\conf\standardjbosscmp-jdbc.xml, i.e.
    change the name and mapping of datasoure:
    <datasource>java:/DefaultDS</datasource>
    <datasource-mapping>mySQL</datasource-mapping>
    ...
    <fk-constraint>true</fk-constraint>
   Edit \server\default\conf\standardjaws.xml, i.e. change the name
    and mapping of datasoure:
    <datasource>java:/DefaultDS</datasource>
    <type-mapping>mySQL</type-mapping>
   Remove the file server\default\deploy\jms\hsql-jdbc2-
    service.xml
    Replace it by copying the file \docs\examples\jms\mysql-jdbc2-
    service.xml into server\default\deploy\jms\
    Edit it, i.e. change MySqlDS to DefaultDS (on line 47)
   Edit the file server\default\conf\login-config.xml by adding
    following block of text:

    <application-policy name = "MySqlDbRealm">
    <authentication>
    <login-module code =
    "org.jboss.resource.security.ConfiguredIdentityLoginMo
    dule"
    flag = "required">
    <module-option name = "principal">jboss</module-
    option>
    <module-option name = "userName">jboss</module-option>
    <module-option name = "password">11223344</module-
    option>
    <module-option name =
    "managedConnectionFactoryName">jboss.jca:service=Local
    TxCM,name=DefaultDS</module-option>
    </login-module>
    </authentication>
    </application-policy>
Eclipse 2.1.1 (http://www.eclipse.org/)
Universal Tool Platform

Download

Download the application from here: Download

Installation

Simply unzip the downloaded file to your hard disk. Foo example c:\

To run Eclipse, execute c:\eclipse\eclipse.exe.

JBoss - IDE 1.2.0
(http://www.jboss.org/index.html?module=html&op=us
erdisplay&id=developers/projects/jboss/jbosside)
JBoss-IDE is a project with the aim to provide a world class IDE for JBoss. JBoss-IDE is
based on the following technologies : Eclipse and XDoclet. It is a set of plug-ins.

Download

Download the set of plug-ins from here: Download

Installation

Simply copy the content of the plugins folder of the downloaded ZIP-file to
c:\eclipse\plugins and the content of the feature folder of the contained the ZIP-
file to c:\eclipse\features

Using the launcher

      Launch Eclipse.
      To use the JBoss-IDE launcher select Window> Show View > Other >
       JBoss-IDE > Server Navigator from the main menu bar. The Server
       Navigator is the control center.
      Right-click in the "Server Navigator" panel (it should have just appeared at
       the right-bottom of the eclipse window) and choose "Configuration".
      Select JBoss 3.2.x, then New.
      Define the home directory of JBoss (normally c:\jboss-3.2.2RC3) and
       change the name to JBoss-3.2.2 for example.
      Now you should be able to launch JBoss from the Java View and the "Debug"
       button.




Ant 1.5.4 (http://ant.apache.org/)
Ant is an extremely powerful Java-based project build tool (Apache Software License)

Download


XDoclet 1.2 (http://xdoclet.sourceforge.net/)
Code generation tool

Download


JUnit 3.8.1 (http://www.junit.org/index.htm)
JUnit is a unit testing framework (IBM Common Public Licence).

Download

Database: HSQLDB (http://hsqldb.sourceforge.net/)



HSQLDB, based on HypersonicSQL, is a general purpose Open Source Java Database,
FREE to use and re-distribute

Download

Java 2 SDK, Standard Edition (J2SE™ SDK), v1.4.1 or


higher
Download: http://java.sun.com/j2se/downloads.html
Java 2 SDK, Enterprise Edition (J2EE™ SDK),


v1.3.1
Download: http://java.sun.com/j2ee/sdk_1.3/

CVS
Concurrent Versions System




A free CVS Client for Windows: TortoiseCVS

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:1
posted:10/1/2011
language:English
pages:9