tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid...@pidster.com>
Subject Re: MySql Connector
Date Thu, 26 Jul 2007 10:25:19 GMT
ClassNotFoundException?

<ObviousStatement>
Your JSP can't find one of the classes you refer to in the scriptlet.
</ObviousStatement>

We can't tell which one, because we don't know what's at line 266 in the 
generated java file (you could look).

Which of the classes you're using in the JSP haven't been imported at 
the top of the JSP? (possible candidates: Connection, DriverManager, 
Statement, ResultSet?)



p




Mohammed Zabin wrote:
> It's already wrapped man, i just copied the code snippet from within <%%>
> marker ;), and for System.out, or out.println, It's still the same problem.
> If you looked at the exception you will find ClassNotFoundException at line
> 66 in the generated servlet, and this occurs withing the try block, so, i
> think it's a problem of Connector. But the strange thing is that this
> code worked fine on a normal java class???
> 
> On 7/26/07, David Smith <dns4@cornell.edu> 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@christopherschultz.net> wrote:
>>>
>>>> -----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@tomcat.apache.org
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 


Mime
View raw message