tomcat-users mailing list archives

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

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.

Regards,

Simon

> -----Original Message-----
> From:	Naresh Chhabria [SMTP:nars@indiainfoline.com]
> Sent:	Wednesday, December 20, 2000 12:55 PM
> To:	tomcat-user@jakarta.apache.org
> Subject:	unable to use my own created class
> 
> 
> Hello all,
>     I have created my own class "JdbcBean.java" and trying to use it in my
> Jdbc.jsp file as follows:-
> <%@ page import="java.io.*, 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
> 
> 
> 

Mime
View raw message