Java Open Source Project Development Gold Partners (Tomcat 4.x, JBoss 3.x, MySQL 3.x, Eclipse 2.x) (ZZ)

xiaoxiao2021-03-06  67

PURPOSETHIS ARTICLE COVERS Setting Up Up The Following Open Source Tools for J2EE 1.3 Development.

- Tomcat 4.x for servlet 2.3 and JSP 1.2 - JBoss 3.x for EJB 2.0, JMS 1.1, JCA 1.0, And Jaxp 1.1 - MySQL 3.x for Rdbms Persistence - Eclipse for Java IDE * THESE INSTRUCTIONSASSUME Windows Platform. Linux Needs Slightly DiffERENT URLS & Similar Steps.

* FOLLOWING The Order Herein is Recommended.

COMING Soon ...

This Documentation Will Get Diligent Update, Catching Up with Latest Builds of The Tools. So please come for updates.

- Ant Integration with Eclipse.- Code Examples.- XDoclet Integration Into Eclipse for EJB Developments.

Revision History

- 4/18, Added "Upgrade" Entry for Each Section. JBoss 3.0.0, Release Candidate 1. Eclipse Milestone 5 (Build 20020416) .Sysdeo Version 0.96 and Genuitec Version 1.0EA4 (for Eclipse M5). - 4/02, (minor) Tomcat, Version 4.0.4 Beta 2. Sysdeo Plugin, Version 095. - 3/23, (Minor) Eclipse, Updated with build 20020321. - 3/20, jboss 3.0.0, added beta2 self-build notes- 3/15, (Minor) Eclipse, Build 20020214 Notes for Working with EJB. - 3/15, Mysql Added, And ITS Integration with Jboss. - 3/13 (Minor) JBoss, Disabling Clustering. - 3/11, J2EE 1.3 with Eclipse (JBoss Added). - 2/20, JSP / Servlet with Eclipse and Tomcat.

Quick Reference

Software (Click for Details) Current Version Vendor J2EE Installation JDK 1.4.0 Sun J2SE 1.4 Install Tomcat (Open Source) 4.0.4 Beta 2 Apache J2EE 1.3 (servlet 2.3, JSP 1.2, etc.) Unzip JBoss (OEPN SOURCE) 3.0. 0 Release Candidate 1 JBoss Group J2EE 1.3 (EJB 2.0, JMS 1.1, JCA 1.0, JAXP 1.1, etc.) UnziporBuild MySQL (Open Source) 3.23.49 MySQL AB RDBMS Install Eclipse (Open Source) 2.0, pre-release build 20020321 Eclipse Java IDE Unzip Eclipse Tomcat Plugin 0.96 Sysdeo (France) IDE PLUGIN UNZIP Eclipse JBoss Plugin 1.0ea4 Genuitec IDE PLUGIN UNZIPINSTALLING JDK

Version 1.4.0 Download Get Get Binary J2SDK-1_4_0-win.exe at http://java.sun.com/j2se/1.4/download.html* Be Sure To Download The SDK, NOT JUST THE JRE.Documentation - Online - HTTP : //java.4/docs/Index.html- Downloadable - http://java.sun.com/j2se/1.4/download.html Install Run The Executable Which Will Install The Following:

