Hi,
I m getting the error org.apache.jasper.JasperException: Unable to compile class for JSP
and at the boot in root cause i get
java.lang.ClassNotFoundException: org.apache.jsp.db_jsp
db.jsp is the jsp file that i m trying to run when i get this error.
Here the content of db.jsp
<html>
<head>
<title>DB Test</title>
</head>
<body>
<%@ page import="DBTest" %>
<%
foo.DBTest tst = new foo.DBTest();
tst.init();
%>
<h2>Results</h2>
Foo <%= tst.getFoo() %><br/>
Bar <%= tst.getBar() %>
</body>
</html>
It's calling DBTest.java whose content is
package DBTest;
import javax.naming.*;
import javax.sql.*;
import java.sql.*;
public class DBTest {
String foo = "Not Connected";
int bar = -1;
public void init() {
try{
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context"
;
DataSource ds =
(DataSource)ctx.lookup(
"java:comp/env/jdbc/jdbcDBConnection"
;
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst =
stmt.executeQuery(
"select id, foo, bar from testdata"
;
if(rst.next()) {
foo=rst.getString(2);
bar=rst.getInt(3);
}
conn.close();
}
}
}catch(Exception e) {
e.printStackTrace();
}
}
public String getFoo() { return foo; }
public int getBar() { return bar;}
}
I 've trying pretty much everything that i could find online
concerning this error ... any ideas? Any help will be greatly appreciated...
I m getting the error org.apache.jasper.JasperException: Unable to compile class for JSP
and at the boot in root cause i get
java.lang.ClassNotFoundException: org.apache.jsp.db_jsp
db.jsp is the jsp file that i m trying to run when i get this error.
Here the content of db.jsp
<html>
<head>
<title>DB Test</title>
</head>
<body>
<%@ page import="DBTest" %>
<%
foo.DBTest tst = new foo.DBTest();
tst.init();
%>
<h2>Results</h2>
Foo <%= tst.getFoo() %><br/>
Bar <%= tst.getBar() %>
</body>
</html>
It's calling DBTest.java whose content is
package DBTest;
import javax.naming.*;
import javax.sql.*;
import java.sql.*;
public class DBTest {
String foo = "Not Connected";
int bar = -1;
public void init() {
try{
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context"
DataSource ds =
(DataSource)ctx.lookup(
"java:comp/env/jdbc/jdbcDBConnection"
if (ds != null) {
Connection conn = ds.getConnection();
if(conn != null) {
foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst =
stmt.executeQuery(
"select id, foo, bar from testdata"
if(rst.next()) {
foo=rst.getString(2);
bar=rst.getInt(3);
}
conn.close();
}
}
}catch(Exception e) {
e.printStackTrace();
}
}
public String getFoo() { return foo; }
public int getBar() { return bar;}
}
I 've trying pretty much everything that i could find online
concerning this error ... any ideas? Any help will be greatly appreciated...