Help me out to specify driver in web.xml

i am new programmer and i dont no where to specify driver in web.xml so that i ll get connection using datasource. i know the code in jsp but i dont no where and how to specify driver and under what tag.
This is few steps which i know
!>jsp side i know what to write ie
Context ctx=new IntialContext();
DataSource ds=(DataSource) ctx.lookup("java:comp/env/jdbc/test");
Connection cn=ds.getConnection("umesh","umesh");
2> what and where to write in web.xml
3> i am going to control panel and in that obdc datasource i am going in system tab
there i am adding oracle and DATASOURCE NAME as "test"
is this will work or i have to write something in web.xml also
thanks in advance
help me out

In addittion to following the steps as indicated by the above URL, make the context entries in the
app_root/META-INF/context.xml file .
As I encountered lots of probelms in settingup the JNDI datasource via server.xml or web.xml file
To be precise , do follwoing:
1. Make META-INF directory and add context.xml file to include following:
<Context path="/app_name" docBase="app_name"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="Test_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/yourDB"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/yourDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>dbuser</value>
</parameter>
<parameter>
<name>password</name>
<value>dbpwd</value>
</parameter>
<!-- Class name for the official MySQL Connector/J driver -->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<!-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/yourDB?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
2. In the web.xml include following:
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Hello, World Application</display-name>
<description>
     None </description>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<resource-ref>
<description> Database </description>
<res-ref-name>jdbc/yourDB</res-ref-name>
<res-ref-type>javax.sql.DataSource</res-ref-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
Try to make a war file for your application and deploy it using the Tomcat manager application..
Asif

Similar Messages

  • COnfiguring oracle JDBC Driver with Web Sphere

    I have oracle 7.3.4(on Solaris) and IBM Web Sphere standard
    Edition 2.03 (on NT) I want connect to Oracle ina Servlet. Can
    any one help in configuring Oracle JDBC driver in Web
    Sphere?
    Thanks very much
    Tom
    null

    I have oracle 7.3.4(on Solaris) and IBM Web Sphere standard
    Edition 2.03 (on NT) I want connect to Oracle ina Servlet. Can
    any one help in configuring Oracle JDBC driver in Web
    Sphere?
    Thanks very much
    Tom
    null

  • Calling servlet with out entry in web.xml

    Hi
    I want to know whether can a servlet be invoked with out having an entry in web.xml.Because to my knowledge when ever an entry is made in teh web.xml the <url-pattern> and the class file will be stored as key value combination it is only then when ever a request is made the server gets the class taht is to be invoked from the <url-pattern> that is passed from the client side.
    Is ther any way by whihc we can call the servlet directly with out an entry in web.xml
    Thanks in advance
    Ajithkumar.S

    Interesting that it is possible on Tomcat anyway.
    What's the real benefit of not having a Servlet
    definied in web.xml?
    The only benefit I see is that
    you don't need to understand/read/change XML when
    adding or removing a servlet. That isn't worth that
    imho. What are the other benefits?The only thing I can think of is , to be able to quickly access a Servlet that you've just written, because it takes additional steps to define it in the web.xml.
    I think it would be a security concern (of some sort) , if the Servlet's class is known, that's why it is better to access a Servlet with a mapping from web.xml

  • Web.xml configuration for initial servlet load

    Hi all,
    I have heard of entering some tag into web.xml file (deployement descriptor) if we need some servlets to be loaded wheneve the app server starts or restarts. can some body help me regarding what to write in web.xml.
    thanks in advance

    I am having some problems with the same issue although specifying the load-on-startup param is not working for.
    Here is snipet of the web.xml:
    <servlet id="Servlet_1206024889339">
    <servlet-name>ContentServer</servlet-name>
    <servlet-class>COM.FutureTense.Servlet.SContentServer</servlet-class>
    <init-param id="InitParam_1206024988781">
    <param-name>inipath</param-name>
    <param-value>/data/WebSphere/ContentServer</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    This however doesn't init the contentServer servlet. Is there anythign else i need to check? I am using websphere5-1.
    I saw somewhere you might have to specify a loadonstartup=true? Where is this set?
    I know the app is reading the right web.xml because i put in a bad value and saw the error being outputted in the startup log.
    There are some servlets being initialised on startup but not the ones I want. These servlets don't seem to be in the web.xml.
    [10/10/08 11:53:30:265 IST] 1e06de8 WebContainer A SRVE0169I: Loading Web Module: cs.war.
    [10/10/08 11:53:33:330 IST] 1e06de8 WebGroup I SRVE0180I: [cs.war] [servlet] [Servlet.LOG]: JSP 1.2 Processor: init
    [10/10/08 11:53:34:098 IST] 1e06de8 WebGroup I SRVE0180I: [cs.war] [servlet] [Servlet.LOG]: SimpleFileServlet: init
    [10/10/08 11:53:34:117 IST] 1e06de8 WebGroup I SRVE0180I: [cs.war] [servlet] [Servlet.LOG]: DirectoryBrowsingServlet: init

  • Web.xml parse error

    Hi all,
    I'm new to Tomcat and Servlets and have just tried to write my first web app. After carefully placing everything in the correct directories and spending hours trying to figure out how to write my web.xml, I continue getting 404 errors when I try to navigate to the webapp. I looked through my logs and found that I'm getting a severe error when opening tomcat that prevents the webapp from loading. Apparently I'm getting a parse error in my web.xml file and it's throwing a premature end of file exception that looks like this:
    SEVERE: Parse error in application web.xml file at jndi:/localhost/ServletImageGallery/WEB-INF/web.xml
    org.xml.sax.SAXParseException: Premature end of file.
    SEVERE: Occurred at line 3 column 1I really have no idea how to correct this. Here is my web.xml file for reference:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//
    DTD WebApplication 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
    <web-app>
    <servlet>
    <servlet-name>ServletImageGallery</servlet-name>
    <servlet-class>imagegallery.ServletImageGallery</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ServletImageGallery</servlet-name>
    <url-pattern>/images</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>weirdwelcome.html</welcome-file>
    </welcome-file-list>
    </web-app>Any help would be greatly appreciated. Thanks in advance.

    It looks like according to the http://java.sun.com/dtd/web-app_2_3.dtd , he is correct, this is the first dtd, I have been able to download, thay usally do not exist, when you try to follow the URL, this sets up the order of the attributes.

  • Is it possible to add a filter to a webapp without declaring it in web.xml

    Hello,
    I'd like to add a filter in my web.xml file, but without declaring it in my webapp.
    Indeed, I have multiple webapps, and I'd like to have a common web.xml file that should be directly included in all the webapps including this package ?
    Is it possible or not ?
    As for JSF, it is possible to add faces-config file by putting it in the META-INF of the package.
    Thanks in advance.
    bgOnline

    Your title and your question are opposites...
    A filter must be specified in a web.xml to be used. That doesn't mean the Filter's class HAS to be in your webapp, it just must be accessible to the Servlet container (you could place it in the common/classes directory or shared/classes directory or even the server/classes directory).
    I've not tried it, but I see no reason why you couldn't declare the filter and filter-mapping in the server's web.xml which would then filter all requests in all webapps.
    HTH.

  • Web.xml file not being read

    Hello, I did a quick search but could not find an answer to my specific problem. (this is also my first night tackling servlets) i hope this hasnt been answered before. here goes...
    i'm using Tomcat 4.1 and this is my file structure where i put my servlets:<intstall dir>/webappps/ROOT/WEB-INF/classes/TestPackage.
    this is my code for the servlet
    package TestPackage;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** Example using servlet initialization. Here the message
      * to print and the number of times the message should be
      * repeated is taken from the init parameters.
    public class ShowMessage extends HttpServlet
         private String message;
         private String defaultMessage = "No message.";
         private int repeats = 1;
         public void init(ServletConfig config) throws ServletException
              //Always call super.init
              super.init(config);
              message = config.getInitParameter("message");
              if (message == null)
                   message = defaultMessage;
              try
                   String repeatString = config.getInitParameter("repeats");
                   repeats = Integer.parseInt(repeatString);
              catch(NumberFormatException nfe)
                   //do nothing
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws
                                            ServletException, IOException
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              String title = "The ShowMessage Servlet";
              out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
                               "Transitional//EN\">\n" +
                               "<HTML>\n" +
                             "<body bgcolor=\"#FDF5E6\">\n" +
                             "<h1 align=center>" + title + "</h1>");
              for(int i=0; i<repeats; i++)
                   out.println(message + "<br>");
              out.println("</body></html>");
    }my web.xml file is in <intstall dir>/webappps/ROOT/WEB-INF. it looks like:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
      <servlet>
          <servlet-name>
            ShowMsg
          </servlet-name>
          <servlet-class>
            TestPackage.ShowMessage
          </servlet-class>
          <init-param>
            <param-name>
              message
            </param-name>
            <param-value>
              Shibboleth
            </param-value>
          </init-param>
          <init-param>
            <param-name>
              repeats
            </param-name>
            <param-value>
              5
            </param-value>
          </init-param>
      </servlet>
    </web-app>when i access the servlet i get "No message" one time which is the default message. Any ideas as to why its not picking up the init parameters. I've restarted my laptop and started and stopped Tomcat a few times and i always get the default message...i also tried ShowMessage in replace of ShowMsg as the <servlet-name>, to no avail. I also tried removing the package name in the <servlet-class>, still nothing. Is there another web.xml file some where else that i need to update?
    Thanks! (sorry for the long code)
    BB

    The doGet method works if you are sending data from a form using get method. It is better to use service method.

  • Can DOCTYPE in web.xml Be "Localized"

    At times when starting WebLogic Server 5.1 (sp6) in a Windows NT
    environment, our internet connection is slow and the DTD file specified in
    the web.xml file cannot be resolved. I have been able to get around this
    problem by changing the DOCTYPE in the web.xml file as follows:
    From:
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    To:
    <!DOCTYPE web-app SYSTEM
    "file:/d:\weblogic\examples\webapp\ensodex\WEB-INF\web-app_2_2.dtd">
    I have placed a copy of Sun's web-app_2_2.dtd file in the specified
    directory, and WLS starts up just fine and I can access our web application
    without any problems, but ....
    Is there any way to simplify the DOCTYPE specification so that the full,
    explicit path doesn't have to be specified. A co-worker has been able to
    resolve the issue with an Orion server with the following specification,
    <!DOCTYPE web-app SYSTEM "web-app_2_2.dtd">, but I have been unable to get
    this to work in the WebLogic environment.
    I've read the BEA online documentation, and tried placing the
    web-app_2_2.dtd file under the document root (defined as
    weblogic.httpd.documentRoot=public_html/ in our weblogic.properties file,
    but WLS was still unable to locate the file.
    Our intent is to place the web-app_2_2.dtd file under WEB-INF along with the
    web.xml file since WLS is able to locate the web.xml file successfully, yet
    we don't want to have to specify an explicit path to web-app_2_2.dtd file
    since this would have to be customized each time the web application is
    installed in a different hardware/operating system environment.
    Thanks in advance for any suggestions.
    John J. Feigal Voice (651)766-8787 (main)
    Sr. Technical Consultant (651)766-7249 (direct)
    Ensodex, Inc. Fax (651)766-8792
    4105 N. Lexington Ave., Suite 150 email [email protected]
    Arden Hills, MN 55126 WebSite http://www.ensodex.com

    If I remember correctly from the spec, anything that follows SYSTEM is
    basically arbitrary, meaning the parser can interpret it as it may. It is
    possible that Orion uses a different parser implementation or version. The
    other possibility has to do with where the file would have to be in order to
    be found; it might have to be in the JAR in the directory with the XML, or
    it might have to be in the "working directory" that WebLogic is launched
    from (i.e. the weblogic directory).
    When we had this problem, we inlined the DTD into the XML, which is
    supported by the XML specification.
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com
    +1.617.623.5782
    WebLogic Consulting Available
    "John J. Feigal" <[email protected]> wrote in message
    news:[email protected]...
    At times when starting WebLogic Server 5.1 (sp6) in a Windows NT
    environment, our internet connection is slow and the DTD file specified in
    the web.xml file cannot be resolved. I have been able to get around this
    problem by changing the DOCTYPE in the web.xml file as follows:
    From:
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    To:
    <!DOCTYPE web-app SYSTEM
    "file:/d:\weblogic\examples\webapp\ensodex\WEB-INF\web-app_2_2.dtd">
    I have placed a copy of Sun's web-app_2_2.dtd file in the specified
    directory, and WLS starts up just fine and I can access our webapplication
    without any problems, but ....
    Is there any way to simplify the DOCTYPE specification so that the full,
    explicit path doesn't have to be specified. A co-worker has been able to
    resolve the issue with an Orion server with the following specification,
    <!DOCTYPE web-app SYSTEM "web-app_2_2.dtd">, but I have been unable to get
    this to work in the WebLogic environment.
    I've read the BEA online documentation, and tried placing the
    web-app_2_2.dtd file under the document root (defined as
    weblogic.httpd.documentRoot=public_html/ in our weblogic.properties file,
    but WLS was still unable to locate the file.
    Our intent is to place the web-app_2_2.dtd file under WEB-INF along withthe
    web.xml file since WLS is able to locate the web.xml file successfully,yet
    we don't want to have to specify an explicit path to web-app_2_2.dtd file
    since this would have to be customized each time the web application is
    installed in a different hardware/operating system environment.
    Thanks in advance for any suggestions.
    John J. Feigal Voice (651)766-8787 (main)
    Sr. Technical Consultant (651)766-7249 (direct)
    Ensodex, Inc. Fax (651)766-8792
    4105 N. Lexington Ave., Suite 150 email [email protected]
    Arden Hills, MN 55126 WebSite http://www.ensodex.com

  • 10.1.3 - OEM Deployment generating invalid orion-web.xml

    Hi,
    I've playing around with OracleASjms resource adapters, JMS Connector, etc - with some good results. I noticed that one of my test applications, when deployed (via OEM) gets an orion-web.xml which is not according to the XML schema and am wondering whether this is designed behavior.
    In my servlet I'm using some logical names for javax.jms.ConnectionFactory and javax.jms.Destination, which I specify in the web.xml. Deploying the ear file I get the change to resolve environment references to 'physical' JNDI locations. I map the logical javax.jms.ConnectionFactory to an OracleASjms resource adapter connection factory (which in turn is pointing to an JMS ConnectionFactory) and the javax.jms.Destination I map to an OracleASjms Administered resource.
    The applications deploys and works fine, however I have a question with respect to the orion-web.xml that Oracle is generating based. More specifically I see (<....> are replaced with actual values):
       <message-destination-ref-mapping
             name="<logical name>"
             location="<OracleAsjms/Administerered Object>"/>The element message-destination-ref-mapping isn't declared in the XML schema for orion-web.xml, but still it works, how come?

    http://www.oracle.com/technology/oracleas/schema/index .html
    http://www.oracle.com/technology/oracleas/schema/orion-web-10_0.xsd
    Thanks, jvissers. It seems that orion-web-10_0.xsd is outdated. It is probably that it was posted for the 10.1.3 preview. When the 10.1.3 production release is available, at least that schema is not updated. Hmm, all things that are changing but kept at different places are just very susceptible to inconsistency. Hmm, OracleAs team should probably make automated tests to make sure that they are in sync. (I am just thinking loudly). Let me try to communicate to someone who can further take care of this matter of outdated schemas. Thanks again, jvissers.
    Where did you look?Inside my oc4j installation! oc4j will not go to the web to download the oc4j-specific schemas in case of need. The orion-web-10_0.xsd is at OC4J_HOME/j2ee/home/lib/schemas.jar!META-INF/orion-web-10_0.xsd. That is where I looked. So the orion-web.xml generated by OEM is indeed valid.

  • How do I set the HELP menu to use Indesign's local HELP files on the hard drive and not the web?

    How do I set the HELP menu to use Indesign's local HELP files on the hard drive and not the web?
    CS 5.0 launches the internet browser.  > TO SLOW I DONT WANT THIS.
    CS 3.0 uses the local help files > I WANT THIS FOR 5.0.

    You're not speaking to the right forum for your request. Help is a Suite-wide feature and here is the forum where the Help application is discussed, and where the proper Adobe people hang out:
    Community Help Application

  • TS3798 I get this error message"your operation could not be completed" I need help figuring out why I can not access the web page.

    I get this error message"your operation could not be completed" I need help figuring out why I can not access the web page.

    amarilysfl wrote:
    "Your disk could not be partitioned. An error occurred while partitioning the disk".
    https://www.apple.com/support/bootcamp/
    If you were using Apple's BootCamp and received this message, quit it and open Disk Uility in your Applicaitons/Utilities folder.
    Select the Macintosh HD partition on the left and select Erase and Erase Free Space > Zero option and let it complete (important) this will check the spare space for bad sectors that can cause issues formatting partitions.
    Once it's completed, try creating a partiton again in BootCamp.
    If that doesn't work, then hold command option r keys down while connected to a fast internet connection, Internet Recovery should load (spinning globe) and then in that Disk Utility, select your entire internal drive and click > First Aid > Repair Disk and Permissions.
    reboot and attempt Bootcamp again.
    If you still get a error, it might be that you have OS X data on the bottom area where BootCamp partition needs to go. This would occur if you had the drive or computer for a long time or wrote a large amount of files to the drive and nearly filling it up and then reduced some, but it left traces in the area BootCamp needs to go.
    To fix this
    BootCamp: "This disc can not be partitioned/impossible to move files."
    How to safely defrag a Mac's hard drive

  • How to select the download location? its automatically downloading to users folder in c drive. i wanna change it..plz help me out......

    how to select the download location? its automatically downloading to users folder in c drive.. i wanna change to my desktop...plz help me out...

    Tools -> Options -> Save files to -> Click browse button and browse for folder where you want to save the file.

  • HT2729 Digital Copies to my IMac with external hard drive, then on my MacBook Pro I can see the movies, but if I close out my IMac, I can't access my movies on my laptop???  Can anyone help me out here?  Thanks.

    I have my itunes stored on my external hard drive of my IMac.
    I have started to put my Digital Copies to my IMac with external hard drive, then on my MacBook Pro I can see the movies, but if I close out my IMac, I can't access my movies on my laptop???
    Can anyone help me out here?  Thanks.

    I have my itunes stored on my external hard drive of my IMac.
    I have started to put my Digital Copies to my IMac with external hard drive, then on my MacBook Pro I can see the movies, but if I close out my IMac, I can't access my movies on my laptop???
    Can anyone help me out here?  Thanks.

  • Can you install tiger on a power mac g4 with out a DVD drive if so how, I do have have a 2011 iMac can I use that in target disk mode with a FireWire cable any help would be appreciated

    Can you install tiger on a power mac g4 with out a DVD drive if so how, I do have have a 2011 iMac can I use that in target disk mode with a FireWire cable any help would be appreciated

    Hello,
    You need to put the Tiger Install Disc in the 2011 iMac, boot the 2011 uMac into Target mode...
    http://support.apple.com/kb/HT1661
    Boot the G4 holding the Option or alt key, hopefully the Install Disc in the 2011 iMac will show as a boot choice.
    We just want to use the 2011 iMac as a big expensive FW Optical drive, it cannot be installed osing the 2011 iMac itself.

  • HT1338 Hello, i currently acquired a Mac Book Pro and running Mac Os X 10.8.3, but i have failed to get the driver for my canon inkjet printer. could anyone help me out please? Thank you

    Hello, i currently acquired a Mac Book Pro and running Mac Os X 10.8.3, but i have failed to get the driver for my canon inkjet printer. could anyone help me out please? Thank you

    You may be able to download it fom here:
    Printer and Scanner software available for download:
    http://support.apple.com/kb/HT3669?viewlocale=en_US

Maybe you are looking for