tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kitching Simon <>
Subject RE: unable to use my own created class
Date Wed, 20 Dec 2000 12:04:07 GMT

a) It is not necessary to declare a class in the "import".
The import statement, just like in java, only means that
you can leave the package part off of later uses of the bean.

b) I recommend putting all beans in some package or other.
There are some problems if they are at the "global" level, 
without any package.

c) you need to place your class under your webapp root,
in the WEB-INF/classes directory. Don't forget that you
need to create subdirectorie(s) corresponding to the package
name(s) that you chose for your java class. You don't need
to do anything with CLASSPATH.



> -----Original Message-----
> From:	Naresh Chhabria []
> Sent:	Wednesday, December 20, 2000 12:55 PM
> To:
> Subject:	unable to use my own created class
> Hello all,
>     I have created my own class "" and trying to use it in my
> Jdbc.jsp file as follows:-
> <%@ page import="*, java.sql.*, JdbcBean"  %>
> at this point there is no error, but when i instantiate this class as
> follows:-
> <%! JdbcBean jdbctest = new JdbcBean(); %>
> I am getting an error saying :
> Error: 500
> Location: /jsp/Jdbc.jsp
> Internal Servlet Error:
> javax.servlet.ServletException: JdbcBean
> Root cause:
> java.lang.NoClassDefFoundError: JdbcBean
> I copied JdbcBean.class at the scratchdir directory and also tried to
> manipulate the CLASSPATH env variable, but all in vain. I am unable to set
> the classpath for this class, can anyone suggest me where to place this
> class file.
> Thanks in advance
> Naresh Chhabria

View raw message