Solved

Tomcat Datasource (Urgent!! Please Help)

Posted on 2003-10-23
25
2,688 Views
Last Modified: 2012-05-04
I have tomcat web server (tomcat 4.1.24) running on my Windows2000 PC.
I need to connect to an Oracle database for which I know the Database server hostnaeme,port number, database sid, username and password.

How can I configure my server.xml file (catalina_home/conf/server.xml) so that I can connect to the Oracle database from my JSP code:

Context ic = new InitialContext();
ds = (DataSource) ic.lookup("jdbc/FASTTDS");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();

I went through the tomcat JNDI documentation (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html)

My server.xml file contains these lines:
****
    <Resource name="FASTTDS" auth="Container"
              type="javax.sql.DataSource"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="jdbc/FASTTDS">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>oracle.jdbc.driver.OracleDriver</value>
        </parameter>
  <parameter>
    <name>url</name>
    <value>jdbc:oracle:thin:my_fastt@inch7.rd.com:1521:eflex</value>
  </parameter>
  <parameter>
    <name>username</name>
    <value>my_fastt</value>
  </parameter>
  <parameter>
    <name>password</name>
    <value>my_fastt</value>
  </parameter>
  <parameter>
    <name>maxActive</name>
    <value>20</value>
  </parameter>
  <parameter>
    <name>maxIdle</name>
    <value>10</value>
  </parameter>
  <parameter>
    <name>maxWait</name>
    <value>-1</value>
  </parameter>
    </ResourceParams>
****

Now I stopped the server and with the above server.xml, I cannot start (catalina_home/bin/startup command stops and window closes) the server.So I changed back to the default server.xml, and now I can start tomcat.

This is how I created the web.xml file in my application's WEB-INF directory:
*********
<?xml version = '1.0' encoding = 'UTF-8'?>
<web-app>
   <display-name>FASTT</display-name>
   <description>FASTT</description>
    <res-ref-name>jdbc/FASTTDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
   <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
</web-app>
*******
(I did not remove other default lines in server.xml file)

 I am far away from what I need to do. Can you please help me about how I need to create my server.xml file for my JSP application.

-tooki
0
Comment
Question by:tooki
  • 13
  • 10
25 Comments
 
LVL 9

Expert Comment

by:vzilka
ID: 9618116
Did you get an exception from Tomcat?
You can view it under the log directory.
Have you put classes12.jar in the Tomcat\lib directory?
0
 

Author Comment

by:tooki
ID: 9620648
I have renamed the JDBC driver from classes12.zip to classes12.jar and put that in catalina_home/common/lib/ directory.

When I start tomcat (catalina_home/bin/startup command) from command prompt, it closes the window and the log file that I get (catalina_home/logs/catalina_log.2003-10-25.txt) is:
*****
2003-10-25 15:37:30 UserDatabaseRealm[Standalone]: Exception looking up UserDatabase under key UserDatabase
javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Context
      at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
      at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:302)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1173)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
      at org.apache.catalina.core.StandardService.start(StandardService.java:497)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
      at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
      at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
********

This is my complete server.xml file:
*****
<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
     parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,
     which may contain one or more "Service" instances.  The Server
     listens for a shutdown command on the indicated port.

     Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" or "Loggers" at this level.
 -->