Java 2 SDK, SE V1.4.0 Java 2 Runtime Environment, SE V1.4.0 Java Plug-in 1.4.0 Java Web Start (1.0.1) Environment Set Variable Java_Home TO (EG C: /JDK1.4) . Make Sure / bin is in your path (eg c: /jdk1.4/bin). Test Open a dos windows, try java -version and you shouth get: java version "1.4.0" Java (TM 2 RuntIme Environment, Standard Edition (Build 1.4.0-B92) Java Hotspot (TM) Client VM (Build 1.4.0-B92, Mixed Mode)

Installing Tomcat

Version 4.0.4 Beta 2 Download Get Zip Binary At http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.4-b2/bin/jakarta-tomcat-4.0.4-b2-01 .zip (General download at http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release.) * Also available is an Install version, which can run as Windows service Not recommeded for development.Documentation -. Online - http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html-doc - (after installation) at% Tomcat_Home% / WebApps / Tomcat-DOCS / INDEX.HTML (Also Accessible At http: / /LOCALHOST:8080/tomcat-docs/index.html, if Tomcat is Started on Port 8080) Upgrade from Previous Version - Rename Your Previous Installation (Say C: /jakarta-tomcat-4.0.2 to c: / jakarta-tomcat- 4.0.2_old). And remove it after you get the new version up for a while.- After the installation, copy the old server.xml (or preferrably, just the context you added) to the new.- After the installation, go Over Other Tomcat Related Sections and Check for Applicable Changes. INS Tall Unzip to Destination (Say C: /, Which Makes to be c: /jakarta-tomcat-4.0.4-b2-01) .environment set variable tomcat_home to (EG C: / JAKARTA- Tomcat-4.0.4-b2-01) .Test "CD% Tomcat_Home% / bin" and "startup" (Startup.bat), You Should See --- Starting Service Tomcat-StandalongongApache Tomcat / 4.0.4-B2Starting Service Tomcat -ApacheApache Tomcat / 4.0.4-b2 Now that Tomcat is up, access http: // localhost: 8080 from your browser.Other o Installing Sysdeo Eclipse Tomcat Launcher Plugin (refer to the later section) o Integrating Tomcat with JBoss (refer to The Later Section) Installing Jboss

Version 3.0.0 Release Candidate 1 (soon will add a seperate section on building 3.1.0 Alpha by yourself) Download Get zip binary from SourceForge at http://prdownloads.sourceforge.net/jboss/jboss-3.0.0RC1.zip ( General download at http://sourceforge.net/project/showfiles.php?group_id=22866.)* Also available is a Tomcat-integrated version at http://prdownloads.sourceforge.net/jboss/jboss-3.0.0RC1_tomcat- 4.0.3.zip. We prefer Having seperated Tomcat INSTEAD of the Integrated Version, Especially For Development, for The Following Reason:

Debugging web application is harder - need to do build into .ear instead of using Tomcat server.xml to point to code Encountered class loader problem from Tomcat to integrate with JBoss Documentation - Free online manual (somewhat outdated):.. Http: // Www.jboss.org/online-manual/html/index.html- jboss documentation site: http://www.jboss.org/doco.jsp.upgrade from Previous Version - Rename Your Previous Installation (Say C: / JBoss 3.0.0beta2 to C: /jboss-3.0.0beta2_old) and remove it after you get the new version up for a while.- After the installation, go over other JBoss related sections and check for applicable changes Install Unzip to destination (.. Say C: /, Which makes to be c: /jboss-3.0.0rc1) .environment set variable jboss_dist to (eg c: /jboss-3.0.0rc1) .test make Sure you don ' T Have Tomcat Running, AS It Would Conflict With Jboss over Port 8080. (Integration IS Covered In a Later Section.) "CD% JBoss_Dist% / BIN" and "run.bat), you Should See Con Sole Output and Eventually --- 14: 44: 35,075 Info [Server] JBoss (MX Microkernel) [3.0.0rc1 date: 200204150356] Started In 0m: 22S: 383ms Check Console or logfile (% jboss_dist% / server / default / log /server.log), You Should Only See "Info", "Warn" or "debug"

outputs.Try http: // localhost: 8080, you should see Tomcat document and example - this is served through the embedded Jetty JSP / Servlet container (not Tomcat) .Also, try http: // localhost: 8082, you should see the JMX management console.Other o Disable clustering: If you might ever run JBoss on your machine without a network, you want to do this.- Create a subfolder% JBOSS_DIST / server / default / deployBackup.- Move file% JBOSS_DIST% / server / default / deploy / cluster-service.xml away into% JBOSS_DIST% / server / default / deployBackup. Installing Genuitec Eclipse JBoss Plugin (see below) Integrating Tomcat with JBoss (see below) Integrating JBoss with MySQL (see below) Version 3.1.0 Alpha, Self-Build (or See a Previous Section For Downloading 3.0.0 RC1) COMING SOON ...

Installing mysql

Version 3.23.49download get zip binary at http://mirror.sit.wisc.edu/mysql/downloads/mysql-3.23/mysql-3.23.49-win.zip (general Download At http://www.mysql.com /downloads/mysql.html.)** 4.0 is Still in Alpha As off 3/14/2002, so 3.23 is recommentation for the time being.documentation - local: (after install dir> /DOCS/Manual_toc.html- Online Documentation: http://www.mysql.com/documentation/index.htmlupgrade from Previous Version COMING SOON ... INSTALL - UNZIP TO A TEMP DIR (EG, C: / TEMP / MySQL_INSTALL) - Run setup.exe to install . (eg, into C: /mysql3.23) * The installation does not create Program Folder Following recommend:. (1) Create a Program Folder "MySQL 3.23" (2) Create shortcut for: / bin / winmysqladmin . EXE /bin/mysqlmanager.exeenvironment add to Path (EG C: /MYSQL3.23) .Setup (Also to Enable InnoDB) - Run Winmysqladmin.exe (Under Bin Subfolder): 1. First Time (when My.ini Does Not Exist under Windows Directory, EG C: / WINNT), You WILL B e prompted for username / password Enter your choice (eg mysqladmin / mysqladmin) .2 Its window will come up and then minimize into System Tray Bring it up by:... Right click on System Tray icon -> Option "Show me". 3. By default, "mysqld" is used which has only ISAM, which does NOT support transaction To use "mysqld-max" with InnoDB or BDB enabled (supporting transactions), configure my.ini as following:. Select tab "my. Ini setup "-> SELECT" mysqld-max "-> in editor for my.ini: [mysqld] ... [winmysqladmin] ... add the folowing before line" [winmysqladmin] ", Be Sure to Customize At Least The Underlined Fields: InnoDB_Data_Home_Dir =

C: /mysql3.23/ibdatainnodb_data_file_path = ibdata1: 500M; ibdata2: 500Mset-variable = innodb_buffer_pool_size = 70Mset-variable = innodb_additional_mem_pool_size = 10Minnodb_log_group_home_dir = C: /mysql3.23/iblogsinnodb_log_arch_dir = C: /mysql3.23/iblogsinnodb_log_archive=0set-variable = innodb_log_files_in_group = 3set-variable = innodb_log_file_size = 10Mset-variable = innodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 1set-variable = innodb_file_io_threads = 4set-variable = innodb_lock_wait_timeout = 50 * The above specifies that two 500MB database files be created at C: /mysql3.23/ibdata And Three 10MB log files created at c: / mysql3.23/iblogs.then click "Save Modification" to save the change Into my.ini (Under Eg C: / Winnt) .4 .manally create the folder And (in the Above Example, It's C: /Mysql3.23/IBData and C: /Mysql3.23/iblogs) .5. Start The Server ("MySQL": Right Click on the window -> Option "WIN NT" -> Item "Install the service" Then Right Clic K Again -> Option "WIN NT" -> Item "Start The Service" .it Will Take A Moment To Create The Database Files and Log Files AS Configured.test 1. Make Sure Service "MySQL" is Started.2. Try To Login.- Open a command window, try "mysql -u -p". You'll be propted for password (use the one you specified in my.ini, eg mysqladmin / mysqladmin). - you are in mysql console "Select user ();" select 1 1; "(Be sure to end your sql with semicolon).) 3. Add a user - username" developer ", and password" mysql "

............................................................. .. Enter "MySQL -U Developer -P Test" (NOTE: TEST Here is The Database Name, Not The Password. Password Will Be Pass, You Should Be in Test As Developer: - TRY "SELECT User "and you shop get" developer @ localhost ". - Try Creating a Table and Put Some Data: Creger Null Table1 (ID Integer Null, Data VARCHAR (1), Primary Key (ID)) TYPE = InnoDB; Insert Into Table1 (ID, DATA) VALUES (1, 'One'); INSERT INTO TABLE1 (ID, DATA) VALUES (2, 'Two'); Insert Into Table1 (ID, DATA) VALUES (3, 'Three'); SELECT * FROM table1; Note: * The default CREATE TABLE creates table as type ISAM, which does not support transaction Include clause "type = InnoDB" in your CREATE TABLE statement as the above, then your table will have transaction support * By default.. AutoCommit is on. To Turn IT OFF, Do "set autocmit = 0;". Other integrating jboss with mysql (see Below) Installing Eclipse

Version 2.0, Milestone 5 (pre-release, build 20020416) .Download Get zip binary at http://64.38.198.171/downloads/drops/S-M5-200204161340/download.php?dropFile=eclipse-SDK-20020416-win32 .zip (General Download At http://www.eclipse.org/downloads/index.php) Documentation - Eclipse FAQ: http://www.eclipse.org/eclipse/faq/eclipse-faq.html- Documentation Site: http://www.eclipse.org/eclipse/index.html (Currently only 1.0 docs) - Searching News / Mailing archive: http://www.eclipse.org/search/search.cgi Upgrade from Previous Version - Rename your previous installation (say C: / eclipse to C: / eclipse_old) And remove it after you get the new version up for a while.- After the installation, copy your workspace over (from C:. / eclipse_old / workspace / to C: . /eclipse/workspace).- After the installation, go over other Eclipse related sections and check for applicable changes Install Unzip to destination (say C: /, which makes to be C: / eclipse) .Test- You SHOULD HAVE A JDK Installed (if you u se Sun JDK, 1.4.0 is recommended for hot code replacement support) .- Start Eclipse and it would detect the JDK (through% JAVA_HOME%) - You can also manually specify VM (option -vm ) - Specify workspace location if do not want the default (option -data Item "Preferences" -> Option Workbench -> "Open a new perspective" -> Select " In the Same Window "-> Uncheck" Reuse Perspective with Same Input "Other Tomcat Plugin for Eclipse (See Below) JBoss Plugin for Eclipse (See Below) Installing Sysdeo Eclipse Tomcat Launcher Plugin

. Version 0.96Download Get binary tomcatPluginV096.zip at http://www.sysdeo.com/eclipse/tomcatPluginV096.zip(General page at http://www.sysdeo.com/eclipse/tomcatPlugin.html) Documentation Online instruction: http : //www.sysdeo.com/eclipse/tomcatPlugin.htmlUpgrade from Previous Version - If you did NOT just install a new version of Eclipse, remove the old plugin directory (for example, C: /eclipse/plugins/com.sysdeo. Eclipse.tomcat /) Install unzip to / Plugins (The Plugin Will Reside Under "Eclipse Install Dir> /plIPse.tomcat) .configure Eclipse

Start Eclipse. Configure tomcat plugin.menu "Workbench" -> item "preferences" -> option "tomcat" -> "tomcat version", select "4.x" -> "Tomcat Home", Specify - > Under Option "Tomcat", Suboption "JVM Settings" -> "ClassPath", add the jar / zip for Tools.jar. (If you use JDK 1.4 AT C: /JDK1.4, IT IS "C: / JDK1. 4 / lib / Tools.jar "). This is for compiling jsp. Set classpath variable tomcat_home for project ClassPath Reference.Menu" Workbench "-> item" preferences "-> option" java "-> option" classpath variables "-> New variable, name "TOMCAT_HOME", value (Then in .classpath of your project, you use TOMCAT_HOME for variable references.) Make sure Tomcat menu accessible.Set to "Java" perspective, and make sure Tomcat menu and ITS 3 Toolbar Buttons Are Available. (IF NOT, MENU PERSPECTIVE -> Item "Customize" -> Option "Other" -> option "Tomcat", check it.) Use menu or Toolbar to Start / stop Tomcat (The Plugin Will Start / stop Tomcat as a debugging mode vm InsID . E Eclipse, so debugging into Servlets and JSP-generated-Servlets becomes possible) Note: For your Eclipse project, .classpath needs this to compile Servlets: Installing Genuitec Eclipse JBoss Plugin

Version 1.0EA4Download Get zip binary http://www.genuitec.com/products/EASIEJBoss1.0ea4.zip(General page at http://www.genuitec.com/products.htm#easie.) Documentation Online instruction (PDF) : http://www.genuitec.com/products/Eclipse_JBoss.pdfUpgrade from Previous Version - If you did NOT just install a new version of Eclipse, remove the old plugin directory (for example, C: / eclipse / plugins / com. genuitec.eclipse.easie.core / and C: /eclipse/plugins/com.genuitec.eclipse.easie.jboss/) Install Unzip to (the plugin will reside under / plugins as subfolder Com.Genuitec.eclipse.easie.core and com.genuitec.eclipse.easie.jboss.configure eclipsestart Eclipse. configure jboss plugin.Menu "Workbench" -> Item "preferences" -> Option "jboss":

"JBoss Home Directory": (eg C: /jboss-3.0.0RC1) "XML Document Builder Factory Class": org.apache.crimson.jaxp.DocumentBuilderFactoryImpl "SAX Parser Factory Class": "org.apache .crimson.jaxp.SAXParserFactoryImpl "" Optional Java VM Arguments ":" -Djboss.boot.loader.name = run.bat "" Optional Program Arguments ":" -c default "Make sure JBoss menu accessible.Set to" Java " Perspective, And make Sure Jboss Menu and Its 2 Toolbar Buttons Are Available.if Not, Menu "Perspective" -> Item "Customize" -> option "taher" -> option "Easie Jboss", Check It. Use menu Or Toolbar To Start / Stop Jboss (The Plugin Will Start / Stop Jboss As A Debugging Mode VM Inside Eclipse, so Debugging Into EJBS BECOMES POSSIBLE.)

Integrating Tomcat with jboss

Version Tomcat 4.x and JBoss 3.xConfigure JBoss JBoss 3.0.0 comes with Jetty Servlet Engine enabled running at port 8080 as default If you want Tomcat to run on port 8080, they will conflict To disable Jetty in JBoss:.. Create a backup folder next to subfolder deploy / (eg% JBOSS_DIST% / server / default / deployBackup.) Move file jetty-plugin.sar from deploy / into deployBackup / (making it absent from the deploy / folder) Configure Tomcat

Add JBoss Client Library to Tomcat: Copy The Following from% JBoss_Dist% / Client INTO% Tomcat_Home% / Common / LIB: JBoss-J2EE.jar, JBoss-Client.jar, JBosssx-Client.jar, JNP-Client.jar, Jboss -common-client.jar and log4j.jar.When Tomcat starts up, these .jar would be added to its classpath. If you ever run into others that you need, just copy from% JBOSS_DIST% / client folder. Specify JNDI properties to Tomcat JVM (you probably want to do both) .o Tomcat in OS (outside Eclipse): Change% TOMCAT_HOME% / bin / setclasspath.bat (backing up the original is recommended), the line with JAVA_OPTS (following is one line): set JAVA_OPTS = -Djava.naming.factory.initial = org.jnp.interfaces.NamingContextFactory -Djava.naming.provider.url = localhost: 1099 -Djava.naming.factory.url.pkgs = org.jboss.naming: org. JNP.Interfaces o Tomcat Inside Eclipse: Menu "Workbench" -> item "preference" -> option "tomcat" -> Suboption "jvm settings" -> "append to jvm parameters, add the following threei JVM Parameters (Each Line IS) a seper ate parameter): -Djava.naming.factory.initial = org.jnp.interfaces.NamingContextFactory-Djava.naming.provider.url = localhost: 1099-Djava.naming.factory.url.pkgs = org.jboss.naming: org .jnp.interfacesNote:. 1. your application EJB's client classes need to be accessible to the Web application, at preferrably WEB-INF / lib (or WEB-INF / classes) .2 For your Eclipse application, project .classpath need to include The Following to Compile EJB Client Calls: <

ClassPathentry Kind = "var" path = "Tomcat_home / common / lib / jbossx-client.jar" /> integrating jboss with mysql

Version jboss 3.x and mysql 3.xconfigure MySQL

Be sure your MySQL is using mysqld-max which supports InnoDB (or BDB) for transaction. You tables also need to have "type = InnoDB" (or BDB) .- To check, do "SHOW TABLE STATUS LIKE '

'; ".- to modify, do" alter table
type = innodb; ". Download mysql jdbc driver (2.0.4) at http://mirror.sit.wisc.edu/mysq/downloads/Contrib/ mm.mysql-2.0.4-bin.jar Download Page: http://www.mysql.com/downloads/api-jdbc.html. Configure Jboss

Put the JDBC driver into JBoss library:. Copy downloaded mm.mysql-2.0.4-bin.jar to folder% JBOSS_DIST% / lib / Deploy MySQL into JBoss, by adding file mysql-service.xml into folder% JBOSS_DIST% / server /Default/deploy/.a template could be found at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jbosscx/src/etc/example-config/mysql-service.xml?rev= 1.4 & content-type = text / vnd.viewcvs-markup.customization (Example, Uses) Applies to you):

"ISQLDB" (if you don't change it it) is your data source name and the jndi name. Change "jdbc: mysql: // Dell: 3306 / jbossdb" INTO THE URL OR YOUR DATABASE on local host should be jdbc: mysql: // localhost:. 3306 / test) Read the comments toward the end of the file and follow the instruction to copy the following section into login-config.xml (under% JBOSS_DIST% / server / default / conf /): YourPrincipal YouruserName YourPassword jboss.jca: service = LocalTxCM, name = MySqlDS In login-config.xml, modify the section you pasted from the Above Step. Change "YourPrinc ipal "into" developer "(value of Principle)," yourusername "into" developer "(value of Username)," yourpassword "into" mysql "(value of Password). Make sure" MySqlDS "is your data source name or change It Accordingly.From: http://www.purposeSolutions.com/resources/eclipsej2ee.html

转载请注明原文地址:https://www.9cbs.com/read-90402.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.037, SQL: 9