Netbeans 6 & Tomcat = love :)

Hello,
I have some problems with last release of Netbeans. It seems that it is no longer shipped with bundled tomcat so we have to configure it. I`m using tomcat 5.5 and I configured it in the IDE. However after I make run it remains idle for 5 minutes at this line:
12.12.2007 01:04:10 org.apache.catalina.startup.Catalina start
INFO: Server startup in 797 msand then:
Deployment error:
Starting of Tomcat failed.
See the server log for details.
        at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:163)
        at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: Starting of Tomcat failed.
        at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1270)
        at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1224)
        at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1035)
        at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:912)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:417)
        at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:140)
        ... 16 moreAny ideas ?
Thanks

For last 2 days I'm scratching my head (not enough hair :D ) with this problem. I will highly appreciate any advice. Tomcat is running and I can see it at localhost:10084 ... closing Netbeans 6 does not close Tomcat and another attempt to run the project cause an error (port is already occupied... killing java process associated with Tomcat will free resources)
Before I had Netbeans 5.5 and it was working fine on Vista ... guess I'm masochist - my willing to work with latest products :D
Note: Removing and installing JAVA and Netbeans 6 / Netbeans 5.5 did not solve the problem. (*F1F1F1*)
Server log:
Dec 27, 2007 9:50:23 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .... (blablabla) .... Shared\9.0\DLLShared\;C:\Program Files\QuickTime\QTSystem\
Dec 27, 2007 9:50:24 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-10084
Dec 27, 2007 9:50:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 702 ms
Dec 27, 2007 9:50:24 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 27, 2007 9:50:24 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
Dec 27, 2007 9:50:24 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-10084
Dec 27, 2007 9:50:24 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Dec 27, 2007 9:50:24 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/27 config=null
Dec 27, 2007 9:50:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 624 ms
Tomcat STDOUT:
Using CATALINA_BASE: C:\Users\Goshko\.netbeans\6.0\apache-tomcat-6.0.14_base
Using CATALINA_HOME: C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14
Using CATALINA_TMPDIR: C:\Users\Goshko\.netbeans\6.0\apache-tomcat-6.0.14_base\temp
Using JRE_HOME: C:\Program Files\Java\jdk1.6.0_03
Dec 27, 2007 9:50:23 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .... blablabla
Dec 27, 2007 9:50:24 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-10084
Dec 27, 2007 9:50:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 702 ms
Dec 27, 2007 9:50:24 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 27, 2007 9:50:24 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
Dec 27, 2007 9:50:24 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-10084
Dec 27, 2007 9:50:24 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Dec 27, 2007 9:50:24 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/27 config=null
Dec 27, 2007 9:50:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 624 ms

Similar Messages

  • Cannot create resource instance (Works on NetBeans/Tomcat)

    I have a project that works just fine in NetBeans w/ Tomcat but when I deploy it to Sun One Web Server 6.1 SP5 I get the following error:
    StandardWrapperValve[jsp]: WEB2792: Servlet.service() for servlet jsp threw exception
    javax.servlet.ServletException: Cannot create resource instance
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
         at jsps.index_jsp._jspService(_index_jsp.java:91)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
         at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
         at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
         at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
         at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
         at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
         at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
    ----- Root Cause -----
    javax.naming.NamingException: Cannot create resource instance
         at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:167)
         at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
         at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at jsps.index_jsp._jspService(_index_jsp.java:79)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
         at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
         at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
         at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
         at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
         at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
         at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
    I have the following in my in context.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/BOEnterpriseTest1">
    <Resource name="jdbc/dev10g" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.10.10.10:1521:dev" username="userid" password="pwd" maxActive="20" maxIdle="10" maxWait="-1"/>
    </Context>
    I have the following in my web.xml:
    <resource-ref>
    <description>jdbc:oracle:thin:@10..10.10.10:1521:dev</description>
    <res-ref-name>jdbc/dev10g</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    What�s missing on the Sun One server?

    I am trying to do a refresh of a Crystal Reports report in a JSP.
    Using the web.xml looking like:
    <resource-ref>
    <description>jdbc:oracle:thin:@10.10.
    10.10:1521:dev10g</description>
    <res-ref-name>jdbc/dev10g</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    and code in my JSP:
    <%
    InitialContext initContext = new InitialContext();
    DataSource source = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    try{
    DataSource ds = (DataSource)initCtx.lookup("Data");
    catch ( NamingException e ){
    DataSource ds = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");
    initCtx.bind("Data", ds);     
    I get the following error:
    WEB2720: Error initializing naming context for context /BOEnterpriseTest1
         javax.naming.NameNotFoundException: WEB3885: Name Data 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 com.iplanet.ias.web.WebModule.verifyResType(WebModule.java:510)
              at com.iplanet.ias.web.WebModule.bindResources(WebModule.java:410)
              at com.iplanet.ias.web.WebModule.bindGlobalResourceRefs(WebModule.java:352)
              at com.iplanet.ias.web.WebModule.createNamingContext(WebModule.java:323)
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3718)
              at com.iplanet.ias.web.WebModule.start(WebModule.java:251)
              at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
              at org.apache.catalina.core.StandardHost.start(StandardHost.java:652)
              at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
              at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:355)
              at org.apache.catalina.startup.Embedded.start(Embedded.java:995)
              at com.iplanet.ias.web.WebContainer.start(WebContainer.java:431)
              at com.iplanet.ias.web.WebContainer.startInstance(WebContainer.java:500)
              at com.iplanet.ias.server.J2EERunner.confPostInit(J2EERunner.java:161)
    What steps do I need to do on the Server side or in my code?

  • Problem with NetBeans/Tomcat

    apologies if this is in the wrong place - I could not find a NetBeans 6 forum
    I've recently started using NetBeans 6 to help me debug and deploy servlet/jsps
    The problem I have is that the bundled Tomcat 6.0.14 will not stop from the IDE (or restart)
    The Tomcat log looks like it is doing the job:
    20-Mar-2008 13:47:24 org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextDestroyed()but after a couple of minutes, I get a GUI message saying "Error. Stopping of Tomcat failed."
    At this point, it has stopped
    Does anyone have any workarounds or ideas please?

    I'm resolved the problem on server list, simply specifying a project as j2ee 5 can not appear tomcat 5.5 is necessary to specify j2ee 1.4.
    While for the problem on port just in use I have noticed that sometimes the server remains it isn't close, even exiting from NetBeans, for the moment i use the workaround of closing the process tomcat of linux.
    I hope that on netbeans 6.1 the problem is solved (if it had solved the problem permgen would be even more pleased, but that apparently is a problem of java and then not entered the environment from development).

  • Where to find .war in NetBeans/Tomcat

    I have Netbeans with tomcat bundled. i wish to move the project to a web server from my local server.
    Could someone tell me where to find the .WAR file on my system? Or how to make one myself please.
    Many thanks

    hi!
    Move into the folder in which you'r project is placed. Then issue the following command:
    jar -cvf filename.war . dont forget . at the end which means current directory

  • Problems with query on a DB using NetBeans Tomcat and MySql

    hi,
    I've wrote a servlet that receive uername and password from a jsp. By quering to the db the servlet verify if that user is present on the db. I've notice no errors, hovever the page displayed is the same even if the user is present on db or isn't present. Here is the class, the context.xml and the web.xml
    import java.sql.*;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Main extends HttpServlet
    public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    String driver = "com.mysql.jdbc.Driver";
    String url = "jdbc:mysql://localhost:3306/esempio3";
    int num = 0;
    String jspPage = "";
    String user, pass;
    user = request.getParameter("username");
    pass = request.getParameter("password");
    try
    Class.forName(driver).newInstance();
    Connection connessione = DriverManager.getConnection(url,"root", "admin");
    if(connessione == null)
    throw new SQLException();
    Statement statement = connessione.createStatement();
    String SQL = "SELECT ID As num FROM Utenti WHERE Username='"+user+"' AND Password='"+pass+"'";
    ResultSet risultato = statement.executeQuery(SQL);
    num = risultato.getInt("num");
    connessione.close();
    catch(Exception e)
    jspPage = "/error.jsp";
    if ( num > 0 )
    jspPage = "/Welcome.jsp";
    else
    jspPage = "/NoFound.jsp";
    request.getRequestDispatcher( jspPage ).forward(request,response);
    THE WEB.XML FILE:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <description>bla bla</description>
    <display-name>esempiooo</display-name>
    <servlet>
    <servlet-name>Main</servlet-name>
    <servlet-class>Main</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Main</servlet-name>
    <url-pattern>/Main</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <resource-ref>
    <description>jdbc:mysql://localhost:3306/esempio3</description>
    <res-ref-name>jdbc/Esempio3</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    THE CONTEXT.XML FILE
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/Esempio3">
    <Resource name="jdbc/Esempio3" auth="Container" type="javax.sql.DataSource"
    maxActive="100" maxIdle="30" maxWait="10000"
    username="root" password="admin" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/esempio3"/>
    </Context>
    Could someone help me?
    thanks

    Hi,
    the SQL string formed in that way complile, but the string in the way you said does't compile. I tryed to use PreparedStatement without succes. The result is the same. Here is the code:
    String SQL = "select ID from Utenti where USERNAME=? and PASSWORD=?";
    PreparedStatement pre = connessione.prepareStatement(SQL);
    pre.setString(1, user);
    pre.setString(2, pass);
    ResultSet risultato = pre.executeQuery(SQL);
    Thank you very much for your help

  • NetBeans with Tomcat Help - Server returned HTTP response code: 503

    Hi all, I wasn't sure where to post this.. but anyhow, my problem is as follows:
    Earlier in the day, I was able to successfully deploy my application to the Tomcat server by simply running the application from NetBeans. A couple of hours away from my computer and I returned to find this error when I ran my application:
    In-place deployment at C:\xxx
    Server returned HTTP response code: 503 for URL: http://localhost:8081/manager/deploy?config=file:/C:/xxx
    C:\xxx\nbproject\build-impl.xml:634: Deployment error:
    The module has not been deployed.
    See the server log for details.
    BUILD FAILED (total time: 36 seconds)
    Any ideas on how to solve this? I've tried reinstalling NetBeans, Tomcat, reconfiguring NetBeans but to no avail. I should also mention that I am able to successfully deploy the application sometimes when I select a different server to deploy to. >_<
    Gurus out there, please help..

    Solved my own solution.. It had to do with one of my Hibernate named queries. =x Found that out when I switched to SUN Application Server for awhile. ^_^

  • How to Run servlet in Tomcat 5.5.9

    hi
    How to run servlet in tomcat 5.5.9?how to set context path in server.xml of conf folder in tomcat since there is no context tag in server.xml.
    Jiten

    Hi ! I have a similar problem, well, it's along the same line ...
    I'm using NetBeans 4.1, and i've coded a servlet. Using NetBeans to launch my servlet (with the bundled Tomcat 5.5.7) works fine, however i need to deploy my application unto a Tomcat 5.5.9 server.
    Thus, i copied the WAR file generated by NetBeans into the Tomcat 5.5.9 webapps directory, and Tomcat expands it.
    Problem is when i run my JSP pages with the form tags, they do not work on the Tomcat 5.5.9 environment. Anyone knows why?
    (These work on the NetBeans Tomcat bundle 5.5.7)
    My form action :
    <form name="index" method="get" action="PageServlet">
    My web.xml :
    <servlet>
    <servlet-name>PageServlet</servlet-name>
    <servlet-class>application.PageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>PageServlet</servlet-name>
    <url-pattern>/PageServlet</url-pattern>
    </servlet-mapping>
    I'm really stumbed on why it doesn't work in Tomcat 5.5.9, any help is greatly appreciated, thanks in advance ^_^

  • Trying to monitor db connections in Tomcat

    All,
    Not sure if I am posting in the right place, as this problem of mine seems to cover a couple of different forum topics, but I figured since its database connections I'm trying to monitor, I'd post here.
    My desire is this... I'd like to monitor all of the connections within the connection pools for each of the deployed web apps on my Tomcat 5.0.16 (Wintel W2K) server.
    I can do this easily enough within each web app, but I would really like to have one web app that monitors all of the deployed apps on the server.
    I started out by trying to leverage Tomcat's manager application. I created a new servlet (called "ConnMonServlet") within the \server\webapps\manager\WEB-INF\classes\org\apache\catalina directory which extends the ManagerServlet. When I access the servlet with the url, "http://localhost:8080/manager/connmon", I am able to get a list of all of the deployed web apps. I am also able to get information out of each web app's web.xml (from the <env-entry>).
    With this, I am trying to create a BasicDataSource (we use the latest versions of commons-dbcp and commons-pool located within the \common\lib directory), then use it to get the number of active connections and the number of idle connections.
    My problem comes in trying to get the BasicDataSource through "normal" means, which is...
    InitialContext initCtx = new InitialContext();
    javax.naming.Context envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
    String dsName = "jdbc/raptor";
    BasicDataSource ds = (BasicDataSource) initCtx.lookup(dsName);I get the error, "javax.naming.NameNotFoundException: Name jdbc is not bound in this Context". This works fine within each web app. Is there some way to get the context for the app I'm interrogating?
    I'm just not sure if I am going about this the right way. As I go through the loop of deployed web apps, I just want to get a snapshot at that time of the number of connections both idle and active. I have posted the servlet's code below (it's still very rough).
    I have spent the better part of two days trying to get something working, and I keep hitting a wall at trying to get a BasicDataSource for the deployed web app I'm looking at in the loop. Any help anyone could provide would be greatly appreciated.
    package org.apache.catalina;
    import org.apache.catalina.deploy.ContextEnvironment;
    import org.apache.catalina.manager.ManagerServlet;
    import org.apache.commons.dbcp.BasicDataSource;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.IOException;
    //import java.util.Hashtable;
    import java.util.Iterator;
    import java.util.TreeMap;
    public class ConnMonServlet extends ManagerServlet{
        public ConnMonServlet(){
        public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException{
            doPost(req, res);
        public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException{
            System.out.println("Inside of ConnMonServlet...");
            String contextPaths[] = deployer.findDeployedApps();
            TreeMap sortedContextPathsMap = new TreeMap();
            for(int i = 0;i < contextPaths.length;i++){
                String displayPath = contextPaths;
    sortedContextPathsMap.put(displayPath, contextPaths[i]);
    Iterator iterator = sortedContextPathsMap.entrySet().iterator();
    do{
    if(!iterator.hasNext())
    break;
    java.util.Map.Entry entry = (java.util.Map.Entry) iterator.next();
    String displayPath = (String) entry.getKey();
    String contextPath = (String) entry.getKey();
    Context context = deployer.findDeployedApp(contextPath);
    if(displayPath.equals(""))
    displayPath = "/";
    if(context != null){
    System.out.println(context.getDisplayName());
    System.out.println(context.getDocBase());
    System.out.println(context.getName());
    System.out.println(context.getPath());
    String s[] = context.findParameters(); // gets <context-param> entries out of web.xml
    for(int i = 0;i < s.length;i++){
    System.out.println(">>> " + s[i]);
    ContextEnvironment[] ce = context.findEnvironments();
    //Hashtable ht = new Hashtable();
    for(int i = 0;i < ce.length;i++){
    System.out.println(">>>>>> " + ce[i].getName()); // returns "dsName" from web.xml
    System.out.println(">>>>>> " + ce[i].getDescription()); // retunr null, as there is no description
    System.out.println(">>>>>> " + ce[i].getType()); // returns "java.lang.String"
    System.out.println(">>>>>> " + ce[i].getValue()); // returns "java:comp/env/jdbc/raptor"
    //ht.put(javax.naming.Context.PROVIDER_URL, "t3://localhost:8080");
    System.out.println(" " + displayPath);
    System.out.println(" " + contextPath);
    try{
    if(!"".equals(contextPath)){
    //InitialContext initCtx = new InitialContext(ht);
    InitialContext initCtx = new InitialContext();
    javax.naming.Context envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
    String dsName = "jdbc/raptor";
    BasicDataSource ds = (BasicDataSource) initCtx.lookup(dsName); //@TODO - receiving error javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    //BasicDataSource ds = (BasicDataSource) initCtx.lookup("java:comp/env/jdbc/raptor");
    System.out.println(">>>> maxActive = " + ds.getMaxActive());
    //javax.naming.Context envCtx = (javax.naming.Context) context.getManager().getDefaultContext();
    } catch(NamingException e){
    e.printStackTrace();
    } while(true);
    Thank you!!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Very elegant response. I do appreciate the information. It is kinda amusing to think OC4J is the only "certified" app server. One of the touted benefits of portal is that it is "100% Pure J2EE Compliant..." :0) *(insert good laugh)* Seems like Oracle would be inclined to make this information more obvious (about the provider requirements), since there are soooo many app servers out there that could host portlets. I can't see how providing 'alternative, unsupported configuration docs' could hurt.
    Either way, it's no skin off my back, just a little wasted time. I will check out this 'pdksoftware.zip' and see what it gives me. I have a feeling it's the same JAR's I managed to wrangle off the PDK and server, but it's nice to know for recreating a dev environment. (And the demo I'm doing tomorrow)
    Honestly, my Netbeans / Tomcat portlet development environment is very splendid! I must say, that making a change in my 'Renderer' class and having the changes appear immediately in our development portal is a very VERY good thing. (we're talkin 5 second turnaround here) The only change that requires any kind of 'reloading' is when I change my provider.xml. Just need to 'reload' the provider, and all is good again.
    A year ago, there was a serious bug in JDev / OC4J in which the auto class reload feature simply did not work. I had this confirmed with a TAR. Hence the abandonment of JDev. Needless to say, I've been a very open-standards kinda person. May as well mention, JDev was too slow and painful to use for the kind of development I like. Maybe it's better now. Who knows.
    As my team and I slowly shuffle the moving parts of Portal, you will surely see more of my posts. Thanks again for the help!
    Cheers!
    -Sean

  • MS SQL Server 2000 + tomcat 5.5  problem

    hi,
    i'm working with netbeans 5.5, ms sql server 2000 and servlets (mvc without frameworks). When i launch my webapp with netbeans, with bundled tomcat 5.5, it works fine but when i export and deploy it under an independent tomcat (5.5 too) it crashes:
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifiedi've tried both Microsoft official drivers (even with service pack 3) and jtds to no avail.
    Here's my code:
    CONTEXT.XML
    <Resource name="jdbc/ds_arb" auth="Container"    type="javax.sql.DataSource"
    driverClassName="net.sourceforge.jtds.jdbc.Driver"      url="jdbc:jtds:sqlserver://localhost:1433;databaseName=parb;user=user;password=pwd"/>
    </Context>
    JAVA CODE
    Context initCtx = new InitialContext();
    Context dBCtx = (Context) initCtx.lookup("java:comp/env");
    ds = (DataSource) dBCtx.lookup("jdbc/ds_arb");
    jars (both in Web-inf\lib in webapp and commons\lib in tomcat)
    msbase.jar
    mssqlserver.jar
    msutil.jar
    jtds-1.2.1.jar
    commons-dbcp, and, of course,
    commons: beanutils, collections, lang & loggingii did everything: registered the classpath (with ms drivers), checked for typos, too short names, to long names, whitespaces, made sure jars were in WEB-INF\LIB and both in commons\lib, even copied commons\lib from bundled tomcat to the independent tomcat.
    Besides, if i change type, in context.xml, to
    net.sourceforge.jtds.jdbcx.JtdsDataSourceand/or add factory property
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    or
    net.sourceforge.jtds.jdbcx.JtdsObjectFactory
    this time netbeans' tomcat doesn't find their classes even when they are in commons lib and webinf-lib
    I've searched over and over and nothing works, as far as it seems, this is a quite common problem with no clear solution; but what puzzles me most is why under netbeans everything works smoothly and under an independent tomcat, which, i must insist, is the same version of the bundled one, it's such a nightmatre?
    Thanks for your time and help

    Hi,
    useful Links
    http://confluence.atlassian.com/display/CONFEXT/SQL+Plugin
    http://www.servlets.com/archive/servlet/SummarizeList?listName=tomcat-user&by=subject&count=196815&paged=false

  • Applet called from netbeans TomcatServletExample

    How?
    I started with the netbeans Tomcat Servlet Example as a base and it works fine.
    I would like to load an applet created under the same project and placed into
    the TomcatServletExample.war or in a seperate project with a seperate jar archive.
    (I have tried both)
    I have added the TestApplet.html to the Servlet project and call it from the example index.html
    My TestApplet.html just can not find my applet code.
    The error is a
    load: class socapplets.AReflectance.class not found.
    My HTML looks something like the following, I have tried many combinations with and without the
    codebase.
    <html>
    <head>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <title>TestApplet</title>
    </head>
    <body>
    Test Applet<br>
    <br>
    <APPLET CODE="socapplets.AReflectance.class"
    archive="socApplets.jar"
         WIDTH=550 HEIGHT=450>
    </APPLET>
    </body>
    </html>
    Is there a simple way of loading an applet into an external browser under netbeans. This
    is just for development only. I hope to make the applet communicate back to one of my servlets.
    My Browser is Mozilla 1.7

    Followup to my own question.
    I finally got my applet to run by adding a jar archive containing the applet directly to
    my tomcat war archive. This is ok but not ideal. I wonder if this is a strange feature of the
    bundled Tomcat or netbeans. This maybe the wrong forum, but I do
    see others with applet class not found questions. This may help.
    Thank you.
    ~
    ~

  • Trying to deploy a provider in Tomcat  - Missing: oracle/bali/share...

    I managed to get past some other missing JAR's, but since Oracle doesn't have any good documentation for deploying a portlet /provider in anything but OC4J, i'm stuck.
    Anyone know where I can find:
    oracle/bali/share/util/UnhandledException?
    There is just wayyy too many files / folders in a 9iAS install .. and there is no docs on what goes where. (Thanks guys)..
    Please help!
    Even better would be a document that details the procedure of creating a provider in ANY j2ee container. (Not just OC4J)..
    Thanks,
    -Sean

    Very elegant response. I do appreciate the information. It is kinda amusing to think OC4J is the only "certified" app server. One of the touted benefits of portal is that it is "100% Pure J2EE Compliant..." :0) *(insert good laugh)* Seems like Oracle would be inclined to make this information more obvious (about the provider requirements), since there are soooo many app servers out there that could host portlets. I can't see how providing 'alternative, unsupported configuration docs' could hurt.
    Either way, it's no skin off my back, just a little wasted time. I will check out this 'pdksoftware.zip' and see what it gives me. I have a feeling it's the same JAR's I managed to wrangle off the PDK and server, but it's nice to know for recreating a dev environment. (And the demo I'm doing tomorrow)
    Honestly, my Netbeans / Tomcat portlet development environment is very splendid! I must say, that making a change in my 'Renderer' class and having the changes appear immediately in our development portal is a very VERY good thing. (we're talkin 5 second turnaround here) The only change that requires any kind of 'reloading' is when I change my provider.xml. Just need to 'reload' the provider, and all is good again.
    A year ago, there was a serious bug in JDev / OC4J in which the auto class reload feature simply did not work. I had this confirmed with a TAR. Hence the abandonment of JDev. Needless to say, I've been a very open-standards kinda person. May as well mention, JDev was too slow and painful to use for the kind of development I like. Maybe it's better now. Who knows.
    As my team and I slowly shuffle the moving parts of Portal, you will surely see more of my posts. Thanks again for the help!
    Cheers!
    -Sean

  • Netbeans DB Connectivity

    When i normally would deploy a web app under a stand alone tomcat i would have the following code
    <Context path="/micro" docBase="micro" debug="0" reloadable="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="dating_log." suffix=".txt"
    timestamp="true"/>
    <Resource name="jdbc/MYSQL" auth="Container" type="javax.sql.DataSource"
    maxActive="0" maxIdle="30" maxWait="10000"
    username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/micro?useUnicode=true"/>
    </Context>
    However the above code does not work when i edit netbeans' tomcat server.xml file. Instead i am getting various error such as
    java.lang.IllegalArgumentException: Document base C:\Documents and Settings\costas\.netbeans\5.0beta2\jakarta-tomcat-5.5.9_base\webapps\micro does not exist or is not a readable directory
    Where should i declare the DB resource for the specific application, if i am not allowed to edit the server.xml file ?
    I was wondering what i am doing wrong. The MySQL driver is usually under the tomcats common/lib folder. Should it be there under netbeans' tomcat as well ?
    Thanx a lot,
    C.

    I've found the answer to my own question. I was working with legacy code from another programmer who had named the Date/Time field "Date". Since this is a Reserved Word, when I tried use that tag to specify a field to Insert Into, the DB Toolset interpreted the tag as a specific SQL request rather than as the name of a separate field. The fix was simply to rename that field to JunkDate (or whatever) and then the rest of the Cat String-based SQL Insert Into statement worked fine. Shows the problem of simply using legacy code, esp when it was targetted for a different platform (viz VB) and was done by a very sloppy programmer....

  • BSAIC authentication customization in Tomcat 5.5.23

    Hi,
    My apologies if this thread is not belogs to this forum.
    I'm customizing error pages for HTTP error codes in Tomcat 5.5.23.Using <error-page> tag, tomcat is redirecting to the custom error pages for all errors except 401 errors. I'm using BASIC authentication method and browser is IE.If I use <error-page> tag in web.xml ,browser is not displaying authentication login dialog and it is showing standard 401 error page.If I remove the <error-page> element from the web.xml file everything works fine. I was hoping to use my own custom error page for 401 errors when a user of my application forgets his userId/password or clicks Cancel form the Authentication login dialog.
    <error-page>
    <error-code>401</error-code>
    <location>/jsp/Error401.jsp</location>
    </error-page>
    Same like above configuration is working for all error codes.Some research helps me to place following code in the custom error page of 401 errors.
    response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "BASIC realm=\"WGL\"");
    Now If I place <error-page> tag in web.xml ,browser is popping up authentication dialog.But when authentication fails it is redirecting to the standard error page instead of custom error page.
    Thanks in advance for your help.

    One of our engineers got a chance to investigate this further. It turns out to be a bug with Tomcat (5.5.20+).
    Please refer to:
    http://issues.apache.org/bugzilla/show_bug.cgi?id=42354
    The workaround now would be to place your app in a directory that contains no spaces.
    As per the tomcat bug eval:
    Fixed in svn and will be included in 5.5.24 onwards.Let us know if the workaround works? We'll update the netbeans tomcat wiki with the above mentioned information.
    /sqad

  • Tomcat 5.5.23: SessionBean & ApplicationBean init() methods not firing

    My JSC projects will not work on Tomcat 5.5.23 because ApplicationBean init() and the SessionBean init() are not firing.
    The projects work OK on Weblogic 8.1 and the JSC dev server.
    I have followed the instructions given in
    http://developers.sun.com/docs/jscreator/help/2update1/deploy/howtodeploy/deploy_tomcat.html
    AND
    http://wiki.netbeans.org/wiki/view/DeploymentOnExternalTomcatforNB6
    AND have added:
    <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
    to my web.xml files but no success.
    This problem has been raised before but unfortunately no solution is given. http://forum.java.sun.com/thread.jspa?threadID=5137210
    Can someone please help?
    Thanks

    One of our engineers got a chance to investigate this further. It turns out to be a bug with Tomcat (5.5.20+).
    Please refer to:
    http://issues.apache.org/bugzilla/show_bug.cgi?id=42354
    The workaround now would be to place your app in a directory that contains no spaces.
    As per the tomcat bug eval:
    Fixed in svn and will be included in 5.5.24 onwards.Let us know if the workaround works? We'll update the netbeans tomcat wiki with the above mentioned information.
    /sqad

  • Crystal Reports XI and Sun One 6.1 web server SP 5 Error finding JNDI name

    I am trying to create a Crystal Reports XI report in a JSP using Sun One 6.1 Web server sp 5.
    At this point I am getting the error �Error finding JNDI name� on Sun One
    The application will run on Netbeans/Tomcat
    I have done the following:
    I edited CRConfig.xml
    <?xml version="1.0" encoding="utf-8"?>
    <CrystalReportEngine-configuration>

    <DataDriverCommon>
         <JavaDir>C:\Program Files\Java\j2re1.4.2_10\bin</JavaDir>
    <Classpath>C:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.jar;�</Classpath>

    <JDBC>
         <CacheRowSetSize>100</CacheRowSetSize>
         <JDBCURL>jdbc:oracle:thin:@10.10.10.10:1521:dev</JDBCURL>
         <JDBCClassName>oracle.jdbc.driver.OracleDriver</JDBCClassName>
         <JDBCUserName>lab_ro</JDBCUserName>
         <JNDIURL></JNDIURL>

    </JDBC>
    I created a report using JDBC (JNDI) connection and have the JNDI Connection set to the name of DATA.
    The report works just fine in Crystal Reports.
    Then in Netbeans I created an application and it runs in the Tomcat part of Netbeans
    In context.xml I have:
    <Context path="/BOEnterpriseTest3">
    <Resource name="jdbc/dev" auth="Container" type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.10.10.10:1521:dev"
    username="theuserid" password="thepassword" maxActive="20" maxIdle="10" maxWait="-1"/>
    </Context>
    In web.xml I have
    <web-app>
    <context-param>
    <param-name>crystal_image_uri</param-name>
    <param-value>crystalreportviewers11</param-value>
    </context-param>

    <taglib>
    <taglib-uri>/crystal-tags-reportviewer.tld</taglib-uri>
    <taglib-location>/WEB-INF/crystal-tags-reportviewer.tld</taglib-location>
    </taglib>
    <resource-ref>
    <description>jdbc:oracle:thin:@10.10.10.10:1521:dev</description>
    <res-ref-name>jdbc/dev10g</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-ref>
    <description>jdbc:oracle:thin:@10.10.10.10:1521:dev</description>
    <res-ref-name>Data</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    </web-app>
    in web-inf\sun-web.xml I have
    <sun-web-app>
    <resource-ref>
    <res-ref-name>jdbc/dev10g</res-ref-name>
    <jndi-name>Data</jndi-name>
    </resource-ref>
    </sun-web-app>
    I have copied all of Common Files\Business Objects\3.0\java\lib and Common Files\Business Objects\3.0\java\lib\external to the lib folder
    I have copied crystalreportviewers11 to the root of my web application
    I have tried to load the JNDI information and display the report
    <%@page pageEncoding="UTF-8"
    import="com.crystaldecisions.reports.reportengineinterface.*,
    com.crystaldecisions.report.web.viewer.*,
    javax.naming.*,
    javax.sql.*,
    java.sql.*"%>
    <%
    InitialContext initContext = new InitialContext();
    DataSource source = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    try{
         // Look up our data source
    DataSource ds = (DataSource)initCtx.lookup("Data");
    out.println("found ds under jdbc/Data");
    catch ( NamingException e ){
    // Look up our data source
    DataSource ds = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");
    initCtx.bind("Data", ds);     
    out.println("found ds under java:com/env:jdbc/Data - bound into root initial context for Crystal to find");
    %>
    <%
    //Use the relative path to the report; the physical or full qualified URL cannot be used.
    String reportName = "useridincluded.rpt";
    //Database username and password
    String userName = "theuserid";
    String password = "thepassword";
    //check to see if the Report Source Session Variable already exist
    Object reportSource = session.getAttribute("Report1");
    // Create a new ConnectionInfos and ConnectionInfo object
    com.crystaldecisions.sdk.occa.report.data.ConnectionInfos connectionInfos = new com.crystaldecisions.sdk.occa.report.data.ConnectionInfos();
    com.crystaldecisions.sdk.occa.report.data.ConnectionInfo connectionInfo = new com.crystaldecisions.sdk.occa.report.data.ConnectionInfo();
    //Set username and password for the report's database
    connectionInfo.setUserName(userName);
    connectionInfo.setPassword(password);
    //Add object to collection
    connectionInfos.add(connectionInfo);
    //---------- Create a ReportClientDocument -------------
    com.crystaldecisions.reports.sdk.ReportClientDocument reportClientDocument = new com.crystaldecisions.reports.sdk.ReportClientDocument();
    //---------- Set the path to the location of the report soruce -------------
    //Open report.
    reportClientDocument.open(reportName, 0);
    //Get the report source
    reportSource = reportClientDocument.getReportSource();
    //---------- Create the viewer and render the report -------------
    //create the CrystalReportViewer object
    com.crystaldecisions.report.web.viewer.CrystalReportViewer crystalReportViewer = new com.crystaldecisions.report.web.viewer.CrystalReportViewer();
    //set the reportsource property of the viewer
    crystalReportViewer.setReportSource(reportSource);
    //set the DB logon into the viewer
    crystalReportViewer.setDatabaseLogonInfos(connectionInfos);
    //set viewer attributes
    crystalReportViewer.setOwnPage(true);
    crystalReportViewer.setOwnForm(true);
    crystalReportViewer.refresh();
    //set the CrystalReportViewer print mode
    //crystalReportViewer.setPrintMode(com.crystaldecisions.report.web.viewer.CrPrintMode.ACTIVEX);
    crystalReportViewer.setPrintMode(com.crystaldecisions.report.web.viewer.CrPrintMode.PDF);
    //process the report
    crystalReportViewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
    %>
    On the Sun One Web server
    On the Java Tab
    JDBC Connection Pools
    Pool Name = dev10g
    Class name = oracle.jdbc.pool.OracleDataSource
    User id = theuserid
    url = 10.10.10.10
    password=thepassword
    JDBC Resources
    JNDI Name=dev10g
    Pool = dev10g
    I get the error finding JNDI name � how do I tell Sun One where the JNDI is to make Crystal Reports work?

    I tried the following to test the JNDI
    I am trying to do JNDI in Sun One Web server 6.1 sp 5 but I seem to be missing an important part. I get two different errors based on the JSP code, �Cannot retrieve data source: javax.naming.NamingException: Cannot create resource instance� or �Cannot retrieve data source: javax.naming.NamingException: Cannot create resource instance�.
    Context.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/BOTest">
      <Resource name="jdbc/dev10g" auth="Container" type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.10.10.10:1521:dev10g"
    username="userid" password="password" maxActive="20" maxIdle="10" maxWait="-1"/>
      <Resource name="Data" auth="Container" type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.10.10.10:1521:dev10g"
    username="userid" password="password" maxActive="20" maxIdle="10" maxWait="-1"/>
    </Context>Sun-one.xml:
    <sun-web-app>
    <context-root>BOTest</context-root>
    <resource-ref>
    <res-ref-name>jdbc/dev10g</res-ref-name>
    <jndi-name>jdbc/dev10g</jndi-name>
    </resource-ref>
    </sun-web-app>web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!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>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
         <welcome-file>
                index.jsp
            </welcome-file>
        </welcome-file-list>
        <resource-ref>
            <description>jdbc:oracle:thin:@10.10.10.10:1521:dev10g</description>
            <res-ref-name>jdbc/dev10g</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Application</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
        <resource-ref>
            <description>jdbc:oracle:thin:@10.10.10.10:1521:dev10g</description>
            <res-ref-name>Data</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Application</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
    </web-app>server.xml has:
    <RESOURCES>
    - <JDBCCONNECTIONPOOL name="dev10g" datasourceclassname="oracle.jdbc.pool.OracleDataSource" steadypoolsize="8" maxpoolsize="32" poolresizequantity="2" idletimeout="300" maxwaittime="60000" connectionvalidationrequired="off" connectionvalidationmethod="auto-commit" validationtablename="" failallconnections="off" transactionisolationlevel="read-uncommitted" isolationlevelguaranteed="off">
      <PROPERTY name="URL" value="jdbc:oracle:thin:@10.45.3.197:1521:dev10g" />
      <PROPERTY name="User" value="lab_ro" />
      <PROPERTY name="Password" value="0asphalt1" />
      </JDBCCONNECTIONPOOL>
      <JDBCRESOURCE jndiname="jdbc/dev10g" poolname="dev10g" enabled="on" />
      <JDBCRESOURCE jndiname="Data" poolname="dev10g" enabled="on" />
    - <JDBCCONNECTIONPOOL name="Data" datasourceclassname="oracle.jdbc.pool.OracleDataSource" steadypoolsize="8" maxpoolsize="32" poolresizequantity="2" idletimeout="300" maxwaittime="60000" connectionvalidationrequired="off" connectionvalidationmethod="auto-commit" validationtablename="" failallconnections="off" transactionisolationlevel="read-uncommitted" isolationlevelguaranteed="off">
      <PROPERTY name="User" value="lab_ro" />
      <PROPERTY name="URL" value="jdbc:oracle:thin:@10.45.3.197:1521:dev10g" />
      <PROPERTY name="Password" value="0asphalt1" />
      </JDBCCONNECTIONPOOL>
      <JDBCRESOURCE jndiname="jdbc/Data" poolname="Data" enabled="on" />
      <JDBCRESOURCE jndiname="dev10g" poolname="dev10g" enabled="on" />
      </RESOURCES>I am getting the following error: �Cannot retrieve data source: javax.naming.NamingException: Cannot create resource instance�
    With the following code:
    <%@page
       import="java.io.*,
               javax.sql.*,
               javax.naming.*,
               java.sql.*,
               java.util.*"%>
    <%
    Context init;
    Context ctx;
    DataSource datasource;
    Connection con;
    try
    init = new InitialContext();
    Context envCtx = (Context) init.lookup("java:comp/env");
    datasource = (DataSource)  envCtx.lookup("jdbc/dev10g");
    catch(NamingException ex)
        out.print("Cannot retrieve data source: " + ex.toString(true));
        return;
    try
        con = datasource.getConnection();
    catch (Exception e)
      out.print("Cannot retrieve connection: " + e.toString());
      return;
    try
        PreparedStatement pstmt = con.prepareStatement("SELECT PROJNO FROM MATERIALSLAB.VW_ASPHALTHEADERINFO");
        ResultSet results = pstmt.executeQuery();
        while (results.next())
        out.println(results.getString(1));
    catch(Exception ex)
    out.print("Got connection, can't execute query: " + ex.toString());
    return;
    %>I get the following error: Cannot retrieve data source: javax.naming.NamingException: Cannot create resource instance
    With the following code:
    <%@page
       import="java.io.*,
               javax.sql.*,
               javax.naming.*,
               java.sql.*,
               java.util.*"%>
    <%
    Context init;
    Context ctx;
    DataSource datasource;
    Connection con;
    try
        init = new InitialContext();
        ctx = (Context) init.lookup("java:comp/env");
        datasource = (DataSource) ctx.lookup("jdbc/dev10g");
    catch(NamingException ex)
        out.print("Cannot retrieve data source: " + ex.toString(true));
        return;
    try
        con = datasource.getConnection();
    catch (Exception e)
      out.print("Cannot retrieve connection: " + e.toString());
      return;
    try
        PreparedStatement pstmt = con.prepareStatement("SELECT PROJNO FROM MATERIALSLAB.VW_ASPHALTHEADERINFO");
        ResultSet results = pstmt.executeQuery();
        while (results.next())
        out.println(results.getString(1));
    catch(Exception ex)
    out.print("Got connection, can't execute query: " + ex.toString());
    return;
    %>

Maybe you are looking for