Re: jndi question
Sean, One thing that stands out in your message is that the conext.xml file was placed in the META-INF folder. Is it also in Tomcat Folder/conf/Catalina/localhost/ as the module name? i.e. If the context path name of your webapp is /seansApp the context.xml file should appear in this folder as seansApp.xml. The context.xml file is stored in META-INF during development but needs to be placed in Tomcat Folder/conf/Catalina/localhost/ folder for deployment with the file name of the context path. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being
RE: jndi question
Hi, The context.xml file is stored in META-INF during development but needs to be placed in Tomcat Folder/conf/Catalina/localhost/ folder for deployment with the file name of the context path. I don't think that's quite true. META-INF is a permanent valid location for context.xml, and does not affect deployment if /conf/Catalina/localhost/ does not have a file for the web application. We always keep context.xml only in META-INF. However, if 2 are present this may cause issues as you say, Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 25 August 2005 14:39 To: Tomcat Users List Subject: Re: jndi question Sean, One thing that stands out in your message is that the conext.xml file was placed in the META-INF folder. Is it also in Tomcat Folder/conf/Catalina/localhost/ as the module name? i.e. If the context path name of your webapp is /seansApp the context.xml file should appear in this folder as seansApp.xml. The context.xml file is stored in META-INF during development but needs to be placed in Tomcat Folder/conf/Catalina/localhost/ folder for deployment with the file name of the context path. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageExceptio n(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException( PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServlet Wrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet .java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServlet Wrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet .java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked
Re: jndi question
Hi I had the same problem and I managed to make this work when following this post http://forums.devshed.com/archive/t-120081 The only problem is that it works when a deploy a war file. When I try using this out of Eclipse (I am running tomcat using sysdeo plug-in) it makes problems. Let me know how do you use tomcat. Regards Haim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
yes, there is a file in the /conf/Catalina/localhost directory for my app Brian Cook wrote: Sean, One thing that stands out in your message is that the conext.xml file was placed in the META-INF folder. Is it also in Tomcat Folder/conf/Catalina/localhost/ as the module name? i.e. If the context path name of your webapp is /seansApp the context.xml file should appear in this folder as seansApp.xml. The context.xml file is stored in META-INF during development but needs to be placed in Tomcat Folder/conf/Catalina/localhost/ folder for deployment with the file name of the context path. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml
Re: jndi question
It has probablly already been stated before somewhere in this thread but what versions of Tomcat and JDK are you using? Sean Rowe wrote: yes, there is a file in the /conf/Catalina/localhost directory for my app Brian Cook wrote: Sean, One thing that stands out in your message is that the conext.xml file was placed in the META-INF folder. Is it also in Tomcat Folder/conf/Catalina/localhost/ as the module name? i.e. If the context path name of your webapp is /seansApp the context.xml file should appear in this folder as seansApp.xml. The context.xml file is stored in META-INF during development but needs to be placed in Tomcat Folder/conf/Catalina/localhost/ folder for deployment with the file name of the context path. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote
Re: jndi question
tomcat 5, and jdk 1.5 Brian Cook wrote: It has probablly already been stated before somewhere in this thread but what versions of Tomcat and JDK are you using? Sean Rowe wrote: yes, there is a file in the /conf/Catalina/localhost directory for my app Brian Cook wrote: Sean, One thing that stands out in your message is that the conext.xml file was placed in the META-INF folder. Is it also in Tomcat Folder/conf/Catalina/localhost/ as the module name? i.e. If the context path name of your webapp is /seansApp the context.xml file should appear in this folder as seansApp.xml. The context.xml file is stored in META-INF during development but needs to be placed in Tomcat Folder/conf/Catalina/localhost/ folder for deployment with the file name of the context path. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql
RE: jndi question
From: Sean Rowe [mailto:[EMAIL PROTECTED] Subject: Re: jndi question tomcat 5, and jdk 1.5 Which Tomcat 5? The configuration for the 5.0 series is not necessarily the same as in 5.5. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
right! sorry, it's 5.5.9 Caldarale, Charles R wrote: From: Sean Rowe [mailto:[EMAIL PROTECTED] Subject: Re: jndi question tomcat 5, and jdk 1.5 Which Tomcat 5? The configuration for the 5.0 series is not necessarily the same as in 5.5. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
I thought of that but his code samples and configs are consitant with both the 5.0 and 5.5 docs. Which Tomcat 5? The configuration for the 5.0 series is not necessarily the same as in 5.5. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
Sean, I copied your code on top of mine and ran it with no problems. So you can probably eliminate the code as the issue. Also since the error is now on the java:comp resource and not your JNDI defined resources I think your context.xml and web.xml configuration is correct too. I googled the javax.naming.NameNotFoundException on string java:comp I found several postings that mentioned they fixed it by removing the following files from their deployments. http://forum.java.sun.com/thread.jspa?threadID=647982tstart=105 naming-common.jar, naming-java.jar, naming-resources.jar, naming-factory.jar Are these by chance in your WEB-INF folder somewhere? Or any where in your Tomcat install? I checked they are not in mine and I have : naming-factory.jar naming-resources.jar in Tomcat/common/lib/ If you see these files any where else try deleting them. Other than that my only idea would be to try using Tomcat 5.5. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what
Re: jndi question
i do have those files. i'll remove them and see what happens. i really appreciate the help. sean Brian Cook wrote: Sean, I copied your code on top of mine and ran it with no problems. So you can probably eliminate the code as the issue. Also since the error is now on the java:comp resource and not your JNDI defined resources I think your context.xml and web.xml configuration is correct too. I googled the javax.naming.NameNotFoundException on string java:comp I found several postings that mentioned they fixed it by removing the following files from their deployments. http://forum.java.sun.com/thread.jspa?threadID=647982tstart=105 naming-common.jar, naming-java.jar, naming-resources.jar, naming-factory.jar Are these by chance in your WEB-INF folder somewhere? Or any where in your Tomcat install? I checked they are not in mine and I have : naming-factory.jar naming-resources.jar in Tomcat/common/lib/ If you see these files any where else try deleting them. Other than that my only idea would be to try using Tomcat 5.5. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's
Re: jndi question
) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you are trying to do here. Sean Rowe wrote: Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools
Re: jndi question
these files any where else try deleting them. Other than that my only idea would be to try using Tomcat 5.5. Sean Rowe wrote: I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am
Re: jndi question
I have tried again using the method described in the url brian gave. Here is the stack exception I'm receiving: *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Name java:comp is not bound in this Context org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* javax.naming.NameNotFoundException: Name java:comp is not bound in this Context org.apache.naming.NamingContext.lookup(NamingContext.java:769) org.apache.naming.NamingContext.lookup(NamingContext.java:152) javax.naming.InitialContext.lookup(InitialContext.java:351) com.transcriptionportal.utils.DBManager.init(DBManager.java:25) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I have enclosed my server.xml, web.xml, context.xml (that i placed in my web/META-INF folder), and the class I'm using to make the connection. Thanks again to everyone who has helped me so far. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you
Re: jndi question
Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files. Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password=dbpassword driverClassName=org.hsql.jdbcDriver url=jdbc:HypersonicSQL:database maxActive=8 maxIdle=4/ /Context /CONTEXT FILE Sean Rowe wrote: Dirk, I'm sorry I didn't see the difference on the page you sent me to. However, if there is a way I can do this without having to use jstl, I would really like to know. I was hoping to put the code in a class somewhere that my servlets could use. thanks, sean Dirk Weigenand wrote: Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org Betreff: Re: jndi question Datum: Mon, 22 Aug 2005 09:24:10 -0500 Thanks for responding Dirk. I've practically memorized the documentation on the link you sent: // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); // Allocate and use a connection from the pool Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); Whenever I try this, here's what I get (which led me to trying it the way I posted): javax.naming.NameNotFoundException: Name java:comp is not bound in this Context No. Did you look at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? I recommend putting the context definition in its own content.xml. On redeploying my application tomcat wouldn't find the driver class anymore. Mind you not the class itself but the definition of what class to load. This problem was solved by putting the context into context.xml. regards Dirk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brian Cook Digital Services Analyst Print Time Inc. [EMAIL PROTECTED] 913.345.8900 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail
Re: jndi question
Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password=dbpassword driverClassName=org.hsql.jdbcDriver url=jdbc:HypersonicSQL:database maxActive=8 maxIdle=4/ /Context /CONTEXT FILE Sean Rowe wrote: Dirk, I'm sorry I didn't see the difference on the page you sent me to. However, if there is a way I can do this without having to use jstl, I would really like to know. I was hoping to put the code in a class somewhere that my servlets could use. thanks, sean Dirk Weigenand wrote: Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org Betreff: Re: jndi question Datum: Mon, 22 Aug 2005 09:24:10 -0500 Thanks for responding Dirk. I've practically memorized the documentation on the link you sent: // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); // Allocate and use a connection from the pool Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); Whenever I try this, here's what I get (which led me to trying it the way I posted): javax.naming.NameNotFoundException: Name java:comp is not bound in this Context No. Did you look at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? I recommend putting the context definition in its own content.xml. On redeploying my application tomcat wouldn't find the driver class anymore. Mind you not the class itself but the definition
RE: jndi question
Hi, The documentation says; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); However, we use; try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup(java:comp/env/jdbc/yourdb); } catch (NamingException nE) { // log somewhere } catch (NullPointerException npE) { // log somewhere } Does that work for you? Allistair -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:29 To: Tomcat Users List Subject: Re: jndi question Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password=dbpassword driverClassName=org.hsql.jdbcDriver url=jdbc:HypersonicSQL:database maxActive=8 maxIdle=4/ /Context /CONTEXT FILE Sean Rowe wrote: Dirk, I'm sorry I didn't see the difference on the page you sent me to. However, if there is a way I can do this without having to use jstl, I would really like to know. I was hoping to put the code in a class somewhere that my servlets could use. thanks, sean Dirk Weigenand wrote: Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org Betreff: Re: jndi question Datum: Mon, 22 Aug 2005 09:24:10 -0500 Thanks for responding Dirk. I've practically memorized the documentation on the link you
Re: jndi question
no, that didn't help. thanks though. could this maybe be a class problem? am i using the wrong jar files? i can list the files i'm using if anyone thinks it might be the problem Allistair Crossley wrote: Hi, The documentation says; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); However, we use; try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup(java:comp/env/jdbc/yourdb); } catch (NamingException nE) { // log somewhere } catch (NullPointerException npE) { // log somewhere } Does that work for you? Allistair -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:29 To: Tomcat Users List Subject: Re: jndi question Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password=dbpassword driverClassName=org.hsql.jdbcDriver url=jdbc:HypersonicSQL:database maxActive=8 maxIdle=4/ /Context /CONTEXT FILE Sean Rowe wrote: Dirk, I'm sorry I didn't see the difference on the page you sent me to. However, if there is a way I can do this without having to use jstl, I would really like to know. I was hoping to put the code in a class somewhere that my servlets could use. thanks, sean Dirk Weigenand wrote: Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org
RE: jndi question
If you could please send 1. server.xml 2. web.xml 3. context.xml or yourwebapp.xml 4. list of files in common/lib 5. list of files in yourwebapp/WEB-INF/lib I'd be happy to see if I can spot anything. -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:41 To: Tomcat Users List Subject: Re: jndi question no, that didn't help. thanks though. could this maybe be a class problem? am i using the wrong jar files? i can list the files i'm using if anyone thinks it might be the problem Allistair Crossley wrote: Hi, The documentation says; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); However, we use; try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup(java:comp/env/jdbc/yourdb); } catch (NamingException nE) { // log somewhere } catch (NullPointerException npE) { // log somewhere } Does that work for you? Allistair -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:29 To: Tomcat Users List Subject: Re: jndi question Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password=dbpassword driverClassName=org.hsql.jdbcDriver
Re: jndi question
thank you, i will Allistair Crossley wrote: If you could please send 1. server.xml 2. web.xml 3. context.xml or yourwebapp.xml 4. list of files in common/lib 5. list of files in yourwebapp/WEB-INF/lib I'd be happy to see if I can spot anything. -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:41 To: Tomcat Users List Subject: Re: jndi question no, that didn't help. thanks though. could this maybe be a class problem? am i using the wrong jar files? i can list the files i'm using if anyone thinks it might be the problem Allistair Crossley wrote: Hi, The documentation says; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); However, we use; try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup(java:comp/env/jdbc/yourdb); } catch (NamingException nE) { // log somewhere } catch (NullPointerException npE) { // log somewhere } Does that work for you? Allistair -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:29 To: Tomcat Users List Subject: Re: jndi question Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password
Re: jndi question
Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you are trying to do here. Sean Rowe wrote: Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password=dbpassword driverClassName=org.hsql.jdbcDriver url=jdbc:HypersonicSQL:database maxActive=8 maxIdle=4/ /Context /CONTEXT FILE Sean Rowe wrote: Dirk, I'm sorry I didn't see the difference on the page you sent me to. However, if there is a way I can do this without having to use jstl, I would really like to know. I was hoping to put the code in a class somewhere that my servlets could use. thanks, sean Dirk Weigenand wrote: Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org Betreff: Re: jndi question Datum: Mon, 22 Aug 2005 09:24:10 -0500 Thanks for responding Dirk. I've practically memorized the documentation on the link you sent: // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource
RE: jndi question
Hi Sean, It looks from a quick glance that your JNDI configuration is done globally, rather than in the Context configuration, and you do not link to it using a ResourceLink. Try adding ResourceLink name=myLinkToAppJndi global=jdbc/appname type=javax.sql.DataSource / Into the Context block, and remove the Resource block you have in there. The other thing to try would be to move the JNDI datasource Resource configuration block into the Context block. See how you get on, Allistair. -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:45 To: Tomcat Users List Subject: Re: jndi question thank you, i will Allistair Crossley wrote: If you could please send 1. server.xml 2. web.xml 3. context.xml or yourwebapp.xml 4. list of files in common/lib 5. list of files in yourwebapp/WEB-INF/lib I'd be happy to see if I can spot anything. -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:41 To: Tomcat Users List Subject: Re: jndi question no, that didn't help. thanks though. could this maybe be a class problem? am i using the wrong jar files? i can list the files i'm using if anyone thinks it might be the problem Allistair Crossley wrote: Hi, The documentation says; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); However, we use; try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup(java:comp/env/jdbc/yourdb); } catch (NamingException nE) { // log somewhere } catch (NullPointerException npE) { // log somewhere } Does that work for you? Allistair -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:29 To: Tomcat Users List Subject: Re: jndi question Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers
Re: jndi question
The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you are trying to do here. Sean Rowe wrote: Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource-ref 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 res-ref-name jdbc/EmployeeDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref /WEB.XML CONTEXT FILE Context Resource name=jdbc/EmployeeDB auth=Container type=javax.sql.DataSource username=dbusername password=dbpassword driverClassName=org.hsql.jdbcDriver url=jdbc:HypersonicSQL:database maxActive=8 maxIdle=4/ /Context /CONTEXT FILE Sean Rowe wrote: Dirk
Re: jndi question
i will try that. thanks allistair, i really do appreciate this Allistair Crossley wrote: Hi Sean, It looks from a quick glance that your JNDI configuration is done globally, rather than in the Context configuration, and you do not link to it using a ResourceLink. Try adding ResourceLink name=myLinkToAppJndi global=jdbc/appname type=javax.sql.DataSource / Into the Context block, and remove the Resource block you have in there. The other thing to try would be to move the JNDI datasource Resource configuration block into the Context block. See how you get on, Allistair. -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:45 To: Tomcat Users List Subject: Re: jndi question thank you, i will Allistair Crossley wrote: If you could please send 1. server.xml 2. web.xml 3. context.xml or yourwebapp.xml 4. list of files in common/lib 5. list of files in yourwebapp/WEB-INF/lib I'd be happy to see if I can spot anything. -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:41 To: Tomcat Users List Subject: Re: jndi question no, that didn't help. thanks though. could this maybe be a class problem? am i using the wrong jar files? i can list the files i'm using if anyone thinks it might be the problem Allistair Crossley wrote: Hi, The documentation says; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); However, we use; try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup(java:comp/env/jdbc/yourdb); } catch (NamingException nE) { // log somewhere } catch (NullPointerException npE) { // log somewhere } Does that work for you? Allistair -Original Message- From: Sean Rowe [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 16:29 To: Tomcat Users List Subject: Re: jndi question Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know
Re: jndi question
Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you are trying to do here. Sean Rowe wrote: Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context and by extent the WAR file but it is what you have to do to get it to work right now. I feel your pain I know it is frustrating spending hours debugging just the DB connection but todate that is the reality of Java web app development. It is why I fear we will all be .Net developers some day. Example : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html CODE Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); /CODE WEB.XML resource
RE: jndi question
Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you are trying to do here. Sean Rowe wrote: Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use it. I removed them both and have gone back to doing set ups manually and there has not been much of a time difference doing it this way. Any way for JNDI to work you will have to add the definition for it in both web.xml and context.xml in the Tomcat Folder/conf/Catalina/localhost/ folder. This seems counter productive since it makes your app less portable having the data base configuration details inside the context
Re: jndi question
I will try all 3 once again, and provide screen shots of the errors I see. I have tried these methods before, but I will try them again for a sanity check. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you are trying to do here. Sean Rowe wrote: Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which does not really seem to be all that helpful. I am sure there is likely a reason for this but I am ignorant of it. The admin tool is also supposed to let you define JNDI resources per context but it errors out when ever I have tried it. My experience with the Tomcat Admin and Manager tools is that they are worthless. Of the few steps they try to help with more often that not they just return errors when you need to use
Re: jndi question
Do not need the screen shots. Just copy and paste the stack trace error of the exception(All the gobblay gook that shows up on screen or in catalina.out when an exception is thrown.), the details of which ever combination of config files you are using, the code actually calling the JNDI resource. Just as a future reference including all of those things in your posts will help get a solution to your problem faster and will increase the number of people that will respond to your posts. You may find these posting guild lines helpful too. http://jakarta.apache.org/site/mail.html Sean Rowe wrote: I will try all 3 once again, and provide screen shots of the errors I see. I have tried these methods before, but I will try them again for a sanity check. sean Allistair Crossley wrote: Hi, He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. Allistair. -Original Message- From: Brian Cook [mailto:[EMAIL PROTECTED] Sent: 23 August 2005 17:23 To: Tomcat Users List Subject: Re: jndi question Ok but do you have the resource defined in context.xml? If you go to Tomcat Dir/conf/Cataliana/localhost/ do you see a file with the name of the module ending with .xml? If so is the resource defined in that file? If not you need to add it. From the description it sounds like nothing in this set up has been done as was show on the example page. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources -howto.html If you use the code block that is shown, define that resource in web.xml and context.xml it will work. But multiple postings latter it still sounds like the JNDI resource is not defined in context.xml and the code calling the JNDI resource differs greatly from the example provided. Sean Rowe wrote: The first post on this included the server.xml, and further down in the page is the relevant part of web.xml ( i just double checked that ). as for context.xml, i have listed it in my webapp.xml file, as well as server.xml as all other examples have suggested. i then tried it in the admin module, where it then put it in server.xml for me. i'm willing to try anything at this point, though, if you have any suggestions. as for my post not being jndi specific, i applogize if that's the case. i'm not really familiar with jndibut when I did a search for 'connection pooling', jndi seemed to be what everyone suggested i use. what i want to do, if it's not clear, is to create a connection pool to my MySql database. thanks, sean Brian Cook wrote: Actually the files I listed are NOT in the first post. It shows the server.xml and the code calling it but does not show web.xml or context.xml. The error you are getting just means that that the JNDI resource being called in the code is not defined in both web.xml and context.xml. In looking at the code snip it in the first post I am not following what you are trying to do. The post is for a JNDI question but in the code it looks like you are calling the DB URL directly. The whole point of JDNI being to get specific URL, and configuration info outside of the code base. I am not following what it is you are trying to do here. Sean Rowe wrote: Brian, thank you for replying. I was afraid my topic was dead. If you could look at my first post, I listed all the files that you have suggested I take a look at. I have done everything you have suggested, but am still getting errors. The error I am getting now is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context I can't find anything on the net or in any books I've looked at that explains this. As far as I can tell, java:comp should just be there. Any ideas? Thanks again. Sean Brian Cook wrote: Yes you can use JNDI with out using JSTL. But the only way to configure it is to define the JNDI resources in the web.xml and context.xml files.Technically you should be able to use the globally defined JNDI resources in server.xml, and I have seen configuration set ups doing it when googling. But could never get them to work. This highlights another area of seemingly unneeded complication in Java/Unix development. Using JNDI for data sources which was supposed to help you save time requires that you redundantly define the JNDI resource in at lest 2 if not 3 places. The admin tool which was also supposed to help save time defines the JNDI resources in server.xml which
jndi question
I have tried for several hours now to get connection pooling for my MySql database to work, but have been unable to do so. I keep getting this error: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.commons.dbcp.BasicDataSourceFactory I checked to make sure this class was in my classpath: [shell]# javap org.apache.commons.dbcp.BasicDataSourceFactory Compiled from BasicDataSourceFactory.java public class org.apache.commons.dbcp.BasicDataSourceFactory extends java.lang.Object implements javax.naming.spi.ObjectFactory{ public org.apache.commons.dbcp.BasicDataSourceFactory(); public java.lang.Object getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) throws java.lang.Exception; public static javax.sql.DataSource createDataSource(java.util.Properties) throws java.lang.Exception; static {}; } I set up my jndi datasource using the admin module. Here's how it wrote out my server.xml file: ?xml version=1.0 encoding=UTF-8? Server Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/ Listener className=org.apache.catalina.storeconfig.StoreConfigLifecycleListener/ Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/ GlobalNamingResources Environment name=simpleValue type=java.lang.Integer value=30/ Resource auth=Container description=User database that can be updated and saved name=UserDatabase type=org.apache.catalina.UserDatabase pathname=conf/tomcat-users.xml factory=org.apache.catalina.users.MemoryUserDatabaseFactory/ Resource name=jdbc/appname type=javax.sql.DataSource driverClassName=com.mysql.jdbc.Driver password= maxIdle=30 maxWait=10 validationQuery=SELECT 1 username=username url=jdbc:mysql://localhost:3306/appname maxActive=100/ /GlobalNamingResources Service name=Catalina Connector port=8080 redirectPort=8443 minSpareThreads=25 connectionTimeout=2 maxThreads=150 maxSpareThreads=75 maxHttpHeaderSize=8192 /Connector Connector port=8443 scheme=https secure=true minSpareThreads=25 clientAuth=false maxThreads=150 maxSpareThreads=75 maxHttpHeaderSize=8192 /Connector Connector port=8009 redirectPort=8443 protocol=AJP/1.3 /Connector Engine defaultHost=localhost name=Catalina Realm className=org.apache.catalina.realm.UserDatabaseRealm/ Host appBase=webapps name=localhost unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false Context path=/devtrans Resource auth=Container description=DB Connection name=jdbc/appname type=javax.sql.DataSource/ WatchedResource/usr/local/tomcat/server/conf/context.xml/WatchedResource WatchedResourceWEB-INF/web.xml/WatchedResource /Context /Host /Engine /Service /Server Here's what's in my web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/appname/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref It's bombing out on this code: Properties p=new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.commons.dbcp.BasicDataSourceFactory); p.put(Context.PROVIDER_URL,jdbc:mysql://localhost:3306); Context initCtx = new InitialContext(p); // here's where it dies Can someone please help me, or at least point me in the direction of some documentation that I've missed? I've searched google and every other search engine I can think of. Thanks in advance. Sean Rowe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
Hi Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: tomcat-user@jakarta.apache.org Betreff: jndi question Datum: Mon, 22 Aug 2005 01:26:49 -0500 I have tried for several hours now to get connection pooling for my MySql database to work, but have been unable to do so. I keep getting this error: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.commons.dbcp.BasicDataSourceFactory It's bombing out on this code: Properties p=new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.commons.dbcp.BasicDataSourceFactory); p.put(Context.PROVIDER_URL,jdbc:mysql://localhost:3306); Context initCtx = new InitialContext(p); // here's where it dies You're mixing up some concepts here. Context.INITIAL_CONTEXT_FACTORY is meant to provide the name of a factory producing JNDI contexts, not a factory for producing JDBC DataSources. The same goes for the next line of code. Context.PROVIDER_URL is not used for providing information about a database connection. There is extensive documentation on the tomcat web site regarding JNDI ressource configuration. Have a look at the following URL: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html Can someone please help me, or at least point me in the direction of some documentation that I've missed? I've searched google and every other search engine I can think of. Thanks in advance. Sean Rowe Regards Dirk -- GMX DSL = Maximale Leistung zum minimalen Preis! 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
Thanks for responding Dirk. I've practically memorized the documentation on the link you sent: // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); // Allocate and use a connection from the pool Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); Whenever I try this, here's what I get (which led me to trying it the way I posted): javax.naming.NameNotFoundException: Name java:comp is not bound in this Context Any ideas? Thanks again. Sean Dirk Weigenand wrote: Hi Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: tomcat-user@jakarta.apache.org Betreff: jndi question Datum: Mon, 22 Aug 2005 01:26:49 -0500 I have tried for several hours now to get connection pooling for my MySql database to work, but have been unable to do so. I keep getting this error: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.commons.dbcp.BasicDataSourceFactory It's bombing out on this code: Properties p=new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY,org.apache.commons.dbcp.BasicDataSourceFactory); p.put(Context.PROVIDER_URL,jdbc:mysql://localhost:3306); Context initCtx = new InitialContext(p); // here's where it dies You're mixing up some concepts here. Context.INITIAL_CONTEXT_FACTORY is meant to provide the name of a factory producing JNDI contexts, not a factory for producing JDBC DataSources. The same goes for the next line of code. Context.PROVIDER_URL is not used for providing information about a database connection. There is extensive documentation on the tomcat web site regarding JNDI ressource configuration. Have a look at the following URL: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html Can someone please help me, or at least point me in the direction of some documentation that I've missed? I've searched google and every other search engine I can think of. Thanks in advance. Sean Rowe Regards Dirk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org Betreff: Re: jndi question Datum: Mon, 22 Aug 2005 09:24:10 -0500 Thanks for responding Dirk. I've practically memorized the documentation on the link you sent: // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); // Allocate and use a connection from the pool Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); Whenever I try this, here's what I get (which led me to trying it the way I posted): javax.naming.NameNotFoundException: Name java:comp is not bound in this Context No. Did you look at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? I recommend putting the context definition in its own content.xml. On redeploying my application tomcat wouldn't find the driver class anymore. Mind you not the class itself but the definition of what class to load. This problem was solved by putting the context into context.xml. regards Dirk -- GMX DSL = Maximale Leistung zum minimalen Preis! 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
Hi Dirk, Thanks again for responding. I have tried putting this into it's own context file. For my latest attempt, I have created the data source using the admin module, and it rewrote my server.xml file for me, so I'm assuming it's in there correctly. No matter how I do it ( and i really have followed the directions in the link you gave me), I can't seem to get it to work. I must be missing something, but I can't seem to find it. Dirk Weigenand wrote: Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org Betreff: Re: jndi question Datum: Mon, 22 Aug 2005 09:24:10 -0500 Thanks for responding Dirk. I've practically memorized the documentation on the link you sent: // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); // Allocate and use a connection from the pool Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); Whenever I try this, here's what I get (which led me to trying it the way I posted): javax.naming.NameNotFoundException: Name java:comp is not bound in this Context No. Did you look at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? I recommend putting the context definition in its own content.xml. On redeploying my application tomcat wouldn't find the driver class anymore. Mind you not the class itself but the definition of what class to load. This problem was solved by putting the context into context.xml. regards Dirk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jndi question
Dirk, I'm sorry I didn't see the difference on the page you sent me to. However, if there is a way I can do this without having to use jstl, I would really like to know. I was hoping to put the code in a class somewhere that my servlets could use. thanks, sean Dirk Weigenand wrote: Sean, --- Ursprüngliche Nachricht --- Von: Sean Rowe [EMAIL PROTECTED] An: Tomcat Users List tomcat-user@jakarta.apache.org Betreff: Re: jndi question Datum: Mon, 22 Aug 2005 09:24:10 -0500 Thanks for responding Dirk. I've practically memorized the documentation on the link you sent: // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(java:comp/env); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(jdbc/EmployeeDB); // Allocate and use a connection from the pool Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); Whenever I try this, here's what I get (which led me to trying it the way I posted): javax.naming.NameNotFoundException: Name java:comp is not bound in this Context No. Did you look at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? I recommend putting the context definition in its own content.xml. On redeploying my application tomcat wouldn't find the driver class anymore. Mind you not the class itself but the definition of what class to load. This problem was solved by putting the context into context.xml. regards Dirk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JNDI question
Hello I am using Tomcat 5 with JNDI(mysql) Are there ways to get usages info from the POOL Like active connections, max connections (basically the state of the DB Pool) Thanks for any help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI question
Hi, Yes, there are ways. Two general approaches: - Using JMX (not very convenient at the moment, but doable if you're willing to write some code) - By casting the DataSource you get from the JNDI lookup to the implementation type, e.g. org.apache.commons.dbcp.BasicDataSource or whatever, and then calling the specific methods provides by the implementation class. You'll find that DBCP and other connection pooling providers give you all these methods you're asking for. Yoav Shapira Millennium Research Informatics -Original Message- From: Randy Paries [mailto:[EMAIL PROTECTED] Sent: Monday, August 09, 2004 2:37 PM To: 'Tomcat Users List' Subject: JNDI question Hello I am using Tomcat 5 with JNDI(mysql) Are there ways to get usages info from the POOL Like active connections, max connections (basically the state of the DB Pool) Thanks for any help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JNDI Question
Forgive me for being a newbie, but here is a question regarding JNDI. I have my server.xml configured and my web.xml configured for a resource named xyz. xyz is a custom object factory contained within class files (currently under WEB-INF/classes/xyz/). The error I'm getting is this: Caused by: javax.naming.NamingException: Could not create resource factory instance, null at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory. java:99) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301) at org.apache.naming.NamingContext.lookup(NamingContext.java:791) at org.apache.naming.NamingContext.lookup(NamingContext.java:138) at org.apache.naming.NamingContext.lookup(NamingContext.java:779) at org.apache.naming.NamingContext.lookup(NamingContext.java:138) at org.apache.naming.NamingContext.lookup(NamingContext.java:779) at org.apache.naming.NamingContext.lookup(NamingContext.java:151) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136) at javax.naming.InitialContext.lookup(InitialContext.java:347) at search.Search.clinit(Search.java:22) ... 48 more I'm I'm reading this correctly, when the VM is trying to create the object needed for xyz (correct?). My question is do I need to jar up the files for xyz and add them to the common/lib directory? Thanks, Brent Worley ** The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system. Thank You. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI Question
Have a look at http://issues.apache.org/bugzilla/show_bug.cgi?id=29584. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI question
closing a connection that you obtained through a pooled DataSource will merely return it to the pool, and not actually close it. -Original Message- From: Randy [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 3:55 PM To: 'Tomcat Users List' Subject: RE:JNDI question Hello, I have an easy question about using JNDI in tomcat 5 I am using the example @ http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources -howto.html Below is my server.xml entry Here is what I do not quite understand. In this little bit of code do I have to do anything to use the pooling When I do a conn.close, does that actually close the db connection, or does it just release it to the pool Thanks Sorry if this is an obvious question Randy Context initCtx = new InitialContext(); DataSource ds = (DataSource)envCtx.lookup(java:comp/env/jdbc/UnitNet); Connection conn = ds.getConnection(); ... use this connection to access the database ... conn.close(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat/Ant/JNDI question
This works for me ... web.xml : resource-ref 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 res-ref-name jdbc/SessionDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref context.xml : snip Resource name=jdbc/SessionDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/SessionDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameusername/name valuetripleplay/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://vodmgr:3306/tripleplay/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value20/value /parameter parameter namemaxWait/name value5000/value /parameter /ResourceParams /snip Garrett Dangerfield wrote: I tried this and it's not working. It's saying: Name jdbc not found in this context In my web.xml, I put in: env-entry env-entry-namejdbc/DataWarehouse/env-entry-name env-entry-valuejdbc/DataWarehouse/env-entry-value env-entry-typejavax.sql.DataSource/env-entry-type /env-entry In my server.xml, I have: Resource auth=Container name=jdbc/DataWarehouse scope=Shareable type=javax.sql.DataSource/ Am I missing something? Thanks Garrett Dangerfield. Shapira, Yoav wrote: Howdy, - put the equivalent of ResourceEnvRef into the web.xml inside the web app See the env-entry element in the Servlet Specification, v2.3, SRC.13.1. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat/Ant/JNDI question
I tried this and it's not giving me the not found in Context message, but it's now trying to pass me a null connection. I think the problem is that it doesn't know where to get the connection from. With the ResourceLink in the server.xml Context, one specifies the name one wants to use locally as well as the name of the global resource. The resource-ref doesn't allow this. Any further thoughts? Thanks, Garrett Dangerfield. Tim Shaw wrote: This works for me ... web.xml : resource-ref 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 res-ref-name jdbc/SessionDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref context.xml : snip Resource name=jdbc/SessionDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/SessionDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameusername/name valuetripleplay/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://vodmgr:3306/tripleplay/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value20/value /parameter parameter namemaxWait/name value5000/value /parameter /ResourceParams /snip Garrett Dangerfield wrote: I tried this and it's not working. It's saying: Name jdbc not found in this context In my web.xml, I put in: env-entry env-entry-namejdbc/DataWarehouse/env-entry-name env-entry-valuejdbc/DataWarehouse/env-entry-value env-entry-typejavax.sql.DataSource/env-entry-type /env-entry In my server.xml, I have: Resource auth=Container name=jdbc/DataWarehouse scope=Shareable type=javax.sql.DataSource/ Am I missing something? Thanks Garrett Dangerfield. Shapira, Yoav wrote: Howdy, - put the equivalent of ResourceEnvRef into the web.xml inside the web app See the env-entry element in the Servlet Specification, v2.3, SRC.13.1. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat/Ant/JNDI question
The Resource is specified, in the server.xml, with a name. This is the JNDI name and is used to refer to the resource from wherever you like. The setup of the resource is done by the ResourceParams (I hope you didn't copy my example verbatim ;-) The web.xml is just abstracting that reference for a lower-level JNDI call. If you are now getting a null connection, the basic JNDI aspect is (probably) working ... and you just need to figure out the url/DB specific stuff. This could be the Factory (I added that param based on the JNDI/JDBC HOWTO - but it worked fine before, so it might be a default), DB permissions (grabbing a connection can fail in loadsa ways!), or ... If you have coded the JNDI (InitialContext) lookup correctly it will work. BTW I got badly bitten with 4.1.2 (haven't checked since) - every time I redeployed my app it rewrote the server.xml file (removing my Resource definitions). If you're still stuck, some more info is needed - server.xml/web.xml snippets and code where you get the ref and the connection for starters. G'luck tim Garrett Dangerfield wrote: I tried this and it's not giving me the not found in Context message, but it's now trying to pass me a null connection. I think the problem is that it doesn't know where to get the connection from. With the ResourceLink in the server.xml Context, one specifies the name one wants to use locally as well as the name of the global resource. The resource-ref doesn't allow this. Any further thoughts? Thanks, Garrett Dangerfield. Tim Shaw wrote: This works for me ... web.xml : resource-ref 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 res-ref-name jdbc/SessionDB /res-ref-name res-type javax.sql.DataSource /res-type res-auth Container /res-auth /resource-ref context.xml : snip Resource name=jdbc/SessionDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/SessionDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameusername/name valuetripleplay/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://vodmgr:3306/tripleplay/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value20/value /parameter parameter namemaxWait/name value5000/value /parameter /ResourceParams /snip Garrett Dangerfield wrote: I tried this and it's not working. It's saying: Name jdbc not found in this context In my web.xml, I put in: env-entry env-entry-namejdbc/DataWarehouse/env-entry-name env-entry-valuejdbc/DataWarehouse/env-entry-value env-entry-typejavax.sql.DataSource/env-entry-type /env-entry In my server.xml, I have: Resource auth=Container name=jdbc/DataWarehouse scope=Shareable type=javax.sql.DataSource/ Am I missing something? Thanks Garrett Dangerfield. Shapira, Yoav wrote: Howdy, - put the equivalent of ResourceEnvRef into the web.xml inside the web app See the env-entry element in the Servlet Specification, v2.3, SRC.13.1. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat/Ant/JNDI question
I have defined a GlobalNamingResource for a database connection and that works great if I put a ResourceEnvRef in the Context in the server.xml. However, I have a problem. If I deploy my app using ant and it's deply task, it removes the ResourceEnvRef portion of my Context. I see two possible ways to resolve this: - have ant's deploy task inlcue the ResourceEnvRef - put the equivalent of ResourceEnvRef into the web.xml inside the web app Any idea on how to do either/both of these? Thanks, Garrett Dangerfield. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat/Ant/JNDI question
Howdy, - put the equivalent of ResourceEnvRef into the web.xml inside the web app See the env-entry element in the Servlet Specification, v2.3, SRC.13.1. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat/Ant/JNDI question
I tried this and it's not working. It's saying: Name jdbc not found in this context In my web.xml, I put in: env-entry env-entry-namejdbc/DataWarehouse/env-entry-name env-entry-valuejdbc/DataWarehouse/env-entry-value env-entry-typejavax.sql.DataSource/env-entry-type /env-entry In my server.xml, I have: Resource auth=Container name=jdbc/DataWarehouse scope=Shareable type=javax.sql.DataSource/ Am I missing something? Thanks Garrett Dangerfield. Shapira, Yoav wrote: Howdy, - put the equivalent of ResourceEnvRef into the web.xml inside the web app See the env-entry element in the Servlet Specification, v2.3, SRC.13.1. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie mod_webapp/Oracle/jndi question
About the apache to tomcat directly to the httpconnector : use the proxy module in tomcat (see the tomcat_docs on how to do that). As for oracle : cannot help you there.. Mvgr, Martin -Original Message- From: Barry Roberts [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 22:47 To: [EMAIL PROTECTED] Subject: Newbie mod_webapp/Oracle/jndi question I'm new to the jndi part of J2EE and to tomcat. I have my app almost working in tomcat, but it needs to use Oracle. I have a sample servlet that connects to the Oracle database just fine, but only if I connect directly to the tomcat server's http connector. If I hit the servlet (below) throught apache, the DataSource returned is null. But no exception is thrown by javax.naming* calls. I have played endlessly with my server.xml to get the oracle resource, and my latest one is included below. My main question is, how do I configure this to use Oracle using mod_webapp? I would also like to know if it is possible to configure tomcat so that I can use it through apache AND directly through the http connector. Thanks in advance, Barry Roberts !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=8005 shutdown=SHUTDOWN debug=0 !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Tomcat-Standalone !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8180. You can also enable an SSL HTTP/1.1 Connector on port 8543 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 4.0 documentation bundle for more detailed instructions): * Download and install JSSE 1.0.2 or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the enableLookups attribute to false. When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. -- !-- Define a non-SSL1 HTTP/1.1 Connector on port 8180 -- Connector className=org.apache.catalina.connector.http.HttpConnector port=8180 minProcessors=5 maxProcessors=75 enableLookups=false redirectPort=8543 acceptCount=10 debug=0 connectionTimeout=6/ !-- Note : To disable connection timeouts, set connectionTimeout value to -1 -- !-- Define an SSL HTTP/1.1 Connector on port 8543 -- !-- Connector className=org.apache.catalina.connector.http.HttpConnector port=8543 minProcessors=5 maxProcessors=75 enableLookups=false acceptCount=10 debug=0 scheme=https secure=true Factory className=org.apache.catalina.net.SSLServerSocketFactory clientAuth=false protocol=TLS/ /Connector -- !-- Define an AJP 1.3 Connector on port 8109 -- Connector className=org.apache.ajp.tomcat4.Ajp13Connector port=8109 minProcessors=5 maxProcessors=75 acceptCount=10 debug=0/ !-- Define a Proxied HTTP/1.1 Connector on port 8181 -- !-- See proxy documentation for more information about using this. -- !-- Connector className=org.apache.catalina.connector.http.HttpConnector port=8181 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=10 debug=0 connectionTimeout=6 proxyPort=80
RE: Newbie mod_webapp/Oracle/jndi question
proxy module in apache of course ;) -Original Message- From: Martin van den Bemt [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 15:05 To: Tomcat Users List Subject: RE: Newbie mod_webapp/Oracle/jndi question About the apache to tomcat directly to the httpconnector : use the proxy module in tomcat (see the tomcat_docs on how to do that). As for oracle : cannot help you there.. Mvgr, Martin -Original Message- From: Barry Roberts [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 22:47 To: [EMAIL PROTECTED] Subject: Newbie mod_webapp/Oracle/jndi question I'm new to the jndi part of J2EE and to tomcat. I have my app almost working in tomcat, but it needs to use Oracle. I have a sample servlet that connects to the Oracle database just fine, but only if I connect directly to the tomcat server's http connector. If I hit the servlet (below) throught apache, the DataSource returned is null. But no exception is thrown by javax.naming* calls. I have played endlessly with my server.xml to get the oracle resource, and my latest one is included below. My main question is, how do I configure this to use Oracle using mod_webapp? I would also like to know if it is possible to configure tomcat so that I can use it through apache AND directly through the http connector. Thanks in advance, Barry Roberts !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=8005 shutdown=SHUTDOWN debug=0 !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Tomcat-Standalone !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8180. You can also enable an SSL HTTP/1.1 Connector on port 8543 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 4.0 documentation bundle for more detailed instructions): * Download and install JSSE 1.0.2 or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the enableLookups attribute to false. When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. -- !-- Define a non-SSL1 HTTP/1.1 Connector on port 8180 -- Connector className=org.apache.catalina.connector.http.HttpConnector port=8180 minProcessors=5 maxProcessors=75 enableLookups=false redirectPort=8543 acceptCount=10 debug=0 connectionTimeout=6/ !-- Note : To disable connection timeouts, set connectionTimeout value to -1 -- !-- Define an SSL HTTP/1.1 Connector on port 8543 -- !-- Connector className=org.apache.catalina.connector.http.HttpConnector port=8543 minProcessors=5 maxProcessors=75 enableLookups=false acceptCount=10 debug=0 scheme=https secure=true Factory className=org.apache.catalina.net.SSLServerSocketFactory clientAuth=false protocol=TLS/ /Connector -- !-- Define an AJP 1.3 Connector on port 8109 -- Connector className=org.apache.ajp.tomcat4.Ajp13Connector port=8109 minProcessors=5 maxProcessors=75 acceptCount=10 debug=0/ !-- Define a Proxied HTTP/1.1 Connector on port 8181 -- !-- See proxy documentation for more information about using this. -- !-- Connector className
Newbie mod_webapp/Oracle/jndi question
I'm new to the jndi part of J2EE and to tomcat. I have my app almost working in tomcat, but it needs to use Oracle. I have a sample servlet that connects to the Oracle database just fine, but only if I connect directly to the tomcat server's http connector. If I hit the servlet (below) throught apache, the DataSource returned is null. But no exception is thrown by javax.naming* calls. I have played endlessly with my server.xml to get the oracle resource, and my latest one is included below. My main question is, how do I configure this to use Oracle using mod_webapp? I would also like to know if it is possible to configure tomcat so that I can use it through apache AND directly through the http connector. Thanks in advance, Barry Roberts !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=8005 shutdown=SHUTDOWN debug=0 !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Tomcat-Standalone !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8180. You can also enable an SSL HTTP/1.1 Connector on port 8543 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 4.0 documentation bundle for more detailed instructions): * Download and install JSSE 1.0.2 or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the enableLookups attribute to false. When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. -- !-- Define a non-SSL1 HTTP/1.1 Connector on port 8180 -- Connector className=org.apache.catalina.connector.http.HttpConnector port=8180 minProcessors=5 maxProcessors=75 enableLookups=false redirectPort=8543 acceptCount=10 debug=0 connectionTimeout=6/ !-- Note : To disable connection timeouts, set connectionTimeout value to -1 -- !-- Define an SSL HTTP/1.1 Connector on port 8543 -- !-- Connector className=org.apache.catalina.connector.http.HttpConnector port=8543 minProcessors=5 maxProcessors=75 enableLookups=false acceptCount=10 debug=0 scheme=https secure=true Factory className=org.apache.catalina.net.SSLServerSocketFactory clientAuth=false protocol=TLS/ /Connector -- !-- Define an AJP 1.3 Connector on port 8109 -- Connector className=org.apache.ajp.tomcat4.Ajp13Connector port=8109 minProcessors=5 maxProcessors=75 acceptCount=10 debug=0/ !-- Define a Proxied HTTP/1.1 Connector on port 8181 -- !-- See proxy documentation for more information about using this. -- !-- Connector className=org.apache.catalina.connector.http.HttpConnector port=8181 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=10 debug=0 connectionTimeout=6 proxyPort=80/ -- !-- Define a non-SSL HTTP/1.0 Test Connector on port 8182 -- !-- Connector className=org.apache.catalina.connector.http10.HttpConnector port=8182 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=8543 acceptCount=10 debug=0/ -- !-- An Engine represents the entry point (within Catalina) that
Re: Newbie mod_webapp/Oracle/jndi question
Suggestion. Dont use a heavy duty database with a free Web Server. Get Weblogic etc. I hope you arent using tomcat for anything except your desktop. L Marcus - Original Message - From: Barry Roberts [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 4:47 PM Subject: Newbie mod_webapp/Oracle/jndi question I'm new to the jndi part of J2EE and to tomcat. I have my app almost working in tomcat, but it needs to use Oracle. I have a sample servlet that connects to the Oracle database just fine, but only if I connect directly to the tomcat server's http connector. If I hit the servlet (below) throught apache, the DataSource returned is null. But no exception is thrown by javax.naming* calls. I have played endlessly with my server.xml to get the oracle resource, and my latest one is included below. My main question is, how do I configure this to use Oracle using mod_webapp? I would also like to know if it is possible to configure tomcat so that I can use it through apache AND directly through the http connector. Thanks in advance, Barry Roberts !-- Example Server Configuration File -- !-- Note that component elements are nested corresponding to their parent-child relationships with each other -- !-- A Server is a singleton element that represents the entire JVM, which may contain one or more Service instances. The Server listens for a shutdown command on the indicated port. Note: A Server is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- Server port=8005 shutdown=SHUTDOWN debug=0 !-- A Service is a collection of one or more Connectors that share a single Container (and therefore the web applications visible within that Container). Normally, that Container is an Engine, but this is not required. Note: A Service is not itself a Container, so you may not define subcomponents such as Valves or Loggers at this level. -- !-- Define the Tomcat Stand-Alone Service -- Service name=Tomcat-Standalone !-- A Connector represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to the associated Container (normally an Engine) for processing. By default, a non-SSL HTTP/1.1 Connector is established on port 8180. You can also enable an SSL HTTP/1.1 Connector on port 8543 by following the instructions below and uncommenting the second Connector entry. SSL support requires the following steps (see the SSL Config HOWTO in the Tomcat 4.0 documentation bundle for more detailed instructions): * Download and install JSSE 1.0.2 or later, and put the JAR files into $JAVA_HOME/jre/lib/ext. * Execute: %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix) with a password value of changeit for both the certificate and the keystore itself. By default, DNS lookups are enabled when a web application calls request.getRemoteHost(). This can have an adverse impact on performance, so you can disable it by setting the enableLookups attribute to false. When DNS lookups are disabled, request.getRemoteHost() will return the String version of the IP address of the remote client. -- !-- Define a non-SSL1 HTTP/1.1 Connector on port 8180 -- Connector className=org.apache.catalina.connector.http.HttpConnector port=8180 minProcessors=5 maxProcessors=75 enableLookups=false redirectPort=8543 acceptCount=10 debug=0 connectionTimeout=6/ !-- Note : To disable connection timeouts, set connectionTimeout value to -1 -- !-- Define an SSL HTTP/1.1 Connector on port 8543 -- !-- Connector className=org.apache.catalina.connector.http.HttpConnector port=8543 minProcessors=5 maxProcessors=75 enableLookups=false acceptCount=10 debug=0 scheme=https secure=true Factory className=org.apache.catalina.net.SSLServerSocketFactory clientAuth=false protocol=TLS/ /Connector -- !-- Define an AJP 1.3 Connector on port 8109 -- Connector className=org.apache.ajp.tomcat4.Ajp13Connector port=8109 minProcessors=5 maxProcessors=75 acceptCount=10 debug=0/ !-- Define a Proxied HTTP/1.1 Connector on port 8181 -- !-- See proxy documentation for more information about using this. -- !-- Connector className=org.apache.catalina.connector.http.HttpConnector port=8181 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=10 debug=0 connectionTimeout
New Bie JNDI question
Hi, I am using Tomcat 4.0.1 on W2K and trying to use JNDI datasource. I have configured datasource as described in the JNDI Resources, yet cannot seem to get my JDBC connection going. I keep getting a null connection. I looked through the lists, but could not get a proper solution. Can someone who has solved the problem please help me. Thankyou, Krishna. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
AW: JNDI question
Hallo, I have the same problem with a MySQL Database, configured everything like you and also get null after the lookup. I posted this twice on this list and saw other postings with this problem, but nobody got an answer. If you find a solution please post it here. Guido -Ursprungliche Nachricht- Von: Jaime Garcia Bonis [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 25. Oktober 2001 11:46 An: [EMAIL PROTECTED] Betreff: JNDI question Hi evryone I have a question about how JNDI works in Tomcat 4.0.1 How can i set up a JNDI naming repository in order to create a datasource??? In the server.xml i have this: Resource name=jdbc/FtcAppDb auth=CONTAINER type=javax.sql.DataSource/ ResourceParams name=jdbc/FtcAppDb parameternameuser/namevaluescott/value/parameter parameternamepassword/namevaluetiger/value/parameter parameternamedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value/parameter parameternamedriverName/name valuejdbc:oracle:thin:@zagarron:1521:orcl/value/parameter /ResourceParams Inside de Context tag of my application. In the web.xml i have this: resource-ref res-ref-namejdbc/FtcAppDb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref i get the datasource object doing this :DataSource ds = (DataSource)ctx.lookup(jdbc/FtcAppDb); but when i try to create the connection object i get a Null Pointer exception error Could anyone help me i don't have a clue about what happen. Thanks for the time
Re: AW: JNDI question
Hello, try it with the IP-Adress instead of @zarragon put @195... in your driver. perhaps this solves your problem. Hth Peter Nottebrok, Guido wrote: Hallo, I have the same problem with a MySQL Database, configured everything like you and also get null after the lookup. I posted this twice on this list and saw other postings with this problem, but nobody got an answer. If you find a solution please post it here. Guido -Ursprungliche Nachricht- Von: Jaime Garcia Bonis [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 25. Oktober 2001 11:46 An: [EMAIL PROTECTED] Betreff: JNDI question Hi evryone I have a question about how JNDI works in Tomcat 4.0.1 How can i set up a JNDI naming repository in order to create a datasource??? In the server.xml i have this: Resource name=jdbc/FtcAppDb auth=CONTAINER type=javax.sql.DataSource/ ResourceParams name=jdbc/FtcAppDb parameternameuser/namevaluescott/value/parameter parameternamepassword/namevaluetiger/value/parameter parameternamedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value/parameter parameternamedriverName/name valuejdbc:oracle:thin:@zagarron:1521:orcl/value/parameter /ResourceParams Inside de Context tag of my application. In the web.xml i have this: resource-ref res-ref-namejdbc/FtcAppDb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref i get the datasource object doing this :DataSource ds = (DataSource)ctx.lookup(jdbc/FtcAppDb); but when i try to create the connection object i get a Null Pointer exception error Could anyone help me i don't have a clue about what happen. Thanks for the time
Re: AW: JNDI question
I was having the same problem, but finally figured it out. I'm using Tomcat 4.0.1 and accessing my jsp pages through Apache using the Warp connector. I found it important to put the JNDI DataSource definition under the correct connector in the server.xml configuration file. So, to access the DataSource from a jsp accessed through the Warp connector by Apache, put the resource-ref in a context under the Connector className=org.apache.catalina.connector.warp.WarpConnector connector definition of the server.xml config file. I have a question about how JNDI works in Tomcat 4.0.1 How can i set up a JNDI naming repository in order to create a datasource??? In the server.xml i have this: Resource name=jdbc/FtcAppDb auth=CONTAINER type=javax.sql.DataSource/ ResourceParams name=jdbc/FtcAppDb parameternameuser/namevaluescott/value/parameter parameternamepassword/namevaluetiger/value/parameter parameternamedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value/parameter parameternamedriverName/name valuejdbc:oracle:thin:@zagarron:1521:orcl/value/parameter /ResourceParams Inside de Context tag of my application. In the web.xml i have this: resource-ref res-ref-namejdbc/FtcAppDb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref i get the datasource object doing this :DataSource ds = (DataSource)ctx.lookup(jdbc/FtcAppDb); but when i try to create the connection object i get a Null Pointer exception error
JNDI question
Hi evryone I have a question about how JNDI works in Tomcat 4.0.1 How can i set up a JNDI naming repository in order to create a datasource??? In the server.xml i have this: Resource name=jdbc/FtcAppDb auth=CONTAINER type=javax.sql.DataSource/ ResourceParams name=jdbc/FtcAppDb parameternameuser/namevaluescott/value/parameter parameternamepassword/namevaluetiger/value/parameter parameternamedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value/parameter parameternamedriverName/name valuejdbc:oracle:thin:@zagarron:1521:orcl/value/parameter /ResourceParams Inside de Context tag of my application. In the web.xml i have this: resource-ref res-ref-namejdbc/FtcAppDb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref i get the datasource object doing this :DataSource ds = (DataSource)ctx.lookup(jdbc/FtcAppDb); but when i try to create the connection object i get a Null Pointer exception error Could anyone help me i don't have a clue about what happen. Thanks for the time
Re: Tomcat 4 and JNDI Question
I have the same problem: how I can configure JNDI? - Original Message - From: G.C. Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, September 02, 2001 8:20 AM Subject: Tomcat 4 and JNDI Question How can I set java.naming.factory.initial java.naming.provider.url java.naming.factory.url.pkgs I have tried putting a jndi.properties file in common/classes, common/lib, WEB-INF/classes, and WEB-INF/lib - didn't work. I have also tried modifing catalina.sh as below else $JAVA_HOME/bin/java $CATALINA_OPTS -classpath $CP \ -Dcatalina.home=$CATALINA_HOME \ -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory \ -Djava.naming.provider.url=jnp://localhost:1099 \ -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ org.apache.catalina.startup.Bootstrap $@ start \ $CATALINA_HOME/logs/catalina.out 21 fi Still didn't work. Any Ideas? THanks, G.C. Miller
Tomcat 4 and JNDI Question
How can I set java.naming.factory.initial java.naming.provider.url java.naming.factory.url.pkgs I have tried putting a jndi.properties file in common/classes, common/lib, WEB-INF/classes, and WEB-INF/lib - didn't work. I have also tried modifing catalina.sh as below else $JAVA_HOME/bin/java $CATALINA_OPTS -classpath $CP \ -Dcatalina.home=$CATALINA_HOME \ -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory \ -Djava.naming.provider.url=jnp://localhost:1099 \ -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ org.apache.catalina.startup.Bootstrap $@ start \ $CATALINA_HOME/logs/catalina.out 21 fi Still didn't work. Any Ideas? THanks, G.C. Miller