<Server port="8005" shutdown="SHUTDOWN" debug="0">


  <!-- Comment these entries out to disable JMX MBeans support -->
  <!-- You may also configure custom components (e.g. Valves/Realms) by
       including your own mbean-descriptor file(s), and setting the
       "descriptors" attribute to point to a ';' seperated list of paths
       (in the ClassLoader sense) of files to add to the default list.
       e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
  -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="FASTTDS" auth="Container"
              type="javax.sql.DataSource"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="jdbc/FASTTDS">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>oracle.jdbc.driver.OracleDriver</value>
        </parameter>
  <parameter>
    <name>url</name>
    <value>jdbc:oracle:thin:my_fastt@inch7.rd.com:1521:eflex</value>
  </parameter>
  <parameter>
    <name>username</name>
    <value>usr_fastt</value>
  </parameter>
  <parameter>
    <name>password</name>
    <value>usr_fastt</value>
  </parameter>
  <parameter>
    <name>maxActive</name>
    <value>20</value>
  </parameter>
  <parameter>
    <name>maxIdle</name>
    <value>10</value>
  </parameter>
  <parameter>
    <name>maxWait</name>
    <value>-1</value>
  </parameter>
    </ResourceParams>

  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" (and therefore the web applications visible
       within that Container).  Normally, that Container is an "Engine",
       but this is not required.

       Note:  A "Service" is not itself a "Container", so you may not
       define subcomponents such as "Valves" or "Loggers" at this level.
   -->

  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Tomcat-Standalone">

    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned.  Each Connector passes requests on to the
         associated "Container" (normally an Engine) for processing.

         By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
         You can also enable an SSL HTTP/1.1 Connector on port 8443 by
         following the instructions below and uncommenting the second Connector
         entry.  SSL support requires the following steps (see the SSL Config
         HOWTO in the Tomcat 4.0 documentation bundle for more detailed
         instructions):
         * Download and install JSSE 1.0.2 or later, and put the JAR files
           into "$JAVA_HOME/jre/lib/ext".
         * Execute:
             %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
             $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA  (Unix)
           with a password value of "changeit" for both the certificate and
           the keystore itself.

         By default, DNS lookups are enabled when a web application calls
         request.getRemoteHost().  This can have an adverse impact on
         performance, so you can disable it by setting the
         "enableLookups" attribute to "false".  When DNS lookups are disabled,
         request.getRemoteHost() will return the String version of the
         IP address of the remote client.
    -->

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8080" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="100" debug="0" connectionTimeout="20000"
               useURIValidationHack="false" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
     to -1 -->

    <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
    <!--
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8443" minProcessors="5" maxProcessors="75"
               enableLookups="true"
             acceptCount="100" debug="0" scheme="https" secure="true"
               useURIValidationHack="false" disableUploadTimeout="true">
      <Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
               clientAuth="false" protocol="TLS" />
    </Connector>
    -->

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="0"
               useURIValidationHack="false"
               protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <!--
    <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
               port="8009" minProcessors="5" maxProcessors="75"
               acceptCount="10" debug="0"/>
    -->

    <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
    <!-- See proxy documentation for more information about using this. -->
    <!--
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8082" minProcessors="5" maxProcessors="75"
               enableLookups="true"
               acceptCount="100" debug="0" connectionTimeout="20000"
               proxyPort="80" useURIValidationHack="false"
               disableUploadTimeout="true" />
    -->

    <!-- Define a non-SSL legacy HTTP/1.1 Test Connector on port 8083 -->
    <!--
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="8083" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" />
    -->

    <!-- Define a non-SSL HTTP/1.0 Test Connector on port 8084 -->
    <!--
    <Connector className="org.apache.catalina.connector.http10.HttpConnector"
               port="8084" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" />
    -->

    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host). -->

    <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
    <Engine name="Standalone" defaultHost="localhost" debug="0" jmvRoute="jvm1">        
    -->
         
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Standalone" defaultHost="localhost" debug="0">

      <!-- The request dumper valve dumps useful debugging information about
           the request headers and cookies that were received, and the response
           headers and cookies that were sent, for all requests received by
           this instance of Tomcat.  If you care only about requests to a
           particular virtual host, or a particular application, nest this
           element inside the corresponding <Host> or <Context> entry instead.

           For a similar mechanism that is portable to all Servlet 2.3
           containers, check out the "RequestDumperFilter" Filter in the
           example application (the source for this filter may be found in
           "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").

           Request dumping is disabled by default.  Uncomment the following
           element to enable it. -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared globally -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 debug="0" resourceName="UserDatabase"/>

      <!-- Comment out the old realm but leave here for now in case we
           need to go back quickly -->
      <!--
      <Realm className="org.apache.catalina.realm.MemoryRealm" />
      -->

      <!-- Replace the above Realm with one of the following to get a Realm
           stored in a database and accessed via JDBC -->

      <!--
      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="org.gjt.mm.mysql.Driver"
          connectionURL="jdbc:mysql://localhost/authority"
         connectionName="test" connectionPassword="test"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
          userRoleTable="user_roles" roleNameCol="role_name" />
      -->

      <!--
      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="oracle.jdbc.driver.OracleDriver"
          connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
         connectionName="scott" connectionPassword="tiger"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
          userRoleTable="user_roles" roleNameCol="role_name" />
      -->

      <!--
      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="sun.jdbc.odbc.JdbcOdbcDriver"
          connectionURL="jdbc:odbc:CATALINA"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
          userRoleTable="user_roles" roleNameCol="role_name" />
      -->

      <!-- Define the default virtual host -->
      <Host name="localhost" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true">

        <!-- Normally, users must authenticate themselves to each web app
             individually.  Uncomment the following entry if you would like
             a user to be authenticated the first time they encounter a
             resource protected by a security constraint, and then have that
             user identity maintained across *all* web applications contained
             in this virtual host. -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn"
                   debug="0"/>
        -->

        <!-- Access log processes all requests for this virtual host.  By
             default, log files are created in the "logs" directory relative to
             $CATALINA_HOME.  If you wish, you can specify a different
             directory with the "directory" attribute.  Specify either a relative
             (to $CATALINA_HOME) or absolute path to the desired directory.
        -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
                 pattern="common" resolveHosts="false"/>
        -->

        <!-- Logger shared by all Contexts related to this virtual host.  By
             default (when using FileLogger), log files are created in the "logs"
             directory relative to $CATALINA_HOME.  If you wish, you can specify
             a different directory with the "directory" attribute.  Specify either a
             relative (to $CATALINA_HOME) or absolute path to the desired
             directory.-->
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
              timestamp="true"/>

        <!-- Define properties for each web application.  This is only needed
             if you want to set non-default properties, or have web application
             document roots in places other than the virtual host's appBase
             directory.  -->

        <!-- Tomcat Root Context -->
        <!--
          <Context path="" docBase="ROOT" debug="0"/>
        -->

        <!-- Tomcat Examples Context -->
        <Context path="/examples" docBase="examples" debug="0"
                 reloadable="true" crossContext="true">
          <Logger className="org.apache.catalina.logger.FileLogger"
                     prefix="localhost_examples_log." suffix=".txt"
                timestamp="true"/>
          <Ejb   name="ejb/EmplRecord" type="Entity"
                 home="com.wombat.empl.EmployeeRecordHome"
               remote="com.wombat.empl.EmployeeRecord"/>

          <!-- If you wanted the examples app to be able to edit the
               user database, you would uncomment the following entry.
               Of course, you would want to enable security on the
               application as well, so this is not done by default!
               The database object could be accessed like this:

               Context initCtx = new InitialContext();
               Context envCtx = (Context) initCtx.lookup("java:comp/env");
               UserDatabase database =
                    (UserDatabase) envCtx.lookup("userDatabase");
          -->
<!--
          <ResourceLink name="userDatabase" global="UserDatabase"
                        type="org.apache.catalina.UserDatabase"/>
-->


          <!-- PersistentManager: Uncomment the section below to test Persistent
                   Sessions.
                         
               saveOnRestart: If true, all active sessions will be saved
                 to the Store when Catalina is shutdown, regardless of
                 other settings. All Sessions found in the Store will be
                 loaded on startup. Sessions past their expiration are
                 ignored in both cases.
               maxActiveSessions: If 0 or greater, having too many active
                 sessions will result in some being swapped out. minIdleSwap
                 limits this. -1 or 0 means unlimited sessions are allowed.
                 If it is not possible to swap sessions new sessions will
                 be rejected.
                 This avoids thrashing when the site is highly active.
               minIdleSwap: Sessions must be idle for at least this long
                 (in seconds) before they will be swapped out due to
                 activity.
                 0 means sessions will almost always be swapped out after
                 use - this will be noticeably slow for your users.
               maxIdleSwap: Sessions will be swapped out if idle for this
                 long (in seconds). If minIdleSwap is higher, then it will
                 override this. This isn't exact: it is checked periodically.
                 -1 means sessions won't be swapped out for this reason,
                 although they may be swapped out for maxActiveSessions.
                 If set to >= 0, guarantees that all sessions found in the
                 Store will be loaded on startup.
               maxIdleBackup: Sessions will be backed up (saved to the Store,
                 but left in active memory) if idle for this long (in seconds),
                 and all sessions found in the Store will be loaded on startup.
                 If set to -1 sessions will not be backed up, 0 means they
                 should be backed up shortly after being used.

               To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
               and minIdleBackup all to -1, saveOnRestart to false, then restart
               Catalina.
          -->
              <!--
          <Manager className="org.apache.catalina.session.PersistentManager"
              debug="0"
              saveOnRestart="true"
              maxActiveSessions="-1"
              minIdleSwap="-1"
              maxIdleSwap="-1"
              maxIdleBackup="-1">
                <Store className="org.apache.catalina.session.FileStore"/>
          </Manager>
              -->
          <Environment name="maxExemptions" type="java.lang.Integer"
                      value="15"/>
          <Parameter name="context.param.name" value="context.param.value"
                     override="false"/>
          <Resource name="jdbc/EmployeeAppDb" auth="SERVLET"
                    type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/EmployeeAppDb">
            <parameter><name>username</name><value>sa</value></parameter>
            <parameter><name>password</name><value></value></parameter>
            <parameter><name>driverClassName</name>
              <value>org.hsql.jdbcDriver</value></parameter>
            <parameter><name>url</name>
              <value>jdbc:HypersonicSQL:database</value></parameter>
          </ResourceParams>
          <Resource name="mail/Session" auth="Container"
                    type="javax.mail.Session"/>
          <ResourceParams name="mail/Session">
            <parameter>
              <name>mail.smtp.host</name>
              <value>localhost</value>
            </parameter>
          </ResourceParams>
          <ResourceLink name="linkToGlobalResource"
                    global="simpleValue"
                    type="java.lang.Integer"/>
        </Context>

      </Host>

    </Engine>

  </Service>

  <!-- The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat 4.0
       as its servlet container. Please read the README.txt file coming with
       the WebApp Module distribution on how to build it.
       (Or check out the "jakarta-tomcat-connectors/webapp" CVS repository)

       To configure the Apache side, you must ensure that you have the
       "ServerName" and "Port" directives defined in "httpd.conf".  Then,
       lines like these to the bottom of your "httpd.conf" file:

         LoadModule webapp_module libexec/mod_webapp.so
         WebAppConnection warpConnection warp localhost:8008
         WebAppDeploy examples warpConnection /examples/

       The next time you restart Apache (after restarting Tomcat, if needed)
       the connection will be established, and all applications you make
       visible via "WebAppDeploy" directives can be accessed through Apache.
  -->

  <!-- Define an Apache-Connector Service -->
