CodeCharge Studio

Deploying Java & JSP Applications

Deploying Java projects is relatively straightforward because most modern Java servers support Web Application Archive (WAR) standard for java applications deployment. The details of server configuration and deployment process may vary from server to server. Generally you must only specify the path to the generated war file and context path to the web application. Many servers support auto deployment and you only need to copy the generated war file to the particular directory one the server and the server will do the remaining job for you.

CodeCharge Studio has several project properties that can affect the application deployment.

The last five properties are needed to configure Tomcat 4.0 manager application for remote Tomcat administration (when Target server set to Tomcat 4.0). You may leave them empty for other target servers.

Normally you will have no problems with Java deployment with any Java Application Server that supports Servlets version 2.2 specification from Sun. The details of the deployment process for several popular Java Application servers follow.

Tomcat 4.0 scenarios

Check that the DB drivers are in the class path of your server. Choose the appropriate scenario and change the properties marked red.

Scenario 1. Auto-deployment from webapps directory (DataSource extension is not used)

  1. Before code generation verify that the Use Data Source site property is set to No.
  2. Fill in connection properties to indicate Driver class name, Database url, user login and password.
  3. Ensure that your database driver is in your application server class path.
  4. Place the generated war file to where appBase attribute of Virtual Host configuration element points to. Generally it is <tomcat_home>/webapps.

Scenario 2. Deployment through Context configuration (DataSource extension is not used)

Add Context element as a child to Host element in your server.xml configuration file.

</tomcat_home>
  <Context path="/JSPPortal"docBase="JSPPortal.war">
</Context>

path - is the context path of your application. docBase is absolute or relative to appBase path to the war file.

Scenario 3. Deployment through Context configuration (DataSource extension is used)

  1. Before code generation verify that Use Data Source site property is set to Yes.
  2. Set connection DataBase URL property to java:comp/env/jdbc/Connection1. Where Connection1 is name of your connection.
  3. Define Context element as described in previous scenario.
  4. Add Resource child element with ResourceParams to the Context element:
<Resource name="jdbc/Connection1" auth="Container" type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/Connection1">
    <parameter>
      <name>user</name>
      <value>User Name</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>User Password</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>Driver Class Name</value>
    </parameter>
    <parameter>
      <name>driverName</name>
      <value>Database Connection URL</value>
    </parameter>
  </ResourceParams>

name is a JNDI name as indicated in your CCS Connection properties.

Resin 2.0 scenarios

Check that DB drivers are in class path of your server. Choose appropriate scenario and change properties marked red.

Scenario 1. Auto-deployment from webapps directory (DataSource extension is not used)

  1. Before code generation verify that Use Data Source site property is set to No.
  2. Fill in connection properties to indicate Driver class name, Database url, user login and password.
  3. Ensure that your database driver is in your application server class path.
  4. Place generated war file to where war-dir element of Virtual Host configuration element points to. Generally it is <RESIN_HOME>/webapps.

Scenario 2. Deployment through web-app configuration (DataSource extension is not used)

Add Context element as a child to Host element in your resin.conf configuration file.
<web-app id="/JSPPortal"
 app-dir="c:/projects/Portal/JSPPortal.war"/>

id is the context path of your application. app-dir is absolute or relative to global app-dir path to the war file.

Scenario 3. Deployment through web-app configuration (DataSource extension is used)

  1. Before code generation verify that Use Data Source site property is set to Yes.
  2. Set connection DataBase URL property to java:comp/env/jdbc/Connection1. Where Connection1 is name of your connection.
  3. Add resource-ref element as child of web-app element:
    <resource-ref>
      <res-ref-name>jdbc/Connection1</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <init-param driver-name="Driver Class Name"/>
      <init-param url="Database connection URL"/>
      <init-param user="User Name"/>
      <init-param password="User Password"/>
      <init-param max-connections="20"/>
      <init-param max-idle-time="30"/>
      <init-param enable-transaction="false"/>
    </resource-ref>

    res-ref-name is a JNDI name as indicated in your CCS Connection properties.

WebLogic 7.0 scenarios

  1. Check that DB drivers are in class path of your server.
  2. Choose appropriate scenario and change properties marked red.

Scenario 1. Auto-deployment from applications directory (DataSource extention is not used)

  1. Before code generation verify that Use Data Source site property is set to No.
  2. Fill in connection properties to indicate Driver class name, Database url, user login and password.
  3. You can quickly deploy your application on the administration server if auto-deploy is enabled by copying war file into \applications directory of the administration server.

Scenario 2. Deployment through Administration Console

Set Use Data Source site property appropriately to indicate whether you want to use DataSources in your code.

