Re: Hiding port number when using mod_jk
Anto Paul wrote: If you mean that Tomcat is still listening on port 8080, you must comment the connector element in server.xml which tells Tomcat to listen on port 8080. You should check your application source to see that no port no is hard coded in it. Thanks Anto & Lutz, the problem was at two places: I didn't configure mod_jk.conf properly and the application I deployed had some bad deployment descriptors. I removed that application, uncommented the connector and everything works correctly now. Regards, Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hiding port number when using mod_jk
Hi List, I have setup the mod_jk on Apache2 and it is forwarding the requests to tomcat 5.5.9 correctly. However, if I click any of the links in my tomcat webapp, the port 8080 is showing up. Is there any way I can avoid this? TIA, Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: launching Tomcat 5.0.3 from Eclipse 3.0.1
hicham wrote: now I need to start tomcat from eclipse ( logged as a user ) http://www.sysdeo.com/eclipse/tomcatPlugin.html Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.6 / Eclipse / no startup.bat
Geoff Wiggs wrote: Trying to integrate Tomcat 5.6 and Eclipse. Without the startup.bat and [...] Anyone have any ideas? Have you tried Sysdeo Tomcat Plugin for Eclipse? Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Inside eclipse...
Vamsee Kanakala wrote: Hi all, I have a problem when I start tomcat from inside eclipse I found out the problem. It's not about the plugin per se, it must be the fact that eclipse starts tomcat or something... Anyways, I googled for similar error messages, turns out that security.policy in JAVA_HOME/jre/lib/security/security.policy has to be changed so (5432 is postgres' port): grant { permission java.security.AllPermission; permission java.net.SocketPermission "127.0.0.1:1024-", "listen"; permission java.net.SocketPermission "127.0.0.1:5432", "accept, connect, listen, resolve"; }; Now tomcat works happily with postgres. Thanks, Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Inside eclipse...
Hi all, I have a problem when I start tomcat from inside eclipse with Sysdeo Tomcat plugin. When I start tomcat from terminal (I'm on linux), it is able to connect to postgres. If I start tomcat from eclipse using the plugin, postgres jdbc driver is throwing access denied. It tells me that tomcat is being started as a different user than allowed by postgres, I just don't know how to set this properly. Please help. TIA, Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mysterious null pointer exception
Thanks Jon, that worked :) Now, please excuse me while I punch myself for making that dumb mistake! -Vamsee. Because joy is one's fuel - Ayn Rand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mysterious null pointer exception
Hi Adam, Yes, I did write the Servlet by hand :) Actually, it's an example from the book Web Development with JavaServer Pages, 2nd. ed (Manning). That example is for explaining Servlet-centric design. I forgot to mention what I mean by 'accessing a function', where the code calls a function, say this.fetchAll() or this.fetchEmployee(), then this nullPointerException happens. It's happening for both the functions. And, I don't see the reason why, the control doesn't even go in to the functions. As soon as the function is called, it's giving this exception. I guess Frans Flippo is right. I'll check it out with jpda. TIA, Vamsee. Because joy is one's fuel - Ayn Rand Adam Buglass wrote: Hmmm, I'm not so good at picking things out of the servlet! Have you got the original code (ie. JSP)? I'm assuming you didn't write the servlet by hand! Thanks! Adam. On Thu, 2004-07-29 at 06:32, Vamsee Kanakala wrote: Hello list users, Maybe this is not the best place to ask a general servlet doubt, but I'm hoping someone can point out the mistake I'm making. I'm attaching a servlet file (FetchEmployeeServlet.java), which for some strange reason, gives a Null-Pointer Exception when accessing a function. This tells me that the class is not instantiated or something, but I'm new to servlets, so I can't figure out why. TIA, Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mysterious null pointer exception
Hello list users, Maybe this is not the best place to ask a general servlet doubt, but I'm hoping someone can point out the mistake I'm making. I'm attaching a servlet file (FetchEmployeeServlet.java), which for some strange reason, gives a Null-Pointer Exception when accessing a function. This tells me that the class is not instantiated or something, but I'm new to servlets, so I can't figure out why. TIA, Vamsee. -- Because joy is one's fuel - Ayn Rand package com.vamsee.empdb; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import javax.sql.*; import java.util.*; import javax.naming.*; public class FetchEmployeeServlet extends HttpServlet { private Connection conn = null; private ServletContext context; private PreparedStatement pstmt = null; public void init(ServletConfig config) throws ServletException { super.init(config); context = config.getServletContext(); try { Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:comp/env"); if (envContext == null) throw new Exception("Panic: No Context!"); DataSource ds = (DataSource)envContext.lookup("jdbc/empdb"); if (ds != null) { Connection conn = ds.getConnection(); } } catch (Exception e) { e.printStackTrace(); } } public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String jsp; String cmd = req.getParameter("cmd"); String idString = req.getParameter("id"); int id; try { id = Integer.parseInt(idString); } catch (NumberFormatException e) { id = 0; } if ("get".equals(cmd)) { EmployeeBean bean = this.fetchEmployee(id); req.setAttribute("employee", bean); jsp = "/employee.jsp"; } else { List list = this.fetchAll(); req.setAttribute("list", list); jsp = "/list.jsp"; } RequestDispatcher dispatcher; dispatcher = context.getRequestDispatcher(jsp); dispatcher.forward(req, res); } public EmployeeBean makeBean(ResultSet results) throws SQLException { EmployeeBean bean = new EmployeeBean(results.getInt("id")); bean.setFirstName(results.getString("fname")); bean.setLastName(results.getString("lname")); bean.setEmail(results.getString("email")); bean.setDepartment(results.getString("department")); bean.setImage(results.getString("image")); return bean; } public EmployeeBean fetchEmployee(int id) { EmployeeBean bean = null; try { ResultSet results; String sql = "select * from people_table where id = ?"; PreparedStatement pstmt = conn.prepareStatement(sql); synchronized (pstmt) { pstmt.clearParameters(); pstmt.setInt(1, id); results = pstmt.executeQuery(); } if (results.next()) bean = makeBean(results); if (results != null) results.close(); } catch (SQLException se) { se.printStackTrace(); } return bean; } public List fetchAll() { List list = new ArrayList(); try { ResultSet results; Statement st = conn.createStatement(); System.out.println("Okay until create statement"); results = st.executeQuery("select * from people_table"); System.out.println("Okay until execute query"); while (results.next()) list.add(makeBean(results)); } catch (SQLException se) { se.printStackTrace(); } return list; } public void destroy() { try { if (conn != null) conn.close(); } catch (SQLException e) { } } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
easy debugging
Hello list users, I'm using Tomcat on win2k. There is a window which is always open when Tomcat runs. It shows messages like "INFO:" etc. Is there a way I can write to this window from inside a servlet? I'm just looking for an easy way to debug my servlets. TIA, Vamsee. -- Because joy is one's fuel - Ayn Rand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: class not found error
Thanks Tim & Yoav, you got me started off on my Tomcat journey :) I'm running Win2k + PostgreSQL 7.4.3 (on Cygwin) + Tomcat. Yay! -Vamsee. Vamsee Kanakala wrote: Dear list users, I have a beginner's problem: I'm trying to get a small app which retrieves a bunch of records from database (postgres) and prints them. I set up the datasources, etc, correctly. I have the structure like this: CATALINA_HOME | -- webapps | -- movies | -- WEB-INF | | | | --classes | | | | | --MovieDB.class | | -- web.xml | |-- users.jsp From what I have read in the docs, this structure seems okay, but when I try to access localhost/movies/users.jsp it gives me an error saying that class MovieDB is not found. I didn't give any mapping about MovieDB in web.xml because it's not a servlet. Do I need to do it anyways? What am I doing wrong? Do I need to declare about this in server.xml as a tag? TIA, Vamsee. -- Because joy is one's fuel - Ayn Rand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
class not found error
Dear list users, I have a beginner's problem: I'm trying to get a small app which retrieves a bunch of records from database (postgres) and prints them. I set up the datasources, etc, correctly. I have the structure like this: CATALINA_HOME | -- webapps | -- movies | -- WEB-INF | | | | --classes | | | | | --MovieDB.class | | -- web.xml | |-- users.jsp From what I have read in the docs, this structure seems okay, but when I try to access localhost/movies/users.jsp it gives me an error saying that class MovieDB is not found. I didn't give any mapping about MovieDB in web.xml because it's not a servlet. Do I need to do it anyways? What am I doing wrong? Do I need to declare about this in server.xml as a tag? TIA, Vamsee. -- Because joy is one's fuel - Ayn Rand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]