• 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

DataSource class not found

 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting a class not found exception when compiling a servlet, on a DataSource object. Specifically on this line:

Ihave imported the following packages:
import java.io.*;
import java.util.*;
import java.util.regex.*;
import java.sql.*;
import java.text.*;
import javax.mail.*;
import javax.activation.*;
import javax.mail.internet.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
import javax.naming.Context;
import javax.naming.InitialContext;
What package do I need?
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahh it is the little errors that cause some much trouble.

DataSource is defined in the
javax.activation and javax.sql packages.
Craig.
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would suggest you re-define your class to:

or
 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have imported the javax.sql.* and javax.activation.* packages.
Just in case I tried importing javax.sql and javax.activation, but got the javax/sql and javax/activation cannot find type errors.
My class path contains following .jars
rt.jar, tools.jar, servlet.jar
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, okay. I guess I misunderstood your error message.
The packages below are found in a jar file called j2ee.jar which can be accessed through Java's Enterprise Edition(J2EE) which you can download from Sun's website. I can't remember the exact path but it is something like %j2ee_home%\lib\j2ee.jar. The serlvet.jar file contains packages relating to jsp/servlet.


I hope this helps.
 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I noticed activation.jar was not in my class path and also made the suggested changes and it works now thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic