Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes Java classes within Apache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Java classes within Apache" Watch "Java classes within Apache" New topic
Author

Java classes within Apache

Bob Backlund
Ranch Hand

Joined: Jun 05, 2003
Posts: 51
Hi all,

I was wondering if you could help me. I have recently started looking into using Apache Tomcat (v5.0.27) for my web app server, but am having a little trouble with importing Java classes into JSPs.

I have a DB connection class called DBCOnnectionPool in a package called com.dev.database, I have stored this under
C:\Java\Tomcat5\webapps\ROOT\WEB-INF\classes\com\dev\database. But when I try to use the connection pool I get the folowing error:

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

An error occurred at line: 45 in the jsp file: /web/dev/login.jsp
Generated servlet error:
C:\Java\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\web\dev\login_jsp.java:89: cannot find symbol
symbol : constructor DBConnectionPool(java.lang.String)
location: class com.dev.database.DBConnectionPool


An error occurred at line: 45 in the jsp file: /web/dev/login.jsp
Generated servlet error:
DBConnectionPool cp = new DBConnectionPool("jdbc:jtds:sqlserver://"+strHostName+"/"+strDatabaseName+";USER="+strUsername+";PASSWORD="+ strPassword);
^
1 error


Have I stored the class in the right place, if so why can my JSP not see it?

Cheers

Keith


Cheers!
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
Did you import the class to the jsp? ie:


btw, 'Apache' generally refers to the Apache HTTP server, while 'Tomcat' is used to refer to Apache Tomcat.
[ February 10, 2005: Message edited by: Ray Stojonic ]
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Looks like it is saying it doesn't recognize a constructor that takes a String in class com.dev.database.DBConnectionPool (not that it doesn't recognize the class. First clue is which symbol it says it cannot find, second clue is where the ^ points.


C:\Java\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\web\dev\login_jsp.java:89: cannot find symbol
symbol : constructor DBConnectionPool(java.lang.String)
location: class com.dev.database.DBConnectionPool


An error occurred at line: 45 in the jsp file: /web/dev/login.jsp
Generated servlet error:
DBConnectionPool cp = new DBConnectionPool("jdbc:jtds:sqlserver://"+strHostName+"/"+strDatabaseName+";USER="+strUsername+";PASSWORD="+ strPassword);
^
1 error


[ February 10, 2005: Message edited by: Carol Enderlin ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java classes within Apache