On Tue, 21 Mar 2000 16:24:29 +0100 Stefan Gybas <[EMAIL PROTECTED]> in debian-devel: (I post this now here because Stefan pointed me to this list ... My former E-Mails to debian-devel are appended as attachment)
> > java.lang.NullPointerException: > > where line 70 is something like > > > > rs = stmt.executeQuery("SELECT * FROM Table"); > > This simply means that stmt is NULL at this point, i.e. the previous call > to Connection.createStatement() failed. We can't help you unless you post > the whole source file. I attach the servlet source to this mail als Hallo.java It's simply the FreeTDS Initialisation as described in the FreeTDS-JDBC README (as I used successfully formerly). > > I have included the line > > > > repositories=/usr/share/java/servlets,/usr/share/java/freetds_jdbc.jar > > > > in /etc/jserv/zones/root.properties. > > You should not do this as the classes in the propsitory are loaded using a > special classloader which detects changes files. You should rather put > freetds_jdbc.jar into wrapper.classpath in /etc/jserv/jserv.properties and > make sure that the system classes (classes.zip for JDK 1.1) are also included > in this classpath. Hmm, could you be so kind to post an example? Im quite unsure because /etc/jserv/jserv.properties says: # Apache JServ entry point class (should not be changed) ^^^^^^^^^^^^^^^^^^^^^ # Syntax: wrapper.class=[classname] (String) # Default: "org.apache.jserv.JServ" So what Do I have to write exactly and where can I set the global classpath (for Apache?) correctly? > BTW: This is the wrong mailinglist for this question, please use debian-user > next time (it's also off topic on debian-java). Thanks for the hint. Hopefully I have done it right now. Kind regards Andreas.
import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class Hallo extends HttpServlet { Connection con; ResultSet rs; Statement stmt; ServletOutputStream out; public void init(ServletConfig conf) throws ServletException { super.init(conf); try { Class.forName("com.internetcds.jdbc.tds.Driver"); // Class.forName("com.internetcds.jdbc.tds.SybaseDriver"); } catch (ClassNotFoundException e) { System.err.println("CNF: " + e.getMessage()); return; } String url = "jdbc:freetds:sqlserver://sql03/Test"; String user = "TestUser" ; String password = "test"; try { con = DriverManager.getConnection(url, user, password); } catch (SQLException se) { System.err.println("SQL: " + se.getMessage()); return; } } public void service (HttpServletRequest request, HttpServletResponse res) throws ServletException, IOException { String title = "Example Apache JServ Servlet", query; res.setContentType("text/html"); out = res.getOutputStream(); out.println("<HTML><HEAD><TITLE>"); out.println(title); out.println("</TITLE></HEAD><BODY bgcolor=\"#FFFFFF\">"); out.println("<H1>" + title + "</H1>"); try { out.println("1<br>"); rs = stmt.executeQuery("SELECT * FROM Test"); out.println("2<br>"); if ( !rs.next() ) { out.println("3<br>"); System.err.println("Fehler 4"); return ; } out.println("4<br>"); query = rs.getString("Column"); out.println("5<br>"); out.println(query); out.println("6<br>"); } catch (SQLException se) { out.println("SQL: " + se.getMessage()); return; } out.println("<H2>Gratulation<br>"); out.println("</BODY></HTML>"); out.close(); } }
On Thu, 16 Mar 2000, Stefan Gybas wrote: > /jserv is an Apache handler, i.e. a "virtual" URL (from > /etc/jserv/jserv.conf which is part of the Apache configuration): > > # Enable the Apache JServ status handler with the URL of > # "http://servername/jserv/" (note the trailing slash!) > # Change the "deny" directive to restrict access to this status page. > <Location /jserv/> > SetHandler jserv-status > > order deny,allow > deny from all > allow from localhost > </Location> Thanks and sorry for bothering you with the bug report. Anyway it's not clear for me what to do that the image of the IsItWOrking-page is displayed right. It is not displayed even if I access it from localhost. Could you insert in the configuration file a) an example hoe to enable access from localhost/certain host/any host or b) include a hint to such information. I'm fighting since two weeks to get working what was working before the latest Jserv/Apache packages and I try to investigate in the problems that my Database accessing servlets refuse to work. I'm really unsure if the new Jserv is the reason but I just follow any hint ... Kind regards and thanks for maintaining this package Andreas.
On Tue, 21 Mar 2000, Andreas Tille wrote: > Hello, > > I've run into big trouble since I updatet do the latest Apache and > Jserv packages: > ... > For JDBC access to an MS SQL 7.0 server I use freetds-jdbc. This > works well in standalone Java applications but fails in servlets: Furthermore I've found in the logs the following information: [Tue Mar 21 11:25:22 2000] [error] JServ: ajp12: Servlet Error: java.lang.NoSuchMethodError: com.internetcds.jdbc.tds.Statement: method <init>(Ljava/sql/Connection;Lcom/internetcds/jdbc/tds/Tds;)V not found: com.internetcds.jdbc.tds.Statement: method <init>(Ljava/sql/Connection;Lcom/internetcds/jdbc/tds/Tds;)V not found [Tue Mar 21 11:25:22 2000] [error] JServ: an error returned handling request via protocol "ajpv12" I'm really in trouble and have no idea why the communication between Jserv and FreeTDS-JDBC did not work as before :-(((. Any help is really appreciated! Kind regards Andreas.