If you want to work with DataSources and you have not configured it already add and configure JDBC Pool and DataSource to your server as described in (http://e-docs.bea.com/wls/docs70/ConsoleHelp/jdbc.html#1104939 ).

Bear in mind that weblogic JNDIName property should be equal to JNDI Name property of CCS connection. Install your application as described in (http://e-docs.bea.com/wls/docs70/ConsoleHelp/applications.html#1104914).

WebLogic 5.1 scenarios

CodeCharge Studio requires SAX 2.0 and JAXP 1.1 libraries to work with generated JSP. However WebLogic 5.1 goes with its own XML parser located in lib/weblogicaux.jar. You have to replace those libraries with the newer ones from<http://xml.apache.org/> or <http://java.sun.com/xml/>.

To accomplish this you can:

  1. Specify this libraries in Runtime libraries property of the project or run the following command: wlconfig.exe -classpath c:\java\xerces-2_0_1\xercesImpl.jar;C:\java\xerces-2_0_1\xmlParserAPIs.jar
  2. Restart the server.

Websphere 4.0 scenario

Because WebSphere 4.0 doesn't support autodeployment of war files, it is necessary to do the following:

  1. Fill in all Java Site properties and Connection serverside properties.
  2. Make sure that JDBC drivers are in application class path.
  3. Get the latest version of JAXP 1.1 and SAX 2.0 for compilation and runtime execution of JSP files. You can get them from the Ant installation.
  4. In 'Runtime libs' Site property enlist absolute paths to jar files corresponding to JAXP and SAX libraries spearated by semicolons. For example: "c:\ant\lib\jaxp.jar;c:\ant\lib\crimson.jar". These files will be copied to the WEB-INF\lib directory of the application.
  5. Select 'WebSphere 4.0' in 'Target server' Site property.
  6. Specify 'Publishing/Server Path' property and publish your project.
  7. Install your application through the WebSphere console. On the second screen of the Application Installation Wizard select No for 'Precompile JSPs' property of your web module.
  8. Start the new application from the WebSphere Admin console; restart the server if needed.

Tomcat + Apache scenario

Scenario 1. MOD_JK connector.

  1. Download mod_jk.dll and libapr.dll and copy them to the apache/modules directory.
  2. Create workers.properties file in the $CATALINA_HOME/conf/jk/ directory.
    workers.tomcat_home=$(CATALINA_HOME)
    workers.java_home=$(JAVA_HOME)
    ps=\
    worker.list=ajp13
    worker.ajp13.port=8009
    worker.ajp13.host=localhost
    worker.ajp13.type=ajp13
  3. At the end of httpd.conf LoadModule section add the following line:
    LoadModule jk_module modules/mod_jk.dll
  4. At the end of httpd.conf AddModule section add the following line:
    AddModule mod_jk.c
  5. At the end of httpd.conf add the following:
    JkWorkersFile "$CATALINA_HOME/conf/jk/workers.properties"
    JkLogFile "$CATALINA_HOME/logs/mod_jk.log"
    JkLogLevel info
    
    <VirtualHost localhost>
        ServerName localhost
        DocumentRoot $CATALINA_HOME/webapps/
        JkMount /*.jsp ajp13
        JkMount /*.do ajp13
    </VirtualHost>
  6. If needed uncomment the following delcarations in Tomcat server.xml config file:
    <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
                   port="8009" minProcessors="5" maxProcessors="75"
                   acceptCount="10" debug="0"/>
  7. In CCS set publishing path to $CATALINA_HOME/webapps/ and publish your project.
  8. Start Tomcat and then Apache.

Scenario 2. WARP connector.

  1. Download mod_webapp.so and libapr.dll and copy them to the apache/modules directory.
  2. At the end of httpd.conf LoadModule section add the following line:
    LoadModule webapp_module modules/mod_webapp.so
  3. At the end of httpd.conf AddModule section add the following line:
    AddModule mod_webapp.c
  4. At the end of httpd.conf add the following:
    WebAppConnection warpConnection warp localhost:8008
    WebAppDeploy JSPPortal warpConnection /Portal/
  5. If needed uncomment Tomcat-Apache service configuration in Tomcat server.xml config file.
  6. In CCS set publishing path to $CATALINA_HOME/webapps/ and publish your project.
  7. Start Tomcat and then Apache.


On-line, printable versions and updates Processors="5" maxProcessors="75" acceptCount="10" debug="0"/>
  • In CCS set publishing path to $CATALINA_HOME/webapps/ and publish your project.
  • Start Tomcat and then Apache.

    Scenario 2. WARP connector.

    1. Download mod_webapp.so and libapr.dll and copy them to the apache/modules directory.
    2. At the end of httpd.conf LoadModule section add the following line:
      LoadModule webapp_module modules/mod_webapp.so
    3. At the end of httpd.conf AddModule section add the following line:
      AddModule mod_webapp.c
    4. At the end of httpd.conf add the following:
      WebAppConnection warpConnection warp localhost:8008
      WebAppDeploy JSPPortal warpConnection /Portal/
    5. If needed uncomment Tomcat-Apache service configuration in Tomcat server.xml config file.
    6. In CCS set publishing path to $CATALINA_HOME/webapps/ and publish your project.
    7. Start Tomcat and then Apache.


    On-line, printable versions and updates