<!--
  <Service name="Tomcat-Apache">

    <Connector className="org.apache.catalina.connector.warp.WarpConnector"
     port="8008" minProcessors="5" maxProcessors="75"
     enableLookups="true" appBase="webapps"
     acceptCount="10" debug="0"/>

    <Engine className="org.apache.catalina.connector.warp.WarpEngine"
     name="Apache" debug="0">

      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="apache_log." suffix=".txt"
              timestamp="true"/>

      <Realm className="org.apache.catalina.realm.MemoryRealm" />

    </Engine>

  </Service>
-->

</Server>
*********

I edited the default server.xml file (catalina_home/conf/server.xml), and the only few lines that are edited are these:
*****
    <Resource name="FASTTDS" auth="Container"
              type="javax.sql.DataSource"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="jdbc/FASTTDS">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
       <parameter>
           <name>driverClassName</name>
           <value>oracle.jdbc.driver.OracleDriver</value>
       </parameter>
  <parameter>
    <name>url</name>
    <value>jdbc:oracle:thin:my_fastt@inch7.rd.com:1521:eflex</value>
  </parameter>
  <parameter>
    <name>username</name>
    <value>my_fastt</value>
  </parameter>
  <parameter>
    <name>password</name>
    <value>my_fastt</value>
  </parameter>
  <parameter>
    <name>maxActive</name>
    <value>20</value>
  </parameter>
  <parameter>
    <name>maxIdle</name>
    <value>10</value>
  </parameter>
  <parameter>
    <name>maxWait</name>
    <value>-1</value>
  </parameter>
    </ResourceParams>
********

Do I need to get rid of any lines that appeear at the bottom part of the server.xml file? Any suggestions, please let me know.
-tooki

0
 
LVL 9

Expert Comment

by:vzilka
ID: 9620746
I think you replaced the UserDatabase resource with a new one FASTTDS. You should keep the UserDatabase resource and add your DS as a new resource.
0
 

Author Comment

by:tooki
ID: 9620963
Thanks.
I have updated server.xml (catalina_home/conf/server.xml) and now I have kept the UserDatabase resource and added the new one FASTTDS. And now I could start tomcat without error.

But when I try to run the file index.jsp (catalina_home/webapps/fastt/index.jsp) from the URL http://localhost:8080/fastt/index.jsp I get this error:
"org.apache.jasper.JasperException: Name jdbc is not bound in this Context" on the browser.

My file index.jsp is:
*****
<%@ page import="java.util.*, java.sql.*, oracle.jdbc.*, javax.sql.*, javax.naming.*" %>
<%
    Context ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("jdbc/FASTTDS");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset = null;
%>
<html>
<head>
<title>FASTT</title>
<body>
Testing Database Connectivity
</body>
</html>
*****
(If I comment out these lines in the index.jsp file:
    DataSource ds = (DataSource) ic.lookup("jdbc/FASTTDS");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset = null;
It works)

The web.xml file (catalina_home/webapps/fastt/WEB-INF/web.xml) is:
*****
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
   <display-name>FASTT</display-name>
   <description>FASTT</description>
    <res-ref-name>jdbc/FASTTDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
   <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
</web-app>
*****
The exact error that I see in the browse, is also in the tomcat log file
at catalina_home/logs/.

