• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javaBean

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

big prob!! help!!


org.apache.jasper.JasperException: Unable to compile class for JSP problem.

An error occurred at line: 3 in the jsp file: /vms_view_user.jsp

Generated servlet error:
C:\tomcat\work\localhost\vms\vms_0005fview_0005fuser$jsp.java:66: Class SQLBean.UserInfo not found.
SQLBean.UserInfo db = null;
^


An error occurred at line: 3 in the jsp file: /vms_view_user.jsp

Generated servlet error:
C:\tomcat\work\localhost\vms\vms_0005fview_0005fuser$jsp.java:69: Class SQLBean.UserInfo not found.
db= (SQLBean.UserInfo)
^


An error occurred at line: 3 in the jsp file: /vms_view_user.jsp

Generated servlet error:
C:\tomcat\work\localhost\vms\vms_0005fview_0005fuser$jsp.java:74: Class SQLBean.UserInfo not found.
db = (SQLBean.UserInfo) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SQLBean.UserInfo");
^
3 errors

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:552)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:479)


here is my vms_view_user.jsp code:

<jsp:useBean id="db" scope="application" class="SQLBean.UserInfo"/>
<jsp:setProperty name="db" property="*"/>
<html>
<%
db.connect();
Vector v1 = db.getUserData();
for(int i = 0; i< v1.size(); ++i)
{
%>
<%=v1.elementAt(i)%>
<br>
<%
}
db.close();
%>
</html>


and this is part of my UserInfo.java

package SQLBean;

import java.io.*;
import java.util.*;
import java.util.Properties;
import java.util.Vector;
import java.sql.*;
import java.text.*;
import java.lang.String;

public class UserInfo {
public static void main(String[] args) {
UserInfo ui = new UserInfo();
}

public Vector getUserData() throws ClassNotFoundException, SQLException {
String username = null;

Statement qs = dbCon.createStatement();
String s1 = "select * from vcs_user";
ResultSet us = qs.executeQuery(s1);
Vector u = new Vector();

while(us.next())
{
u.addElement(us.getString(1));
username = us.getString(2);
System.out.println("username = " + username);
}
qs.close();
return u;
}
}


i've compliled my UserInfo.java and no error. I'm using Tomcat 4.0.3, JDK 1.3.1 and OS Windows XP. i also copied the UserInfo.class in my webapps/app-name/Web-inf/classes/SQLBean. but still not working. what could be the problem?

previously, i've created a class in the same package SQLBean and called that class in my jsp. everything seems ok. i can view the results thru web. and this prob occurs when i try to use a different class name but with the same functionality - collecting data from database. i just changed the java file name, compiled it, put the classes in the webapps/app-name/Web-inf/classes/SQLBean folder and this is what i get. i've tried so many ways but still couldn't work! helpppppppppp!!!

thank you.
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it's certainly telling you that it can't find UserInfo.class where it's expecting to. If you've put the class file where you think the compiler is looking and it doesn't work, the logical conclusion is that it isn't looking there.

Is that the actual case of your WEB-INF directory? I dunno if that would make a difference?

My only other advice - which may seem a bit obvious - is to check the Server classpath and ensure that your WEB-INF/classes directory is on it.

Jules
 
Noor Azrin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I try to change the name from Web-inf to WEB-INF but i got the 404 error.

Apache Tomcat/4.0.3 - HTTP Status 404 - /vcs

--------------------------------------------------------------------------------

type Status report

message /vcs

description The requested resource (/vcs) is not available.


When i changed it back to Web-inf it shows a directory listing of all files in the directory vcs. I just dunno what is the actual problem. btw, where can i check the server classpath? do i have to make any changes or settings related to the Web-inf? anything to do with the environment variable?
 
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are calling db.connect() from your jsp file but i don't see any connect() method inside your java file.

Also comment out the following statement from your jsp, as you don't have any set methods.
<!--jsp:setProperty name="db" property="*"/-->

You should have this WEB-INF folder under your application path.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Rajan",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic