Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Jar file

  Asked By: Robert    Date: Jan 25    Category: Java    Views: 1002
  

I'm working in Linux environment.
I build a jar file of my application (it access the Oracle database) and I
receive this error:
java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
when call this: java -jar arquivo.jar

My CLASSPATH was setted for local dir (.) where all necessary packages there
are (included the Oracle driver file).

Asks:
What´s happening?
How I make to include (and call) the Oracle driver package into my jar file?

Share: 

 

8 Answers Found

 
Answer #1    Answered By: Adelino Fischer     Answered On: Jan 25

Include your oracle  driver also into the same jar
file.
or call  the run the program with

java -classparth <path to classes12.jar> -jar  <your
jar file  name>

 
Answer #2    Answered By: Janis Hart     Answered On: Jan 25

I´m doing this...

/opt/Telemar/epicenter/rioProcessor/controlador -> application  dir
/opt/Telemar/epicenter/distribuicao/lib -> packages  dir

Follow my run.sh file:

========================================
cd /opt/Telemar/epicenter/rioProcessor/controlador

export
CLASSPATH=.:/opt/Telemar/epicenter/distribuicao/lib:/opt/Telemar/epicenter/d
istribuicao/lib/activation
.jar:/opt/Telemar/epicenter/distribuicao/lib/mail.jar:/opt/Telemar/epicenter
/distribuicao/lib/xalan.jar:/opt/
Telemar/epicenter/distribuicao/lib/xerces.jar:/opt/Telemar/epicenter/distrib
uicao/lib/classes111.zip

/usr/java/jdk3/bin/java -jar  controlador.jar
========================================

If I include  the oracle  driver in my jar  file, how I will call  the driver? I
need create "internal" classpath  in the Manifest file?

 
Answer #3    Answered By: Shiv Patel     Answered On: Jan 25

I want you to just edit one line in your shell script.
I have marked the place....

 
Answer #4    Answered By: Marnia Mian     Answered On: Jan 25

I change my script based on your instruction.
The CLASSPATH was setted (your value was displayed).

But return the same error...

 
Answer #5    Answered By: Ayaz Hashmi     Answered On: Jan 25

Just a small Q where did you get the driver  from. I
dont remember seeing any zip files in my unix oracle
installation.

Can you unzip the zip file  into a temporary directory
and then modify the classpath  variable to point to
this directory...ie if you have unzipped it into
/usr/marcus/oracledriver/

in your classpath point to /usr/marcus/oracledriver/
and remove any reference to the zip file and can you
have a go at it...

 
Answer #6    Answered By: Zane Thompson     Answered On: Jan 25

You are about rigth.
Exist zip files in another application  on the same server...
But, I will try your advice...

 
Answer #7    Answered By: Constance Reid     Answered On: Jan 25

I follow your advice (unzip the package  (classes111.zip - Yes! With the
classes12.zip don´t run) and include  in my package) and run my application.

But, after many seconds, I receive this error  message:
java.sql.SQLException: Io exception: The Network Adapter could not
establish the connection

Do you know this error?

We have two environment
W2000 - development
Linux - test
In the W2000 I get run my application  and access  the Oracle server without
any problem with the driver file  classes12.zip
In the Linux I try use the classes12, but don´t run, only run with the
classes111. Why this?

 
Answer #8    Answered By: Este Ferrrari     Answered On: Jan 25

This SQL exception is thrown
1. when the connection query string is wrong.
2. there is no physical connection ie the server is
not being able to connect to your DB m/c

Solutions:

1. Check your connection string
2. make sure that you at the minimal able to ping your
DB server

Run the ping command as follows:

ping <db m/c>

if you are using a name like "dbserver" instead of a
pure IP make sure that your
/etc/hosts files has a corresponding entry (Ask your
Network Admin he will help you out on this)

But the main trouble I feel is your connection string

By connection string I mean this line in your
class/configuration files

"jdbc:oracle:thin:@everest:1521:everora"

Also verify that you able to do a dbping through
SQLNet

or you are able to connect from your sqlplus from
linux.

 
Didn't find what you were looking for? Find more on Jar file Or get search suggestion and latest updates.




Tagged: