• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

jbuilder to tomcat error

Hi,

I created a simple jsp page with Jbuilder to pull info from a oracle db. It worked perfect within Jbuilder when i ran it. However im struggling to get this over to the folder where i have tomcat installed to run it outside of jbuilder.

I copied the folder which was created by Jbuilder, namely, "JSPTest" into my webapps folder. However i'm getting erros when i try and run JSPTest.jsp saying:

exception

org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.


An error occurred between lines: 35 and 73 in the jsp file: /momentum/JSPTest/defaultroot/JSPTest.jsp

Generated servlet error:
G:\Apache Tomcat 4.0\work\Standalone\localhost\_\momentum\JSPTest\defaultroot\JSPTest$jsp.java:80: Class oracle.jdbc.driver.OracleDriver not found.
                      DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                                                                         ^


An error occurred between lines: 81 and 175 in the jsp file: /momentum/JSPTest/defaultroot/JSPTest.jsp

Generated servlet error:
G:\Apache Tomcat 4.0\work\Standalone\localhost\_\momentum\JSPTest\defaultroot\JSPTest$jsp.java:151: Class org.apache.jsp.IOException not found.
                    catch (IOException ioe) {


This works perfectly in Jbuilder though.

I have oracle drivers in web-inf/lib.

In jbuilder i added the drivers by doing the following:

Select Project->Default Project Properties.

Click the "Required Libraries" tab in the center of the dialog window, and click "Add".

Click "New" to add a new library. You should see the New Library Wizard. Give the new library a name like "Oracle JDBC Driver".

Click the "Add" button and click in the directory chooser until you've selected classes111.zip in the directory where you installed it or found it. Be sure to select the file itself, not the directory it's in. Click "OK" to select the file.

I can't understand why it will run in jbuilder but then not on its own in tomcat?

0
act1ve
Asked:
act1ve
  • 3
  • 2
1 Solution
 
act1veAuthor Commented:
i just tried another piece of code, not created with jbuilder and i get the following error:

Could not find the database driver Giving up...connection is null

Looks like it cant find db driver for some reason:

this is my code i tried

<%@ page import="java.sql.*" %>
<%
    Connection connection = null;
    try {
        // Load the JDBC driver
        String driverName = "oracle.jdbc.OracleDriver";
        Class.forName(driverName);
   
        // Create a connection to the database
        String serverName = "server";
        String portNumber = "1521";
        String sid = "orawit";
        String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
        String username = "username";
        String password = "password";
        connection = DriverManager.getConnection(url, username, password);
    } catch (ClassNotFoundException e) {
        out.println( "Could not find the database driver");
    } catch (SQLException e) {
      e.printStackTrace();
        out.println( "Could not connect to the database");
    }

 if( connection == null )
 {
    out.println( "Giving up...connection is null" ) ;
 }
 else
 {
    try {
        // Create a result set containing all data from my_table
        Statement stmt = connection.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT * FROM Supervisor");
      while( rs.next() )
      {
            out.println( rs.getString( 1 ) + "<BR>" );
      }
       } catch (SQLException e) {
       }
 }
%>

i definatly have classes111.zip in WEB-INF\lib though

0
 
bloodredsunCommented:
Try  putting classes.zip in <tomcat>_HOME/common/lib

and see here: http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21388842.html
0
 
act1veAuthor Commented:
same error unfortunaetly :(

my path to classes111.zip is now Apache Tomcat 4.0\common\lib

i'm not too sure what could be wrong here, thanks for your help

0
 
act1veAuthor Commented:
hey mate, what i did was rename the zip to .jar, i think per as your suggestion in a previous question i made

the full path i have to it now is:

Apache Tomcat 4.0\webapps\ROOT\WEB-INF\lib

then classes.jar,

its connecting ok now!

thanks for your help
0
 
bloodredsunCommented:
Sweet! glad it worked...:-)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now