Unable to connect database by DataSource in tomcat5.5 plz help to me

hi,
i want to connect Database through DataSource in Tomcat5.5 with mysql
i wrote one servlet , made change in server.xml, web.xml.
when i access it show exception
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.org.apache.tomcat.dbcp.collections)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
        at java.security.AccessController.checkPermission(AccessController.java:427)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)The servlet
* DataSourceAccess.java
* Created on August 22, 2005, 3:14 PM
package officecom;
import java.io.*;
import java.net.*;
import java.sql.*;
import javax.naming.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
* @author Paramasivam
* @version
public class DataSourceAccess extends HttpServlet {
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        /* TODO output your page here
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Servlet DataSourceAccess</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>Servlet DataSourceAccess at " + request.getContextPath () + "</h1>");
        out.println("</body>");
        out.println("</html>");
        out.println(" got connection ?  "+getDataConnnecion());
        out.close();
    public boolean getDataConnnecion(){
        try{
            System.out.println(" INFO : getConnection called     ");
            Context initContext = new InitialContext();
            Context envContext  = (Context)initContext.lookup("java:/comp/env");
            DataSource ds = (DataSource)envContext.lookup("mysql");
            Connection con = ds.getConnection();
            if( con != null ){
                return true;
            }else
                return false;
        }catch(Exception e){
            e.printStackTrace();
            return false;
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** Handles the HTTP <code>GET</code> method.
     * @param request servlet request
     * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    /** Handles the HTTP <code>POST</code> method.
     * @param request servlet request
     * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
        return "Short description";
    // </editor-fold>
}Changes in server.xml
<GlobalNamingResources>
      <Resource
      name="mysql"
      auth="Container"
      type="javax.sql.DataSource"
      password=""
      driverClassName="com.mysql.jdbc.Driver"
      maxIdle="2"
      maxWait="5000"
      username="root"
      url="jdbc:mysql://localhost:3306/sushi?autoReconnect=true"
      maxActive="4"/>
  </GlobalNamingResources>changes in web.xml
  <resource-ref>
           <description>Tomcat DBCP</description>
           <res-ref-name>mysql</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
</resource-ref> 

You might have more answers if you post this same question in the Sun Java Studio Enterprise forum...
http://swforum.sun.com/jive/category.jspa?categoryID=90

Similar Messages

  • I buy my ipod touch like 6 months ago it was working very well but yesterday it is not connecting to the internet when i am connect to my internet it said unable to connect can you please tell me plz help me

    i buy my ipod touch like 6 months ago it was working very well but yesterday it is not connecting to the internet when i am connect to my internet it said unable to connect can you please tell me plz help me

    Do other devices successfully connect to the router?
    Does the iPod successfully connect to other networks/routers?
    Does the iPod show wifi bands in the upper left?
    Try:
    - Resetting the iPod:
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Powering off and then back on the router
    - Resetting networksettings: Settings>General>Reset>Reet Network Setting
    - The troubleshooting here
    iPhone and iPod touch: Troubleshooting Wi-Fi networks and connections

  • I am unable to view videos in youtube using mozilla plz help

    I am unable to view videos in youtube using mozilla plz help
    duplicate of [/questions/1009851]
    edit: for some reason this user shows as deactivated which I did not do.

    Are you still able to view flash videos and games from other sites?
    If so and are from India then youtube videos among many other sites were blocked. https://support.mozilla.org/en-US/forums/contributors/710463

  • Cannot connect to iTune store... even after the internet connection is working fine... plz help...

    cannot connect to iTune store... even after the internet connection is working fine... plz help...

    Same here, also cannot access the App Store. Internet connection is good. Iam on a Mac

  • Unable to Connect database from Pro*c

    Hi,
    We had installed Pro*c in Oracle 8.1.7.0.0 server
    and in client oracle_home we set as server Oracle home directory. we are using forms5.0 and pro*c
    Now we are in the process of migration to Forms6i.
    We installed in same orant client directory.
    if we set as oracle_home as server oracle home directory. we are unable to connect to database from forms if set oracle_home as client oracle_home we unable to connect from proc.
    Please give us solution

    I have installed forms5.0 and forms 6i in Client machine in DEFAULT_HOME and we are using server oracle_home to compile pro*cs and connect to database.
    where to check tns_admin

  • Unable to connect to the datasource in Endeca Studio

    Hi,
    I created a data domain using Endeca Integrator and created the corresponding data source in Endeca Studio. When I'm try to validate the data source configuration in studio it displays the following information "Data source definition format is valid but unable to connect.". But when I leave the studio on for some time and test the connection once again, it works.
    Any insight regarding this problem would be appreciated.
    Thanks,
    Shashank

    I believe you are using a machine with not a lot of RAM, that's correct?
    Maybe sometimes you need to know how many RAM you have available when you create a new One Source
    And also you need to know which Data Sources are enable...
    IN A CMD
    Cd C:\Oracle\Middleware\EndecaServer7.5.1_1\endeca-cmd
    endeca-cmd list-dd-profiles
    For more information check this...
    http://docs.oracle.com/cd/E37502_01/server.751/AdminGuide.pdf
    Let me know if this help you...
    EBrauerP

  • TS1741 Bought an app last night.  Tried to buy another an hour later and got the window that says "Cannot connect to iTunes Store".  Still unable to connect today.  Tried restarting router. Help please....thanks!

    Bought an app last night.  Tried to buy another an hour later and got the window that says "Cannot connect to iTunes Store". Still unable to connect to store today.  Tried restarting router.  Help please....thanks.

    The Complete Guide to Using the iTunes Store
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/TS3297
    This works for some users. Not sure why.
    Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
     Cheers, Tom

  • I am unable to connect database this error  ORA-00020: maximum number of

    i issuing this command / as sysdba .getting this error
    Enter user-name: / as sysdba
    ERROR:
    ORA-00020: maximum number of processes (300) exceeded
    how to resolve this problem.it is verry verry urgent.

    Hi
    "Maximum number of processes exceeded" will be alerted when your database has received a request for connection from a process which is beyond the number of processes your database can allow for.
    Please check your database parameters
    show parameters processes
    Couple of options:
    a) If your database has been running for a while and if it's the first time you are recieving this error, please check why all of a sudden more and more processes have been created. You may want to investigate your application, users, etc
    b) If it's a valid request and if it's the case that you haven't really configured enough processes, you will have to increase the PROCESSES parameter in your init file and restart the database. It's not a dynamic parameter. Also, make sure you increase the sessions parameter as well along with the processes.
    Before you do this, you will also have to check if your OS has been configured for increasing the number of processes. Think it's semmsl in Unix.

  • Unable to connect FR studio Datasource

    Hi all,
    I am facing an issue, when i logon to FR studio and wants to prepare new report -> clicking on 'Insert grid' -> it promts some error. *"DatasourceIDLogin.LoadDatasourceNames Error: -2147467259 Error Loading DatasourceList to Repository"*. after that i have to kill the application to quit. So pls help me in this issue.
    Thanks in advance.

    Hi Manohar,
    I did as u siad. When again i connected to FR studio and "insert Grid" -> Same Datasource Error occurs. In 'FRClient.log' file like this
    01-05 19:11:02 ERROR HrGlobalMethods     uncompressBytes()
    01-05 19:11:02 ERROR HrGlobalMethods     Exception occured: null
    01-05 19:11:02 ERROR HrGlobalMethods     java.lang.NullPointerException
         at java.io.ByteArrayInputStream.<init>(Unknown Source)
         at com.hyperion.reporting.util.HrGlobalMethods.uncompressBytes(Unknown Source)
         at com.hyperion.reporting.datasource.HrDatasourceManagerImpl.load(Unknown Source)
         at com.hyperion.reporting.datasource.HrDatasourceManagerImpl.getDatasources(Unknown Source)
         at com.hyperion.reporting.datasource.HrDatasourceManagerImpl.getDatasources(Unknown Source)
         at com.hyperion.reporting.javacom.HrDatasourceManagerComImpl.getAllDatasources(Unknown Source)
    01-05 19:11:02 ERROR HrDatasourceManagerImpl     Exception occured: null
    01-05 19:11:02 ERROR HrDatasourceManagerImpl     java.lang.NullPointerException
         at java.io.ByteArrayInputStream.<init>(Unknown Source)
         at com.hyperion.reporting.datasource.HrDatasourceManagerImpl.load(Unknown Source)
         at com.hyperion.reporting.datasource.HrDatasourceManagerImpl.getDatasources(Unknown Source)
         at com.hyperion.reporting.datasource.HrDatasourceManagerImpl.getDatasources(Unknown Source)
         at com.hyperion.reporting.javacom.HrDatasourceManagerComImpl.getAllDatasources(Unknown Source)
    I think it may help you to find the deffect.
    thanks in advance.

  • Unable to connect database- Demantra Engine

    All,
    I am trying to run demantra analytical engine from engine admin in windows server. Once default credentials entered and try to connect, its throwing "Failed to connect to the database". Can someone help to resolve the issue. Am I missing any pre-req setups.
    Thanks in Advance
    JJ

    are you able to connect to the demantra database using the same credentials.. try in sql, toad, sql developer whether the credentials works and you are able to connect

  • Unable to connect database

    Hi experts,
    I have
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    And when i do below
    +/export/home/oracle->cd $ORACLE_HOME+
    +/export/home/oracle/app/oracle/product/11.2.0/dbhome_1->sqlplus / as sysdba+
    SQL*Plus: Release 11.2.0.1.0 Production on Sat Apr 17 14:10:10 2010
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    ERROR:
    ORA-09817: Write to audit file failed.
    Linux-x86_64 Error: 28: No space left on device
    Additional information: 12
    ORA-01075: you are currently logged on
    So which files i have to remove so that my db will work. Please provide the steps

    Hi,
    ERROR:
    ORA-09817: Write to audit file failed.
    Linux-x86_64 Error: 28: No space left on device
    Additional information: 12
    ORA-01075: you are currently logged onThe error code and error message is pretty clear to understand. try to take the backup of the present things into some other disk and try to delete the present logs with respect to the diagnostic_dest parameter value. Make a some space available for logs.
    HTH
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

  • HT201250 My Time Machine Icon in the Toolbar is dimmed, and I'm unable to connect to my external Hard Drive, please help!

    Time Machine seems to be dead, since I'm unable to reset it. As soon as I try  anything, it goes to back to the "OFF" Position. Would appreciate any Help, to get my external Hard Drive to work. Adolffrom Peachland!
    Product, 2012 IMac 21.5"

    There's an apple store in my city but it is about a 20 minute drive and I do not have apple care. Do you think they would still help me?

  • Unable to connect to istore via laptop, can anyone help?

    Been to apple support prior and done everything they have asked. Not been able to connect to istore since april.
    Istore tries to connect then connection just falls away, no error messages etc.

    I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • TS1702 Unable to get angry birds space danger zone to download. Everything else will download and I have a receipt for it but can't play it. Also says unable to connect to the iTunes store. Need help in normal English not tech talk please. Thank u

    I can't get angry birds space danger zone to download. I have a receipt but it won't download. I bought angry birds space and music just fine but this game won't download. Also says can not connect to iTunes store.

    try contacting the app developer and see if they can resolve your issue.

  • Problem in connecting CRM to SAP R/3  plz help

    Hi friends,
      I am ravi. I am facing problem making connection between CRM to SAP R/3.
    In my pc i installed ECC 5.0 version and CRM 4.0 in Windows 2003 OS.
    He installed CRM server in Virtual Mechine of OS, and ECC 5.0 in normal mode.
    I am starting two servers simultaniously while starting VM and i am working with both
    but i am not able to maintain connection I tried but failed. he installed login pad in
    normal OS. What  have to maintain to make connection between these.
    Please  help me.
    Thank u,
    with regards,
    Ravi

    Hi,
       I used the following Steps to do the process..
    1. Created a logical system in R/3 and CRm Server.
    2. Created a RFC destination in both server.
    3. Assigned an RFC user.
       What is the next step I need to proceed. I struk up with the following steps.
    1. Transaction EWFC0( Configure Action Box)..Created the transaction group (J1f), Created the transaction J1FM.J1F is the namespace for my ADD-ON in R/3.Selected BOR.Given logical system.It asks for the object type and method.
    My doubt is,
    What object type to be selected or Do we need to create the object type for customer specific transaction...if so where?
    After assignening what are the steps I have to do.
    Please help me.
    Thanks
    Mani

Maybe you are looking for

  • How do you invoke the customer satisfaction guarantee on HP photo paper?

    OK, perhaps this is a silly question, but I can't find anything on the HP site or forums that addresses this.  How does one invoke the customer satisfaction guarantee on HP photo paper?  The instructions in the box (and website) tell me to call HP cu

  • Java.rmi.RemoteException: EJB Exception: while calling an EJB method,

    Hi I am getting below error while calling a stateless EJB method. There is some validation checks while performing ejb's modify() method and a RuntimeException is thrown in case of validation failure.The modify() method internally calls other statele

  • N100 intel 945gm 1920x1080

    I've been reading mixed things about the ability to output greater than 1600 x 900 through VGA, but haven't found a way to do it. Anyone succesfully changed the resolution of an external monitor to 1920x1080?

  • CCM 6.0 Directory

    Hii,, Is there is any chance to change the directory setting in call manger 6 to display the first name then the las name. It was easy in ccm 4.2 cox it was windows based, but now how can I access the file. Thanks

  • BW Upgrade : BI Statistic

    Hi , We have just upgraded from BW3,.5 to BI7.3. One of the difference which i am aware of if the BI Statistic. In BW3.5 , Statistic was under 'InfoProvider-Technical Content-BW Statistics.' In BI7.3 , The above had been moved to 'InfoProvider-Busine