• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class.forName return null

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Class.forName("com.ibm.as400.access.AS400JDBCDriver") return with null.
Get this exception:
java.lang.ClassNotFoundException: sun.com.ibm.as400.access.AS400JDBCDriver
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:325)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java:134)
at dbaseMail.connect(dbaseMail.java:40)
at MailClientMass.DBConnect30(MailClientMass.java:204)
at MailClientMass.hentEmail(MailClientMass.java:163)
at MailClientMass.main(MailClientMass.java:247)
Anyone that can help me solve this problem?
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most likely the class you are attempting to load is not in your CLASSPATH.
 
age spets
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is using websphere application developer. The Jar file that include the driver is in the classpath and also in the properties. The weird thing is that other classes in the same project find the driver. Other solutions?
 
Ken Robinson
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The fact that you are getting a ClassNotFound exception all but guarentees this is a Classpath problem.
Although you may be able to compile the code, the runtime envionment may be configured differently.
Is this a web app or standalone? The type of app and where you deploy/run has a big effect on what classes are available.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To see the classpath that your servlet is actually running under, use System.getProperty("java.class.path"). As Ken suggests, you may find your runtime configuration isn't what you think it is.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try importing the following:
import java.lang.Runtime;
import java.sql.*;
import oracle.jdbc.driver.*;
You may go two routes.
Route: 1 - You may put your Driver classes in your Oracle lib and set your classpath like this depending upon your Oracle environment.
D:\Oracle\Ora81\jdbc\lib\816classes12.zip;
Route: 2 - You may put your Driver classes in the lib folder of your App Server and set its classpath.
 
age spets
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thx for the help. It was not in my classpath. This was easy to see when I used the code:
System.out.println(System.getProperty("java.class.path"));
Good tips!
thx all.
Age
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, this helped me, too.
Using 1.3.1 on IPlanet looking
for a jconnect driver (JDBC driver)
 
brevity is the soul of wit - shakepeare. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic