• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java classes within Apache

 
Bob Backlund
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic