Re: Issue with EL disabled
Hi, Make sure that your web.xml is according to the Servlet 2.4 Specification. Tomcat disables EL evaluation for old apps. Regards, Manolo Ramirez T. Olivier Moratin wrote: Hello, I am getting crazy on what could be a simple thing. While the Tomcat webapp examples (accessible from the manager) run EL (${variable}) properly, my own app doesn't. I just installed Tomcat and stuff and thought it was enabled by default. Tomcat 5 on Windows with latest version of J2EE/J2SE. Please help. I am getting irritated :)) Thanks a lot - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mod_jk 1.2 binary for Linux?
Hi, I sugest that you compile the src, it's not to dificult if you now the steps, download it from here: http://apache.towardex.com/jakarta/tomcat-connectors/jk/jakarta-tomcat-connectors-jk-1.2-src-current.tar.gz to compile (in Redhat 9): $ tar xzf XXX $ cd XXX/jk/native/ $ sh buildconf.sh $ ./configure --with-apxs=/usr/sbin/apxs $ make The binary file will be in XXX/jk/native/apache-2.0/mod_jk.so I hope this helps. Regards, _ Manolo Ramirez T. Stu Statman wrote: I am unsure if I'm asking this question in the right forum, and while I did a quick look through the archives, I may be repeating a question that someone else has asked and has had answered. If so, I apologize. Someone in my org is trying to put together a development server image (Linux, Apache, Tomcat, JVM, etc.), and needs a clean binary of mod_jk. I pointed him at http://apache.towardex.com/jakarta/tomcat-connectors/jk/binaries/linux/, but it turns out that there's no binary there. It's an empty directory. He and I both did some surfing around, and can't seem to spot a binary anywhere else. Do need to compile our own version of the binary? Is there someplace else I should be looking? Thanks for the help, apologies for what's probably a noob question ... Stu Statman - 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: ResulSet Question
Hi, I think that rsSN is associated with statement, so we you do 'statement.executeQuery()' that invalidates the current ResultSet. Try using other statement object for the internal querys. Regards, ___ Manolo. [EMAIL PROTECTED] wrote: All, I have the following code rsSN = statement.executeQuery(Query); while (rsSN.next()){ if (Frame.equals("E")){ rsFrame = statement.executeQuery(QueryFrameE); if (rsFrame.next()){ js.append(""+ rsFrame.getString("ATTRIBUTE_VALUE") +""); } } else{ rsFrame = statement.executeQuery(QueryFrameF); if (rsFrame.next()){ js.append(""+ rsFrame.getString("ATTRIBUTE_VALUE") +""); } } } Why it only do it once, if the ResulSet rsSN have 100 records Thanks in advance Salvador - 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: URGENT!!! Tomcat 4 download
Try this: http://www.jpackage.org [EMAIL PROTECTED] wrote: Hi All I am trying to download tomcat 4.1.24 rpm thro apt-get. I am using "apt-get install tomcat4" command. It gives me a bunch of dependecies which it needs to install tomcat4. But if i download a tar ball everything does just fine. I tried to get rpm from jakarta site but i had no luck finding the rpms on there. Please help me solve this issue.I think rpms is the best way to go but i'm just not able to get it to work thanks in advance --mohan - 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: Cannot load JDBC driver class 'null' - Tomcat standalone 4.1. 27 w hen trying instantiate datasource object.
Yep, that's what I'm talking about, check the archives, some people had problems with ResourceLink's and DefaultContext. Defining your context in a myApp.xml is the best option to avoid it, you must to follow Phillip Qin advise. Happy Coding! Regards, ______ Manolo Ramirez T. Wynkoop, Robert M wrote: I don't know how to answer other than I have it in: When you say normal context, what are we talking about? :) Are talking about something like: usersa password driverClassName org.hsql.jdbcDriver driverName jdbc:HypersonicSQL:database Thanks, Robert Wynkoop -Original Message- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Thursday, September 11, 2003 9:27 AM To: Tomcat Users List Subject: Re: Cannot load JDBC driver class 'null' - Tomcat standalone 4.1. 27 w hen trying instantiate datasource object. Are you declaring the JNDI resource in DefaultContext or with ResourceLink? if yes, try with a normal Context and Resource. Regards, _____ Manolo Ramirez T. Wynkoop, Robert M wrote: Yeah I had already tried that. When It was not there I got this message on Tomcat startup - java.lang.reflect.InvocationTargetException: java.lang.NoClassDefFoundError: javax/sql/DataSource I'm kind of stumped on this. Any other ideas? Later, Robert Wynkoop -Original Message- From: Phillip Qin [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 5:11 PM To: 'Tomcat Users List' Subject: RE: Cannot load JDBC driver class 'null' - Tomcat standalone 4.1. 27 w hen trying instantiate datasource object. If you use oracle jdbc driver, put classes12.jar in common/lib -Original Message- From: Wynkoop, Robert M [mailto:[EMAIL PROTECTED] Sent: September 10, 2003 6:06 PM To: Tomcat Mailing List (E-mail) Subject: Cannot load JDBC driver class 'null' - Tomcat standalone 4.1.27 w hen trying instantiate datasource object. The error(Wen I try to use a JNDI resource in my webapp.): C:\jdk1.3.1_08\jre\bin\java -classpath "C:\web\Tomcat4.1\bin\bootstrap.jar";"C:\jdk1.3.1_08\lib\tools.jar" -Dcatalina.home="C:\web\Tomcat4.1" -Dcatalina.base="C:\web\Tomcat4.1" org.apache.catalina.startup.Bootstrap "start" [INFO] Registry - -Loading registry information [INFO] Registry - -Creating new Registry instance [INFO] Registry - -Creating MBeanServer [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1.18-LE-jdk14 [INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true [INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.action.ActionResources', returnNull=true [INFO] PropertyMessageResources - -Initializing, config='remic_msgcat', returnNull=true [INFO] Http11Protocol - -Starting Coyote HTTP/1.1 on port 8080 [INFO] ChannelSocket - -JK2: ajp13 listening on 0.0.0.0/0.0.0.0:8009 [INFO] JkMain - -Jk running ID=0 time=0/200 config=C:\web\Tomcat4.1\conf\jk2.properties Cannot load JDBC driver class 'null' java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:115) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav a:523) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3 29) at com.citimortgage.common.datasource.DataSourceManager.getConnection(DataSourc eManager.java:80) I know I have the Oracle jar in the right place because I get this msg when if I don't have it in /common/lib. C:\jdk1.3.1_08\jre\bin\java -classpath "C:\web\Tomcat4.1\bin\bootstrap.jar";"C:\jdk1.3.1_08\lib\tools.jar" -Dcatalina.home="C:\web\Tomcat4.1" -Dcatalina.base="C:\web\Tomcat4.1" org.apache.catalina.startup.Bootstrap "start" [INFO] Registry - -Loading registry information [INFO] Registry - -Creating new Registry instance [INFO] Registry - -Creating MBeanServer [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080 Exception during startup processing java.lang.reflect.InvocationTargetException: java.lang.NoClassDefFoundError: javax/sql/DataSource at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:488) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106) I googled for this answer. The most common problem is not finding the database driver in /common/lib. Later, Robert Wynkoop - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot load JDBC driver class 'null' - Tomcat standalone 4.1. 27 w hen trying instantiate datasource object.
Are you declaring the JNDI resource in DefaultContext or with ResourceLink? if yes, try with a normal Context and Resource. Regards, _ Manolo Ramirez T. Wynkoop, Robert M wrote: Yeah I had already tried that. When It was not there I got this message on Tomcat startup - java.lang.reflect.InvocationTargetException: java.lang.NoClassDefFoundError: javax/sql/DataSource I'm kind of stumped on this. Any other ideas? Later, Robert Wynkoop -Original Message- From: Phillip Qin [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 5:11 PM To: 'Tomcat Users List' Subject: RE: Cannot load JDBC driver class 'null' - Tomcat standalone 4.1. 27 w hen trying instantiate datasource object. If you use oracle jdbc driver, put classes12.jar in common/lib -Original Message- From: Wynkoop, Robert M [mailto:[EMAIL PROTECTED] Sent: September 10, 2003 6:06 PM To: Tomcat Mailing List (E-mail) Subject: Cannot load JDBC driver class 'null' - Tomcat standalone 4.1.27 w hen trying instantiate datasource object. The error(Wen I try to use a JNDI resource in my webapp.): C:\jdk1.3.1_08\jre\bin\java -classpath "C:\web\Tomcat4.1\bin\bootstrap.jar";"C:\jdk1.3.1_08\lib\tools.jar" -Dcatalina.home="C:\web\Tomcat4.1" -Dcatalina.base="C:\web\Tomcat4.1" org.apache.catalina.startup.Bootstrap "start" [INFO] Registry - -Loading registry information [INFO] Registry - -Creating new Registry instance [INFO] Registry - -Creating MBeanServer [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1.18-LE-jdk14 [INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true [INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.action.ActionResources', returnNull=true [INFO] PropertyMessageResources - -Initializing, config='remic_msgcat', returnNull=true [INFO] Http11Protocol - -Starting Coyote HTTP/1.1 on port 8080 [INFO] ChannelSocket - -JK2: ajp13 listening on 0.0.0.0/0.0.0.0:8009 [INFO] JkMain - -Jk running ID=0 time=0/200 config=C:\web\Tomcat4.1\conf\jk2.properties Cannot load JDBC driver class 'null' java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:115) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav a:523) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3 29) at com.citimortgage.common.datasource.DataSourceManager.getConnection(DataSourc eManager.java:80) I know I have the Oracle jar in the right place because I get this msg when if I don't have it in /common/lib. C:\jdk1.3.1_08\jre\bin\java -classpath "C:\web\Tomcat4.1\bin\bootstrap.jar";"C:\jdk1.3.1_08\lib\tools.jar" -Dcatalina.home="C:\web\Tomcat4.1" -Dcatalina.base="C:\web\Tomcat4.1" org.apache.catalina.startup.Bootstrap "start" [INFO] Registry - -Loading registry information [INFO] Registry - -Creating new Registry instance [INFO] Registry - -Creating MBeanServer [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080 Exception during startup processing java.lang.reflect.InvocationTargetException: java.lang.NoClassDefFoundError: javax/sql/DataSource at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:488) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106) I googled for this answer. The most common problem is not finding the database driver in /common/lib. Later, Robert Wynkoop - 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: problems with the starting of rpm version of tomcat4-4.1.24-full.2jpp.noarch.rpmon Red Hat Advanced Server 2.1
Hi, You must to install tomcat4-webapps-4.1.24-full.2jpp or configure the ROOT context by yourself. Regards, _ Manolo Ramirez T. 虎 王 wrote: > Hi, > I want to run Tomcat4 on my newly installed redhat > Advanced Server2.1. > The jakartar-tomcat4.1.24.tar version do work when I > visit http://localhost:8080/. > But the rpm version don't work.When I visit > http://localhost:8080/,the response is: > HTTP Status 500 - No Context configured to process > this request > > type Status report > > message No Context configured to process this > request > > description The server encountered an internal > error (No Context configured to process this request) > that prevented it from fulfilling this request. > > Can you help me out? > Thank you! > > > > > _ > Do You Yahoo!? > ?[???]?+?? > http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.messenger.yahoo.com > > - > 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: Can not load JNDI DataSource in Servlet.init()
I try it and doGet() stop working too, the error was: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context Anyway, I found how to configure the application context with ant (I think that it was not posible), so I can live without DefaultContext. Thanks for the help. Regards, _ Manolo Ramirez T. Madere, Colin wrote: Ok, you are using a resource-ref. But I'm not sure why since you have the resource defined in the DefaultContext. Try removing the resource-ref from your web.xml and see if you get a different error. (BTW: Better not to use attachments since this list is archived and not all attachments work for all mail readers, etc). -Original Message- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 7:01 PM To: Tomcat Users List Subject: Re: Can not load JNDI DataSource in Servlet.init() I was making more test with this, I find that if I define the resource in a normal context it works, but I want to use defaultcontext to work with ant InstallTask, or is there another way to do this? I attached my web.xml, this is the relevant entry in server.xml: factory org.apache.commons.dbcp.BasicDataSourceFactory maxActive 100 maxIdle 30 maxWait 1 username *** password *** driverClassName org.gjt.mm.mysql.Driver url jdbc:mysql://localhost:3306/comercial?autoReconnect=true Thanks for the help Colin. _ Manolo Ramirez T. Madere, Colin wrote: Well then it may be something else. I'm essentially doing what you are with a JNDI datasource defined in the DefaultContext with nothing in the web.xml (except to pass along the JNDI name so it's not hard-coded). It breaks for me (and a bunch of other people posting recently using 4.1.x) when I try to move that to GlobalNamingResources and use a ResourceLink. Post your server.xml and web.xml (or just relevant parts), maybe it's something else. -Original Message- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 3:50 PM To: Tomcat Users List Subject: Re: Can not load JNDI DataSource in Servlet.init() No, I'm not using a ResourceLink. _____ Manolo Ramirez T. Madere, Colin wrote: So you are using a resource link in the DefaultContext either in server.xml or your web.xml? -Original Message----- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 1:27 PM To: Tomcat Users List Subject: Re: Can not load JNDI DataSource in Servlet.init() It's in DefaultContext, I checked the related messages, it seems like the same problem. Thanks for the answer. _____ Manolo Ramirez T. Madere, Colin wrote: How is your JNDI resource configured? In an explicitly defined Context or in the DefaultContext? ResourceLinked? I ask because there are a number of folks with similar problems that look to be something missing in how JNDI datasources are handled internally when using DefaultContext. See other topics: * ResourceLink and DefaultContext * Tomcat 4.1 DefaultContext Bug? * Question about Tomcat Documentation * Globally defined JNDI DataSource -----Original Message- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:55 PM To: Tomcat Users List Subject: Can not load JNDI DataSource in Servlet.init() Hi all, Why I can't load a JNDI resource on the init method of my servlet? there is no problem doing that in doGet() but on init() it doesn't work. the logs entry is: java.sql.SQLException: Cannot load JDBC driver class 'null' It's the same code! What I'm missing? this is my servlet code: package libreria; import java.io.PrintWriter; import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import javax.naming.*; public class MyServlet extends HttpServlet { public void init (ServletConfig config) throws ServletException{ super.init(config); try { Context ctx = new InitialContext(); if(ctx==null) { System.out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { System.out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { System.out.println(rs.getInt("id")+"::"+rs.getString("nombre")+"::"+r s .getSt ring("a
Re: Can not load JNDI DataSource in Servlet.init()
I was making more test with this, I find that if I define the resource in a normal context it works, but I want to use defaultcontext to work with ant InstallTask, or is there another way to do this? I attached my web.xml, this is the relevant entry in server.xml: factory org.apache.commons.dbcp.BasicDataSourceFactory maxActive 100 maxIdle 30 maxWait 1 username *** password *** driverClassName org.gjt.mm.mysql.Driver url jdbc:mysql://localhost:3306/comercial?autoReconnect=true Thanks for the help Colin. _ Manolo Ramirez T. Madere, Colin wrote: Well then it may be something else. I'm essentially doing what you are with a JNDI datasource defined in the DefaultContext with nothing in the web.xml (except to pass along the JNDI name so it's not hard-coded). It breaks for me (and a bunch of other people posting recently using 4.1.x) when I try to move that to GlobalNamingResources and use a ResourceLink. Post your server.xml and web.xml (or just relevant parts), maybe it's something else. -Original Message----- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 3:50 PM To: Tomcat Users List Subject: Re: Can not load JNDI DataSource in Servlet.init() No, I'm not using a ResourceLink. _________ Manolo Ramirez T. Madere, Colin wrote: So you are using a resource link in the DefaultContext either in server.xml or your web.xml? -Original Message- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 1:27 PM To: Tomcat Users List Subject: Re: Can not load JNDI DataSource in Servlet.init() It's in DefaultContext, I checked the related messages, it seems like the same problem. Thanks for the answer. _____ Manolo Ramirez T. Madere, Colin wrote: How is your JNDI resource configured? In an explicitly defined Context or in the DefaultContext? ResourceLinked? I ask because there are a number of folks with similar problems that look to be something missing in how JNDI datasources are handled internally when using DefaultContext. See other topics: * ResourceLink and DefaultContext * Tomcat 4.1 DefaultContext Bug? * Question about Tomcat Documentation * Globally defined JNDI DataSource -Original Message----- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:55 PM To: Tomcat Users List Subject: Can not load JNDI DataSource in Servlet.init() Hi all, Why I can't load a JNDI resource on the init method of my servlet? there is no problem doing that in doGet() but on init() it doesn't work. the logs entry is: java.sql.SQLException: Cannot load JDBC driver class 'null' It's the same code! What I'm missing? this is my servlet code: package libreria; import java.io.PrintWriter; import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import javax.naming.*; public class MyServlet extends HttpServlet { public void init (ServletConfig config) throws ServletException{ super.init(config); try { Context ctx = new InitialContext(); if(ctx==null) { System.out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { System.out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { System.out.println(rs.getInt("id")+"::"+rs.getString("nombre")+"::"+rs .getSt ring("apellido")); } } catch(Exception e) { e.printStackTrace(); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { response.setContentType("text/plain"); PrintWriter out= response.getWriter(); out.println("holas muchas"); try { Context ctx = new InitialContext(); if(ctx==null) { out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) {
Re: Can not load JNDI DataSource in Servlet.init()
No, I'm not using a ResourceLink. _ Manolo Ramirez T. Madere, Colin wrote: So you are using a resource link in the DefaultContext either in server.xml or your web.xml? -Original Message- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 1:27 PM To: Tomcat Users List Subject: Re: Can not load JNDI DataSource in Servlet.init() It's in DefaultContext, I checked the related messages, it seems like the same problem. Thanks for the answer. _____ Manolo Ramirez T. Madere, Colin wrote: How is your JNDI resource configured? In an explicitly defined Context or in the DefaultContext? ResourceLinked? I ask because there are a number of folks with similar problems that look to be something missing in how JNDI datasources are handled internally when using DefaultContext. See other topics: * ResourceLink and DefaultContext * Tomcat 4.1 DefaultContext Bug? * Question about Tomcat Documentation * Globally defined JNDI DataSource -Original Message----- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:55 PM To: Tomcat Users List Subject: Can not load JNDI DataSource in Servlet.init() Hi all, Why I can't load a JNDI resource on the init method of my servlet? there is no problem doing that in doGet() but on init() it doesn't work. the logs entry is: java.sql.SQLException: Cannot load JDBC driver class 'null' It's the same code! What I'm missing? this is my servlet code: package libreria; import java.io.PrintWriter; import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import javax.naming.*; public class MyServlet extends HttpServlet { public void init (ServletConfig config) throws ServletException{ super.init(config); try { Context ctx = new InitialContext(); if(ctx==null) { System.out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { System.out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { System.out.println(rs.getInt("id")+"::"+rs.getString("nombre")+"::"+rs .getSt ring("apellido")); } } catch(Exception e) { e.printStackTrace(); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { response.setContentType("text/plain"); PrintWriter out= response.getWriter(); out.println("holas muchas"); try { Context ctx = new InitialContext(); if(ctx==null) { out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { out.println(rs.getInt("id")+"::"+rs.getString("nombre")+rs.getString(" apelli do")); } } catch(Exception e) { e.printStackTrace(out); } } } Regards. _ Manolo Ramirez T. - 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] - 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: Can not load JNDI DataSource in Servlet.init()
It's in DefaultContext, I checked the related messages, it seems like the same problem. Thanks for the answer. _ Manolo Ramirez T. Madere, Colin wrote: How is your JNDI resource configured? In an explicitly defined Context or in the DefaultContext? ResourceLinked? I ask because there are a number of folks with similar problems that look to be something missing in how JNDI datasources are handled internally when using DefaultContext. See other topics: * ResourceLink and DefaultContext * Tomcat 4.1 DefaultContext Bug? * Question about Tomcat Documentation * Globally defined JNDI DataSource -Original Message- From: Manolo Ramirez T. [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:55 PM To: Tomcat Users List Subject: Can not load JNDI DataSource in Servlet.init() Hi all, Why I can't load a JNDI resource on the init method of my servlet? there is no problem doing that in doGet() but on init() it doesn't work. the logs entry is: java.sql.SQLException: Cannot load JDBC driver class 'null' It's the same code! What I'm missing? this is my servlet code: package libreria; import java.io.PrintWriter; import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import javax.naming.*; public class MyServlet extends HttpServlet { public void init (ServletConfig config) throws ServletException{ super.init(config); try { Context ctx = new InitialContext(); if(ctx==null) { System.out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { System.out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { System.out.println(rs.getInt("id")+"::"+rs.getString("nombre")+"::"+rs.getSt ring("apellido")); } } catch(Exception e) { e.printStackTrace(); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { response.setContentType("text/plain"); PrintWriter out= response.getWriter(); out.println("holas muchas"); try { Context ctx = new InitialContext(); if(ctx==null) { out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { out.println(rs.getInt("id")+"::"+rs.getString("nombre")+rs.getString("apelli do")); } } catch(Exception e) { e.printStackTrace(out); } } } Regards. _ Manolo Ramirez T. - 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]
Can not load JNDI DataSource in Servlet.init()
Hi all, Why I can't load a JNDI resource on the init method of my servlet? there is no problem doing that in doGet() but on init() it doesn't work. the logs entry is: java.sql.SQLException: Cannot load JDBC driver class 'null' It's the same code! What I'm missing? this is my servlet code: package libreria; import java.io.PrintWriter; import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import javax.naming.*; public class MyServlet extends HttpServlet { public void init (ServletConfig config) throws ServletException{ super.init(config); try { Context ctx = new InitialContext(); if(ctx==null) { System.out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { System.out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { System.out.println(rs.getInt("id")+"::"+rs.getString("nombre")+"::"+rs.getString("apellido")); } } catch(Exception e) { e.printStackTrace(); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { response.setContentType("text/plain"); PrintWriter out= response.getWriter(); out.println("holas muchas"); try { Context ctx = new InitialContext(); if(ctx==null) { out.println("fallo InitialContext"); return; } DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ComercialDB"); if(ds==null) { out.println("fallo lookup"); return; } Connection conn = ds.getConnection(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select * from pruebas"); while(rs.next()) { out.println(rs.getInt("id")+"::"+rs.getString("nombre")+rs.getString("apellido")); } } catch(Exception e) { e.printStackTrace(out); } } } Regards. _ Manolo Ramirez T. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing Tomcat as a Service
Hi, Check this: http://www.jpackage.org They have the rpm version of tomcat, that will make all the hard work for you. Regards. Manolo Ramirez T. Stuart Stephen wrote: Hi all, How might I go about installing Tomcat as a service in RedHat 9.0. I've never installed a service under linux manually before and I'm not sure what to do. I can't find the appropriate documentation in the manuals for either Tomcat or RedHat. I must be looking in the wrong places :O( UNRELATED: Also, If I wanted to install a java program as a service, how might I do this? Is this a similar process? Regards, Stuart - 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]