ClassNotFoundException puzzle... 
Author Message
 ClassNotFoundException puzzle...

The following code works fine in a servet I'm creating so I thought to make it easier to debug, I'd
create a new class to test it from. The only problem is the forName line always generates a
ClassNotFoundException. It works fine in the servlet but for some reason refuses to work in here.

I'm using Visual Cafe 4.1 enterprise edition for both projects & have checked the projects settings
are the same

Any ideas? - does Java ever get any easier?

thanks in advance

harry

//////////////////////////////////////////////////////////////////////////////////////
package waste;

// don't really all need these
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;

public class DBConnection {

    static
    {
        try
        {
            Class.forName("weblogic.jdbc.jts.Driver").newInstance();
        }
        catch(Exception e)
        {
            System.err.println(e.getMessage());
        }
    }

        public static void main(String[] args)
        {
        execSQL("hello");
    }

  public static ResultSet execSQL(String sql)
  {
    ResultSet rs = null;

    try
    {
        Connection conn = DriverManager.getConnection("jdbc:weblogic:jts:tacticalPool");
        Statement stmt = conn.createStatement();
        rs = stmt.executeQuery (sql);
    }
    catch (SQLException e)
    {
        System.err.println("Exception: controller_servlet.getEmployees: " + e);
        e.printStackTrace();
    }

    return (rs == null) ? null : rs;
  }

Quote:
}

//////////////////////////////////////////////////////////////////////////////////////


Tue, 28 Dec 2004 22:36:54 GMT
 ClassNotFoundException puzzle...

Quote:

> The following code works fine in a servet I'm creating so I thought to make it easier to debug, I'd
> create a new class to test it from. The only problem is the forName line always generates a
> ClassNotFoundException. It works fine in the servlet but for some reason refuses to work in here.

> I'm using Visual Cafe 4.1 enterprise edition for both projects & have checked the projects settings
> are the same

> Any ideas? - does Java ever get any easier?

> thanks in advance
> harry

Hi. I noticed you're coding for weblogic. The driver you are using is for weblogic serverside access
to our JDBC connection pools. If the class you are trying to run is not being run inside the weblogic
server, it won't be able to use the jts driver. If you code using our DataSources, an external client
can do JDBC through the weblogic server. Non-weblogic jdbc questions are good in this forum,
but if you have anything weblogic-related, also see our jdbc newsgroup for quick help.

Joe Weinstein at B.E.A.

Quote:

> //////////////////////////////////////////////////////////////////////////////////////
> package waste;

> // don't really all need these
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.util.*;
> import java.sql.*;

> public class DBConnection {

>     static
>     {
>         try
>         {
>             Class.forName("weblogic.jdbc.jts.Driver").newInstance();
>         }
>         catch(Exception e)
>         {
>             System.err.println(e.getMessage());
>         }
>     }

>         public static void main(String[] args)
>         {
>         execSQL("hello");
>     }

>   public static ResultSet execSQL(String sql)
>   {
>     ResultSet rs = null;

>     try
>     {
>         Connection conn = DriverManager.getConnection("jdbc:weblogic:jts:tacticalPool");
>         Statement stmt = conn.createStatement();
>         rs = stmt.executeQuery (sql);
>     }
>     catch (SQLException e)
>     {
>         System.err.println("Exception: controller_servlet.getEmployees: " + e);
>         e.printStackTrace();
>     }

>     return (rs == null) ? null : rs;
>   }
> }
> //////////////////////////////////////////////////////////////////////////////////////



Wed, 29 Dec 2004 00:48:44 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Date puzzle has me puzzled

2. Solve this Paradox puzzle...! (a real puzzle)

3. JDBC for postgresql HELP !!! ClassNotFoundException

4. Oracle JNDI can not find helper. ClassNotFoundException

5. ClassNotFoundException sun.jdbc.odbc.JdbcOdbcDriver

6. ClassNotFoundException

7. ClassNotFoundException

8. JDBC for postgresql HELP !!! ClassNotFoundException

9. ClassNotFoundException

10. ClassNotFoundException:jdbc.odbc.jdbcodbcdriver

11. ClassNotFoundException Oracle Thin Driver Help me please.....

12. ClassNotFoundException in servlet


 
Powered by phpBB® Forum Software