This is the exact error in the log file:
*****
org.apache.jasper.JasperException: Name jdbc is not bound in this Context
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)
----- Root Cause -----
javax.servlet.ServletException: Name jdbc is not bound in this Context
      at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
      at org.apache.jsp.index2_jsp._jspService(index2_jsp.java:66)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)
*****

The updated part of my server.xml is:
********
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved">
    </Resource>

    <Resource name="FASTTDS" auth="Container"
              type="javax.sql.DataSource"
       description="User database that can be updated and saved">
    </Resource>

    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

    <ResourceParams name="jdbc/FASTTDS">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>oracle.jdbc.driver.OracleDriver</value>
        </parameter>
  <parameter>
    <name>url</name>
     <value>jdbc:oracle:thin:my_fastt@inch7.rd.com:1521:eflex</value>
  </parameter>
  <parameter>
    <name>username</name>
    <value>usr_fastt</value>
  </parameter>
  <parameter>
    <name>password</name>
    <value>usr_fastt</value>
  </parameter>
  <parameter>
    <name>maxActive</name>
    <value>20</value>
  </parameter>
  <parameter>
    <name>maxIdle</name>
    <value>10</value>
  </parameter>
  <parameter>
    <name>maxWait</name>
    <value>-1</value>
  </parameter>
    </ResourceParams>
*********

Any help, please let me know.
-tooki
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9621923
Your lookup line should look like this:
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/FASTTDS");

The java:comp/env bit tells Tomcat to look for the JDBC definitions inside the web.xml file.
0
 

Author Comment

by:tooki
ID: 9623129
Thanks.But I still get the same error that I was getting before I updated the lookup line to DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/FASTTDS");.
I even stopped and restarted the server after that update but getting the same error.

This is my JSP file (http://localhost:8080/fastt/index.jsp) now:
*****
<%@ page import="java.util.*, java.sql.*, oracle.jdbc.*, javax.sql.*, javax.naming.*" %>
<%
    Context ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/FASTTDS");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset = null;
%>
<html>
<head>
<title>FASTT</title>
<body>
Testing Database Connectivity
</body>
</html>
******

Error:
*****
org.apache.jasper.JasperException: Name jdbc is not bound in this Context
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)


root cause

javax.servlet.ServletException: Name jdbc is not bound in this Context
      at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
      at org.apache.jsp.index2_jsp._jspService(index2_jsp.java:66)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)
****


thanks.
-tooki
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9623192
Sorry, my fault.
I missed this section in the server.xml.
Update your resource tag so it will look like this:

<resource name="jdbc/FASTTDS" ...>
    ...
</resource>


0
 

Author Comment

by:tooki
ID: 9623284
Thanks. But I'm afraid, it still gives the same error:
"org.apache.jasper.JasperException: Name jdbc is not bound in this Context
"...

Here is my updated server.xml (catalina_home/conf/server.xml), the part that I updated on the default:

*****
 <Resource name="jdbc/FASTTDS" auth="Container"
              type="javax.sql.DataSource"
       description="User database that can be updated and saved">
    </Resource>

    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

    <ResourceParams name="jdbc/FASTTDS">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>oracle.jdbc.driver.OracleDriver</value>
        </parameter>
  <parameter>
    <name>url</name>
      <value>jdbc:oracle:thin:my_fastt@inch7.rd.com:1521:eflex</value>
  </parameter>
  <parameter>
    <name>username</name>
    <value>my_fastt</value>
  </parameter>
  <parameter>
    <name>password</name>
    <value>usr_fastt</value>
  </parameter>
  <parameter>
    <name>maxActive</name>
    <value>20</value>
  </parameter>
  <parameter>
    <name>maxIdle</name>
    <value>10</value>
  </parameter>
  <parameter>
    <name>maxWait</name>
    <value>-1</value>
  </parameter>
    </ResourceParams>
*******

I updated my JSP file (http://localhost:8080/fastt/index.jsp) :
***
<%@ page import="java.util.*, java.sql.*, oracle.jdbc.*, javax.sql.*, javax.naming.*" %>
<%
    Context ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/FASTTDS");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset = null;
%>
<html>
<head>
<title>FASTT</title>
<body>
Testing Database Connectivity
</body>
</html>
****
In server.xml, file I have:
  <value>jdbc:oracle:thin:my_fastt@inch7.rd.com:1521:eflex</value>

Here I have the the database server name "inch7.rd.com" port "1521", database name "eflex", database username "my_fastt". These are all correct...

-tooki
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9623694
Do you get an exception during Tomcat startup about a database error? This may cause the datasource not to appear in your JNDI tree.
0
 

Author Comment

by:tooki
ID: 9623716
No, I do not get any error during the Tomcat startup. I shutdown Tomcat and just restarted and I find these entries in the Tomcat log file:
These none look like an error...
***
2003-10-26 15:17:57 StandardHost[localhost]: Removing web application at context path /admin
2003-10-26 15:18:02 StandardHost[localhost]: Removing web application at context path /tooki
2003-10-26 15:18:03 StandardHost[localhost]: Removing web application at context path /webdav
2003-10-26 15:18:03 StandardHost[localhost]: Removing web application at context path /examples
2003-10-26 15:18:07 StandardHost[localhost]: Removing web application at context path /tomcat-docs
2003-10-26 15:18:07 StandardHost[localhost]: Removing web application at context path
2003-10-26 15:18:08 StandardHost[localhost]: Removing web application at context path /fastt
2003-10-26 15:18:08 StandardHost[localhost]: Removing web application at context path /manager
2003-10-26 15:18:21 HostConfig[localhost]: Deploying configuration descriptor admin.xml
2003-10-26 15:18:37 HostConfig[localhost]: Deploying configuration descriptor manager.xml
2003-10-26 15:18:37 WebappLoader[/manager]: Deploying class repositories to work directory C:\tomcat\jakarta-tomcat-4.1.24\work\Standalone\localhost\manager
2003-10-26 15:18:37 ContextConfig[/manager]: Configured an authenticator for method BASIC
2003-10-26 15:18:37 StandardManager[/manager]: Seeding random number generator class java.security.SecureRandom
2003-10-26 15:18:37 StandardManager[/manager]: Seeding of random number generator has been completed
2003-10-26 15:18:37 StandardWrapper[/manager:default]: Loading container servlet default
2003-10-26 15:18:37 StandardWrapper[/manager:invoker]: Loading container servlet invoker
2003-10-26 15:18:37 HostConfig[localhost]: Expanding web application archive fastt.war
2003-10-26 15:18:37 StandardHost[localhost]: Installing web application at context path /fastt from URL file:C:/tomcat/jakarta-tomcat-4.1.24/webapps/fastt
2003-10-26 15:18:37 WebappLoader[/fastt]: Deploying class repositories to work directory C:\tomcat\jakarta-tomcat-4.1.24\work\Standalone\localhost\fastt
2003-10-26 15:18:37 WebappLoader[/fastt]: Deploy class files /WEB-INF/classes to C:\tomcat\jakarta-tomcat-4.1.24\webapps\fastt\WEB-INF\classes
2003-10-26 15:18:37 WebappLoader[/fastt]: Deploy JAR /WEB-INF/lib/ldapfilt.jar to C:\tomcat\jakarta-tomcat-4.1.24\webapps\fastt\WEB-INF\lib\ldapfilt.jar
2003-10-26 15:18:37 WebappLoader[/fastt]: Deploy JAR /WEB-INF/lib/ldapjdk.jar to C:\tomcat\jakarta-tomcat-4.1.24\webapps\fastt\WEB-INF\lib\ldapjdk.jar
2003-10-26 15:18:39 StandardManager[/fastt]: Seeding random number generator class java.security.SecureRandom
2003-10-26 15:18:39 StandardManager[/fastt]: Seeding of random number generator has been completed
2003-10-26 15:18:39 StandardWrapper[/fastt:default]: Loading container servlet default
2003-10-26 15:18:39 StandardWrapper[/fastt:invoker]: Loading container servlet invoker
2003-10-26 15:18:39 HostConfig[localhost]: Deploying web application directory ROOT
2003-10-26 15:18:39 StandardHost[localhost]: Installing web application at context path  from URL file:C:\tomcat\jakarta-tomcat-4.1.24\webapps\ROOT
2003-10-26 15:18:39 WebappLoader[]: Deploying class repositories to work directory C:\tomcat\jakarta-tomcat-4.1.24\work\Standalone\localhost\_
2003-10-26 15:18:40 StandardManager[]: Seeding random number generator class java.security.SecureRandom
2003-10-26 15:18:40 StandardManager[]: Seeding of random number generator has been completed
2003-10-26 15:18:40 StandardWrapper[:default]: Loading container servlet default
2003-10-26 15:18:40 StandardWrapper[:invoker]: Loading container servlet invoker
2003-10-26 15:18:40 HostConfig[localhost]: Deploying web application directory tooki
2003-10-26 15:18:40 StandardHost[localhost]: Installing web application at context path /tooki from URL file:C:\tomcat\jakarta-tomcat-4.1.24\webapps\tooki
2003-10-26 15:18:40 WebappLoader[/tooki]: Deploying class repositories to work directory C:\tomcat\jakarta-tomcat-4.1.24\work\Standalone\localhost\tooki
2003-10-26 15:18:40 WebappLoader[/tooki]: Deploy class files /WEB-INF/classes to C:\tomcat\jakarta-tomcat-4.1.24\webapps\tooki\WEB-INF\classes
2003-10-26 15:18:40 ContextConfig[/tooki]: Missing application web.xml, using defaults only
2003-10-26 15:18:40 StandardManager[/tooki]: Seeding random number generator class java.security.SecureRandom
2003-10-26 15:18:40 StandardManager[/tooki]: Seeding of random number generator has been completed
2003-10-26 15:18:40 StandardWrapper[/tooki:default]: Loading container servlet default
2003-10-26 15:18:40 StandardWrapper[/tooki:invoker]: Loading container servlet invoker
2003-10-26 15:18:40 HostConfig[localhost]: Deploying web application directory tomcat-docs
2003-10-26 15:18:40 StandardHost[localhost]: Installing web application at context path /tomcat-docs from URL file:C:\tomcat\jakarta-tomcat-4.1.24\webapps\tomcat-docs
2003-10-26 15:18:40 WebappLoader[/tomcat-docs]: Deploying class repositories to work directory C:\tomcat\jakarta-tomcat-4.1.24\work\Standalone\localhost\tomcat-docs
2003-10-26 15:18:40 StandardManager[/tomcat-docs]: Seeding random number generator class java.security.SecureRandom
2003-10-26 15:18:40 StandardManager[/tomcat-docs]: Seeding of random number generator has been completed
2003-10-26 15:18:40 StandardWrapper[/tomcat-docs:default]: Loading container servlet default
2003-10-26 15:18:40 StandardWrapper[/tomcat-docs:invoker]: Loading container servlet invoker
2003-10-26 15:18:40 HostConfig[localhost]: Deploying web application directory webdav
2003-10-26 15:18:40 StandardHost[localhost]: Installing web application at context path /webdav from URL file:C:\tomcat\jakarta-tomcat-4.1.24\webapps\webdav
2003-10-26 15:18:40 WebappLoader[/webdav]: Deploying class repositories to work directory C:\tomcat\jakarta-tomcat-4.1.24\work\Standalone\localhost\webdav
2003-10-26 15:18:41 StandardManager[/webdav]: Seeding random number generator class java.security.SecureRandom
2003-10-26 15:18:41 StandardManager[/webdav]: Seeding of random number generator has been completed
2003-10-26 15:18:41 StandardWrapper[/webdav:default]: Loading container servlet default
2003-10-26 15:18:41 StandardWrapper[/webdav:invoker]: Loading container servlet invoker
***
I get the error only when I try to run the JSP on the browser.

thanks
-tooki
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9623736
I assume your web application is named tooki. In that case, this line:
2003-10-26 15:18:40 ContextConfig[/tooki]: Missing application web.xml, using defaults only
Says your WAR file is not built correctly.
Your web.xml file must be found under the WEB-INF directory, which should be under the root directory of your WAR file.
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 9

Expert Comment

by:vzilka
ID: 9663834
Tooki, was the problem solved?
0
 

Author Comment

by:tooki
ID: 9744601
Thanks. Sorry the problem was not solved. It was critical that time, so I switched to a different test server that runs Oracle iAS. There the setup to connect to the database was already created so I could connect to the database from my JSP code and change the code to fix the production problem.

Now I have a different problem, not sure if I can ask in here:

Whenever I change (recompile java files) my code in the class files (under the application-name/WEB-INF/ directory), I need to stop and start the iAS web server to take the changes be in effect. Is there any better way to make the changes in the class files effective without stopping the iAS server?

-tooki
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9752109
I assume here you are using a J2EE enabled IDE. Since you are using iAS, I'll talk about JDeveloper, but anyone will do (including eclipse).

The best way to do it is to create a WAR file, and then recopy it into the applications directory of your iAS instance.
Are you using the standalone OC4J or the complete iAS environment?
0
 

Author Comment

by:tooki
ID: 9752207
Thanks. Yes, this is a complete iAS environment and a .war file was used to deploy the application. The application name is "fastt" and the fastt.war file is at in the iAS server:
$ORACLE_HOME/j2ee/home/applications/fastt/

Can I now replace the present fastt.war file in the above directory by the new fastt.war (with some changes in some of its .class or JSP files) file?Will this replacement (OS "cp" or "mv" command) overwrite the files under the above directory right away (with the files consisting of the new fastt.war file)?
After I do that, dont I need to use any dcmctl commands,etc.? (dcmctl restart or stop/start)
-tooki
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9755143
OK. Now here is the deal:
1. You should not use the complete iAS environment for development mode. I am not sure the auto deployment works very well in it.
2. If you are doing it, then is your development mode clustered? If not, then it is pretty safe to redploey the WAR file this way. If it is clustered, or you want to deploy an entire EAR file, you must use the dcmctl command.
Another option is to use the remote deployment feature in JDeveloper.
0
 

Author Comment

by:tooki
ID: 9758993
I do not need to change the present EAR file (not sure if I need that for a small change in the .war file). There is only one application that runs on the iAS. Before I said that this is a complete iAS environment, sorry, not sure what this means. There is no changes in any meta data or anything in the application.
For example I only changed one .java file in the application.So only I need that .class file to take effect in the application. The new .war file contains that changed .java and .class file.
Now when the oc4j is running and application is working, i replace the present fastt.war file by the new fastt.war file. Do I still need to use dcmctl command to restart the iAS for the new java code to take effect in the application?
-tooki
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9759434
According to the environment you describe, you are running the full iAS solution (including OHS, OPMN, DCM, etc.).
You do not need to do a restart, you do need to refresh your cluster (if you have one. If you don't - no problem).
I am enclosing a link in here. Look at section 3. It states the command you need to run.
http://igloo.its.unimelb.edu.au/Webmail/tips/msg00752.html

One issue though. You are using (according to your description) the default OC4J_Home instance. I've run into some problems with DCMCTL and the OC4J_HOME instance. So, I would suggest you check the behavior of your entire cluster throughly. If everything works with just the dcmctl commands - great. Otherwise, create a new OC4J instanec in the enterprise manager, and use it instead of the home instance.
0
 

Author Comment

by:tooki
ID: 9783841
Thanks for the link. But still I have question with dcmctl syntax to redeploy my fastt.war file for my application named "fastt".
In my system
$dcmctl getstate -v -d
Current State for Instance:APPDEV_2.testserver.com

Component               Type          Up Status     In Sync Status
==========================================================================
1   HTTP Server             ohs           Up            True
2   OC4J_BI_Forms           oc4j          Up            True
3   OC4J_Demos              oc4j          Down          True
4   home                    oc4j          Up            True

My application name is "FASTT". (Only application on the server)
The "fastt.ear" file is located in the directory "$ORACLE_HOME/j2ee/home/applications/".
$ls -l $ORACLE_HOME/j2ee/home/applications/fastt.ear
-rw-r-----   1 oracle   oinstall  336429 Nov 12 14:13 fastt.ear

The "fastt.war" file is located in the directory "$ORACLE_HOME/j2ee/home/applications/fastt/"
$ls -l $ORACLE_HOME/j2ee/home/applications/fastt/fastt.war
-rw-r-----   1 oracle   oinstall  347044 Nov 12 14:13 fastt.war

Each time we "redeploy" the application (change the "fastt.war" file), we redeploy the "fastt.war" file (we never recreate the "fastt.ear" file during each redeployment). (fastt.ear file fastt.ear probably gets created by the server itself). But I do not know the syntax that is used for the application deployment.

All FASTT application JSP files are located at "$ORACLE_HOME/j2ee/home/applications/fastt/fastt/" directory.
All class files of the application are at "$ORACLE_HOME/j2ee/home/applications/fastt/fastt/WEB-INF/classes/../" directory.

Now I have created a new war file ("fastt.war", located at "/tmp/fastt.war" in the iAS server) and need to redeploy the application.
As I see the help for the dcmctl command ($dcmctl help), this is the syntax for redeployment:
$dcmctl  redeployApplication -f myFile -a myApplication [-co myComponent] [-rc rootcontext (required for war deployment)]

What is "rootcontext"  (required for war deployment) above? Is it needed?

Shall I try:
$dcmctl  redeployApplication -f /tmp/fastt.war -a fastt -rc "???"

-tooki

0
 

Author Comment

by:tooki
ID: 9783889
When I enter this command:
$dcmctl  redeployApplication -f /tmp/fastt.war
It returns "ADMN-906011" on the screen and no error.
I look at the fastt.war file and fastt.ear file on the server, but timestamp was not changed (no there was no redeployment) and the application is the same as I try out on the URL.
-tooki
0
 
LVL 9

Accepted Solution

by:
vzilka earned 300 total points
ID: 9785341
root context is the URL you use to access the application. For example:
http://localhost:8888/tooki, then tooki is your root context.
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9831594
tooki, is everything working?
0
 
LVL 9

Expert Comment

by:vzilka
ID: 9893840
tooki, is everything working?
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack 7.0.0.23 or Above. The following steps a…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now