Oh.... and just one more thing -- use
com.mysql.jdbc.Driver as
org.gjt.mm.mysql.Driver is ancient.
--David
David Smith wrote:
> 1. This can't be the complete jsp code. If it is, you need to
> minimally wrap it in <% %> markers to indicate it's raw java code,
> not jsp/html. Additionally your System.out.println() call would end
> up going to the JVM's standard output instead of the browser.
>
> 2. The listed exception is really secondary to the main problem
> occurring whenever the jsp compile fails to generate a .class file.
> There has to be an earlier exception detailing the syntax problems
> with the jsp.
>
> --David
>
> Mohammed Zabin wrote:
>> This is my jsp code:
>> try {
>> Class.forName("
org.gjt.mm.mysql.Driver");
>> String url = "jdbc:mysql://localhost:3306/exam";
>> Connection con = DriverManager.getConnection(url,"root",
>> "exam");
>> Statement stmt = con.createStatement();
>> ResultSet rs = stmt.executeQuery("Select type from
>> questions");
>>
>> while( rs.next() ) {
>> System.out.println( rs.getString("type") );
>> }
>>
>> } catch( Exception e ) {
>> }
>>
>> and this is what i got:
>>
>> *exception*
>>
>>
org.apache.jasper.JasperException:
org.apache.jasper.JasperException:
>> Unable to load class for JSP
>>
org.apache.jasper.servlet.JspServletWrapper.getServlet (
JspServletWrapper.java:154)
>>
>>
org.apache.jasper.servlet.JspServletWrapper.service (
JspServletWrapper.java:320)
>>
>>
org.apache.jasper.servlet.JspServlet.serviceJspFile (
JspServlet.java:320)
>>
>>
org.apache.jasper.servlet.JspServlet.service (
JspServlet.java:266)
>>
javax.servlet.http.HttpServlet.service (
HttpServlet.java:803)
>>
>> *root cause*
>>
>>
org.apache.jasper.JasperException: Unable to load class for JSP
>>
org.apache.jasper.JspCompilationContext.load (
JspCompilationContext.java:600)
>>
>>
org.apache.jasper.servlet.JspServletWrapper.getServlet (
JspServletWrapper.java:142)
>>
>>
org.apache.jasper.servlet.JspServletWrapper.service (
JspServletWrapper.java:320)
>>
>>
org.apache.jasper.servlet.JspServlet.serviceJspFile (
JspServlet.java:320)
>>
>>
org.apache.jasper.servlet.JspServlet.service (
JspServlet.java:266)
>>
javax.servlet.http.HttpServlet.service (
HttpServlet.java:803)
>>
>> *root cause*
>>
>>
java.lang.ClassNotFoundException: org.apache.jsp.mySql_jsp
>>
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>
java.security.AccessController.doPrivileged(Native Method)
>>
java.net.URLClassLoader.findClass (
URLClassLoader.java:188)
>>
org.apache.jasper.servlet.JasperLoader.loadClass (
JasperLoader.java:134)
>>
>>
org.apache.jasper.servlet.JasperLoader.loadClass (
JasperLoader.java:66)
>>
>>
org.apache.jasper.JspCompilationContext.load (
JspCompilationContext.java:598)
>>
>>
org.apache.jasper.servlet.JspServletWrapper.getServlet (
JspServletWrapper.java:142)
>>
>>
org.apache.jasper.servlet.JspServletWrapper.service (
JspServletWrapper.java:320)
>>
>>
org.apache.jasper.servlet.JspServlet.serviceJspFile (
JspServlet.java:320)
>>
>>
org.apache.jasper.servlet.JspServlet.service (
JspServlet.java:266)
>>
javax.servlet.http.HttpServlet.service (
HttpServlet.java:803)
>>
>>
>> Any suggestions, please?
>>
>> On 7/25/07, Christopher Schultz <chris@(protected):
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Mohammed,
>>>
>>> Mohammed Zabin wrote:
>>>
>>>> I have the following error:
>>>>
>>>>
org.apache.jasper.JasperException: Unable to compile class for JSP:
>>>>
>>> Uhh... you have a syntax error in your JSP code. Fix that, then we'll
>>> get back to configuration issues. You didn't give enough information to
>>> help with the JSP syntax error.
>>>
>>> - -chris
>>>
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.7 (MingW32)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>>
>>> iD8DBQFGp2lm9CaO5/Lv0PARAvlRAJ45KuixS2Fy75ssMLQLwUYhA+DjOACgtiTN
>>> nZhKt8DoIGh8UFwV+Ri6qWI=
>>> =syvt
>>> -----END PGP SIGNATURE-----
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@(protected)
>>> To unsubscribe, e-mail: users-unsubscribe@(protected)
>>> For additional commands, e-mail: users-help@(protected)
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@(protected)
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)