Ok this problem has stumped me completly, and I sure hope someone has an answer before I give up on this project completly.
Basicly I am trying to connect from a website pointing to a java servlet(2.5) and from there I want to use JDBC to connect to the DB.
The user and password are the DB credentials.
Now when I use the same dbconn file with a java class (printing success to the console) everything works like a charm, but if I try doing the same thing with the servlet it produces the error which can be seen below.
HTTP ERROR 500
Problem accessing /ClassChat/LogonSRV. Reason:
Server Error
Caused by:
java.lang.NoSchMethodError: oracle.i118n.text.converter.CharacterConverterOGS.getInstancec(I)Loracle/i18n/text/converter/ChatacterConverter;
at oracle.sql.converter.CharacterConverterFactoryOGS.make(CharacterConverterFactoryOGS.java:43)
at oracle.sql.CharacterSetWithConverter.getInstance(CharacterSetWithConverter.java:95)
at oracle.sql.CharacterSetFactoryThin.make(CharacterSetFactoryThin.java:95)
at oracle.sql.CharacterSet.make(CharacterSet.java:450)
at oracle.jdbc.driver.DBConversion.init(DBConversion.java:151)
at oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:112)
at oracle.jdbc.driver.T4CConection.connect(T4CConection.java:1075)
at oracle.jdbc.driver.T4CConection.logon(T4CConection.java:301)
at oracle.jdbc.driver.PhysicalConnection.<init>(T4CConection.java:221)
at oracle.jdbc.driver.T4CConection.<init>(DBConversion.java:151)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at bl.dbConn.getConnection(dbConn.java:32)
at bl.Conny.Conns(Conny.java:30)
at bl.LogonSRV.service(LogonSRV.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
....
....
a link to the full error list : https://i.sstatic.net/O9DrL.jpg
I have attached the correct Jars for JDBC & Servlets, and tried every trick in the book including calling a regular java class which in turn calls the connection.
To make it easier to find the error, here is some of the code I am using:
[Line 26 in bl.LogonSRV] (the line producing the error).
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Get the data from the jsp.
String strUser = request.getParameter("username");
String strPass = request.getParameter("password");
// In case this is the first time the page is loading.
if (strUser == null) {
// Redirect to login page.
request.getRequestDispatcher("Login.jsp").forward(request, response);
} else {
// Connect to the DB (the line producing the error).
String Error = Conny.Conns(strUser, strPass);
request.getRequestDispatcher("Success.jsp").forward(request, response);
}
}
[Line 30 in bl.Conny] (the line producing the error).
public static String Conns(String User, String Pass) {
Connection conni = null;
String Error = null;
try {
conni = dbConn.getInstance().getConnection(User, Pass);
} catch (SQLException ex) {
Error = "Error in connection";
}
return (Error)
}
[Line 32 in bl.dbConn] (the line producing the error).
// Connect to the DB.
public Connection getConnection(String Username, String Password) throws SQLException {
return (DriverManager.getConnection(SERVER_ADDRESS, Username, Password));
}
P.S. I know the connection needs to be closed, and that sending password is not safe, but first I want to see that it works, and how to fix this error.
Thank you all for the help, the problem ended up being that i had a previous .jar file on the project which was deleted but i didnt go through the deployment process again after deleting it.
I gues there are somethings you can only learn the hard way...