Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, KK.

Asked: October 25, 2000 - 9:07 pm UTC

Last updated: October 27, 2011 - 11:17 am UTC

Version: 8.1.6

Viewed 10K+ times! This question is

You Asked

I've written a program which uses the utl_smtp to send
a email to myself. However, when I run the procedure,
the following error occurs:

ORA-29540: class oracle/plsql/net/TCPConnection does not exist

and Tom said...

Some of the installer scripts forget to load the needed jar file for TCP/IP support in PLSQL.

Simply:

cd plsql/jlib
loadjava -user sys/password plsql.jar

Rating

  (32 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Deepak Tanna, April 17, 2001 - 11:28 am UTC

Thanx it solved our developers problem

The suggested solution gives error

anoop, January 15, 2002 - 6:34 am UTC

Doing what is written:
cd plsql/jlib
loadjava -user sys/password plsql.jar

This command is giving me
ORA-00406 error- COMPATIBLE parameter needs to be 8.1.0.0.0. or greater.

I am having 8.1.6.0.0 on my machine

Please advice

Tom Kyte
January 15, 2002 - 9:35 am UTC

so, reset your compatible parameter to 8.1.6 and try again.

It is in your init.ora file. shutdown, change it, startup.

Another issue please help

NEETI, January 15, 2002 - 1:36 pm UTC

I tried to load java and got the following errors

Error while retrieving errors for oracle/plsql/net/TCPConnection
ORA-00904: invalid column name

Error while retrieving errors for oracle/plsql/net/InternetAddress
ORA-00904: invalid column name

Error while creating resource META-INF/MANIFEST.MF
ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler

loadjava: 3 errors

thanks,


Tom Kyte
January 15, 2002 - 1:56 pm UTC

search for

ORA-29547

on this site...


One More!

Ashok, January 16, 2002 - 12:01 pm UTC

I am Getting this error

any thing is wrong?

[GIB_UAT7-8.1.7] {oracle} : loadjava -f -v -r -u sys/eric plsql.jar
Unable to initialize threads: cannot find class java/lang/Thread
Could not create Java VM

Thx
Ashok

Error while load java

Ashok, January 17, 2002 - 8:31 am UTC

loadjava
Unable to initialize threads: cannot find class java/lang/Thread
Could not create Java VM


Pls Advice


Tom Kyte
January 17, 2002 - 11:43 am UTC

sounds like your CLASSPATH is not properly set.

Error while LoadJava Command

Ashok, January 17, 2002 - 1:34 pm UTC

Thx for Quick Response

I checked the class path

This is what i did

set env classpath /etc/..../lib/
(Setting the classpath for classes111.zip file

I tried ECHO $classpath i was able to see the classpath

But still i am getting this error

Pls Advice

Thx
Ashok

Tom Kyte
January 17, 2002 - 2:19 pm UTC

does $ORACLE_HOME/JRE/lib/rt.jar exist and what is the contents of your

$ORACLE_HOME/bin/loadjava

script.

Error Loading Java

Ashok, January 17, 2002 - 5:29 pm UTC

Thx for ur Quick Response

Yes rt.jar exist.

Checked the loadjava script and we found that path for .jar files & classes111.zip files are wrong,so changed to correct path

But now we r Getting a different Error Msg:

Version not compatibale with the Java Version in system classes check ur Classpath

Pls Advice

Ashok

Tom Kyte
January 18, 2002 - 11:56 am UTC

sounds like you have a very messed up install -- have never hit this (never had to edit the loadjava script myself).

Don't know what to tell you other then contact support and try to figure out what went wrong in an install or upgrade.

loadjava -user sys/xxx plsql.jar giving some errors

anoop, January 18, 2002 - 4:07 am UTC

Hi Tom,

Running the load java i got the following errors.....
the log file is below:

Please advice


ORA-04030: out of process memory when trying to allocate 554648 bytes (joxcx callheap,ioc_allocate ufree)
ORA-04030: out of process memory when trying to allocate 65036 bytes (callheap,KQL tmpbuf)
COUNT(*)
----------
6600
1 row selected.
Statement processed.
JVMRMACTION
------------
FULL_REMOVAL
Statement processed.
DBMS_JAVA.LONGNAME(NAME)
--------------------------------------------------------------------------------
ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","oracle/aurora/rdbms/DbmsJavaSYS","joxlod: in ehe","ioc_allocate_pal")
DBMS_JAVA.LONGNAME(O.NAME) TEXT
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","oracle/aurora/rdbms/DbmsJavaSYS","joxlod: in ehe","ioc_allocate_pal")
Statement processed.
Statement processed.
drop public synonym get_error$
*
ORA-01432: public synonym to be dropped does not exist
Statement processed.
Statement processed.
Statement processed.
JVMRMACTION
------------
FULL_REMOVAL
Statement processed.
Statement processed.
Statement processed.
Statement processed.
ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","java/lang/ObjectSYS","joxlod: in ehe","ioc_allocate_pal")
Statement processed.
ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","java/lang/ObjectSYS","joxlod: in ehe","ioc_allocate_pal")
ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","java/lang/ObjectSYS","joxlod: in ehe","ioc_allocate_pal")
ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","java/lang/ObjectSYS","joxlod: in ehe","ioc_allocate_pal")
------------
FULL_REMOVAL
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
drop table aurora$startup$classes$
*
ORA-00942: table or view does not exist
drop table aurora$shutdown$classes$
*
ORA-00942: table or view does not exist
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
JVMRMACTION
------------
FULL_REMOVAL
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
Statement processed.
JVMRMACTION
------------
FULL_REMOVAL
Statement processed.
Statement processed.
Statement processed.
JVMRMACTION
------------
FULL_REMOVAL
Statement processed.
Statement processed.
JVMRMACTION
------------
FULL_REMOVAL
Statement processed.
JVMRMACTION
------------
FULL_REMOVAL
Statement processed.
ORA-04021: timeout occurred while waiting to lock object SYS.INITJVMAUX
ORA-06512: at line 4


Tom Kyte
January 18, 2002 - 4:44 pm UTC

make sure your shared pool and java pool sizes are set large enough in the init.ora. they are not as it is.

Well worked

Krishna, March 18, 2002 - 1:24 am UTC

Hi Tom,

I was facing the problem in one of our development servers, for a long time. By loading the plsql.jar file, my mail procedure started working fine.

Thanks,
krishna

where is the directory plsql/jlib

nagarju, March 29, 2002 - 1:53 pm UTC

tom,
i want to use utl_smtp, but i am also getting the same error. only our dba can run that loadjava command given below.

where exactely is this directory present?

>>Simply:

>>cd plsql/jlib
>>loadjava -user sys/password plsql.jar

and, how do we ensure java server stuff is installed or not?

my oracel version is 8.1.6

Tom Kyte
March 29, 2002 - 2:32 pm UTC

it is under your oracle_home.


look at your banner returned by sqlplus and see if it mentions Java.

where is the directory plsql/jlib

nagarju, March 29, 2002 - 2:50 pm UTC

this is what appears when i log in

Oracle8i Enterprise Edition Release 8.1.6.3.0 - Production
With the Partitioning option
JServer Release 8.1.6.3.0 - Production


now is that enough if i run that
"loadjava" command or anything else i have to do?

Tom Kyte
March 29, 2002 - 2:52 pm UTC

that should do it.

Nirmal, March 30, 2002 - 11:00 am UTC

Hope that Mr. Tom has much more patience to respond all type of questions. The questioner can try out the problem with all posibilites themselves before raising questions. So that Tom becomes cool ;-).






Error

Yogesh, April 05, 2002 - 2:07 am UTC

when I was executing

loadjava -user sys/pass plsql.jar I faced following error

Error while computing shortname of oracle/plsql/net/TCPConnection
ORA-06550: line 1, column 13:
PLS-00201: identifier 'DBMS_JAVA.SHORTNAME' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Error while computing shortname of oracle/plsql/net/InternetAddress
ORA-06550: line 1, column 13:
PLS-00201: identifier 'DBMS_JAVA.SHORTNAME' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Error while creating resource META-INF/MANIFEST.MF
ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler

loadjava: 3 errors

What could be the reason

Tom Kyte
April 05, 2002 - 9:18 am UTC

Sounds like java isn't installed properly in your database. DBMS_JAVA is a supplied package that would be there.

Either have your DBA look into it (they can rmjvm and initjvm -- scripts -- to reinstall java properly) or contact support for assistance.

Sorry / Thanks

Yogesh, April 05, 2002 - 2:39 am UTC

Pervious error which I mentioned was due to dbms_java. This Package was not installed in my DB. After installing when I used following code for sending mail

create or replace
PROCEDURE send_mail (p_sender IN VARCHAR2,
p_recipient IN VARCHAR2,
p_message IN VARCHAR2)
as
l_mailhost VARCHAR2(255) := 'aa.bb.com';
l_mail_conn utl_smtp.connection;
BEGIN
l_mail_conn := utl_smtp.open_connection(l_mailhost, 25);
utl_smtp.helo(l_mail_conn, l_mailhost);
utl_smtp.mail(l_mail_conn, p_sender);
utl_smtp.rcpt(l_mail_conn, p_recipient);
utl_smtp.open_data(l_mail_conn );
utl_smtp.write_data(l_mail_conn, p_message);
utl_smtp.close_data(l_mail_conn );
utl_smtp.quit(l_mail_conn);
end;
/


begin
send_mail( 'yogeshb@bb.com', 'matty@bb.com', 'Test mail from DB' );
end;
/

Mail was sent, but mail was not having any info like, from /to as well text.

From : Sender Unspecified
To :none
subject : (No subject)

Why this is so ?


Tom Kyte
April 05, 2002 - 9:19 am UTC

you didn't write the

To: .......

record. The to list is just "data" in the email body.

Search for utl_smtp and see some of the "larger" examples I have.

Got it

Yogesh, April 05, 2002 - 3:56 am UTC

Thanks a lot Tom, got solution. Sorry for trouble.

another error

rajiv, April 19, 2002 - 2:42 pm UTC

tom,
after running "loadjava -user sys/password plsql.jar"
I get:
/export/vol/oracle.8.1.6/product/dbms/8.1.6/bin/loadjava[16]: /app/oracle/product/dbms/8.1.6/JRE/bin/jre: not found

please help

Tom Kyte
April 19, 2002 - 3:02 pm UTC

Then you have no java installed or your install is messed up.

cd $ORACLE_HOME/JRE/bin

cd if it is there.

Helpful - almost

A reader, August 28, 2003 - 10:02 am UTC

Thanks a million, Tom, for all I have gleaned from this site.

I need some assistance with what you wrote above:
"loadjava -user sys/password plsql.jar"

I tried that and I get the error:
"SQL error while connecting with oci8 driver to default database: ORA 12560: TNS: Protocol adapter error
could not open error
loadjava: 2 errors"

I am a developer and not a DBA so I have limited access to the database. What am I missing here?

Thanks,

Leora


Tom Kyte
August 29, 2003 - 7:36 am UTC

if you are not a DBA what are you doing with the SYS password?????? that pretty much gives you carte blanche to the database.

so, do you have a local instance, or is it on the network (eg: were you on the server itself or on your pc)

ORA-29541 : executing UTL_SMTP

Rose, September 02, 2003 - 1:00 pm UTC

Hi Tom,
I'm using Oracle 8.1.7 (Windows NT 4.0). I did:
cd plsql/jlib
loadjava -user sys/password plsql.jar

withou problem.
The script send_mail was compiled without errors

create or replace procedure send_mail ( p_sender in varchar2, p_recipient in varchar2, p_message in varchar2 ) as
l_mailhost varchar2(255) := '40.10.1.18' ;
l_mail_conn utl_smtp.connection ;
begin
l_mail_conn := utl_smtp.open_connection(l_mailhost, 25) ;
utl_smtp.helo(l_mail_conn, l_mailhost) ;
utl_smtp.mail(l_mail_conn, p_sender) ;
utl_smtp.rcpt(l_mail_conn, p_recipient ) ;
utl_smtp.open_data(l_mail_conn) ;
utl_smtp.write_data(l_mail_conn, p_message ) ;
utl_smtp.close_data(l_mail_conn) ;
utl_smtp.quit(l_mail_conn );
dbms_output.put_line('Message send to the user successfully') ;
end ;

However, when I execute send_mail, it returns:
ORA-29541: class SYS.oracle/plsql/net/TCPConnection could not be resolved
ORA-06512: at "SYS.UTL_TCP", line 537
ORA-06512: at "SYS.UTL_TCP", line 199
ORA-06512: at "SYS.UTL_SMTP", line 99
ORA-06512: at "SYS.UTL_SMTP", line 121
ORA-06512: at "SYS.SEND_MAIL", line 6
ORA-06512: at line 2

Please help!!

Tom Kyte
September 02, 2003 - 3:06 pm UTC

hmm, i haven't seen that one.

was this database upgraded over time? was the upgrade done "by hand" or "by tool"

the only thing I see related is a bad "upgrade". if this is the case, you may need to remove and then reinstall the jvm. I would suggest filing a tar with support on this (and if you do the remove/reinstall -- please backup or at least test it on a test system first)

RE: Could not be resolved

Mark A. Williams, September 02, 2003 - 3:13 pm UTC

I found a TAR on MetaLink that suggests loading as:

loadjava -resolve -force -user sys/password $ORACLE_HOME/plsql/jlib/plsql.jar

HTH,

Mark

Tom Kyte
September 02, 2003 - 9:06 pm UTC

going to have to sublet you some space here :)

(thanks!)

executing utl_smtp

rose, September 03, 2003 - 9:50 am UTC

Tom,
thanks for your quick response!!
My server machine has various Oracle version(8.1.5, 8.1.7, 9i-rel2).
V.8.1.7 isn't a upgrade (it is a new installation), and on this version I am working:
I executed loadjava -user sys/pwd plsql.jar and I've got error Ora-00406 .Then I modified init.ora, compatible= 8.1.7 (it was 8.0.5).

I tried loadjava -resolve -force -user sys/password $ORACLE_HOME/plsql/jlib/plsql.jar (thanks Mark) but the problem persists (executing send_mail(), I've got the error ORA-29541: class SYS.oracle/plsql/net/TCPConnection could not be resolved)

Obs: I execute send_mail() in Oracle 9i and got success

Thanks !!



Tom Kyte
September 03, 2003 - 11:55 am UTC

sounds like java isn't installed correctly in the database. you can try doing that over

see rmjvm and initjvm.sql in $OH/javavm/install

backup or test on a system you care not so much about -- please don't do this on a "live" box.

RE: Could not be resolved

Mark A. Williams, September 03, 2003 - 12:19 pm UTC

> compatible= 8.1.7 (it was 8.0.5)

From the readme.txt file in the javavm directory:


1.5 Compatibility Mode

To use Java in the Oracle8i server, you must set

compatibility = 8.1.0

or higher.


I have not used this package, but if compatible must be 8.1.0 or higher and yours was set to 8.0.5 when the javavm was installed, I would suggest reloading the javavm now that compatible is set correctly.

HTH,

Mark

shutdown abort is the only solution?

Leon, July 13, 2004 - 2:54 am UTC

Unfortunately utl_smtp even if working 99% of the time on 9.2 quite often hangs without generating any error. Just indefinitely active session. Terrible thing to have, I believe such “not rugged “ behavior make oracle marketing talk about java virtual machine less and less.

So far I have found that such session are not “killable”. The only solution is to recycle database via shutdown abort. Any suggestions on how to kill session involving java hang up are greatly appreciated


Tom Kyte
July 13, 2004 - 11:40 am UTC

hmm, lets see -- I've been using utl_smtp to send 100's of thousands of emails for years. (literally, no hype here)

And I've never had a hang.
not once.
never.

Perhaps -- just maybe -- it is your smtp server configuration? it is blocked in network call.

and in 9.2, utl_smtp is 100% C code. (if you are on unix, you can try killing the dedicated server process)

but -- you'll want to take a look at your network configuration, your smtp configuration. i think you have other problems outside of the database there.

plsql.jar

A reader, November 10, 2004 - 3:34 pm UTC

Tom,
Where can I find the plsql.jar file to be loaded using loadjava,
I can't find the jlib directory under pl/sql; and I can't find the plsql.jar under jlib.

Thanks,

Tom Kyte
November 10, 2004 - 8:19 pm UTC

are you sure you need it -- this was in 816 only, this is not "for everyone"

no versions, no information...

plsql.jar

A reader, November 10, 2004 - 4:46 pm UTC

Sorry, I didn't mention that we have Oracle9.2.0.5 (Solaris 5.8)

Tom Kyte
November 10, 2004 - 8:36 pm UTC

skip this note then.

Meaning of error

Deepak, June 29, 2005 - 3:01 am UTC

Ho Tom,

I am encountering the following error.
 
ORA-04031: unable to allocate 8196 bytes of shared memory ("large pool","unknown object","hash-join subh","QERHJ list array")

What does the error really mean?
 
Problem is with the shared pool or the large pool?

I tried the following but to no help...

SQL> alter system flush shared_pool;

Is there any quick fix to it without bouncing the Instance?
 

Tom Kyte
June 29, 2005 - 8:56 am UTC

it says "large pool". it no where says "shared pool". the SGA is shared memory, the large pool is failing to allocate memory.

are you using shared server connections?

Shared Server Connection

Deepak, June 29, 2005 - 1:18 pm UTC

Yes we are using shared server connections.

Tom Kyte
June 29, 2005 - 1:31 pm UTC

your session memory comes from the large_pool. Your large pool is not large enough to hold everything you need.

Good Review

poorani narayanan, June 12, 2006 - 4:40 am UTC

Thanks for the very good informations. Kindly help me use utl_smtp.vrfy function




plsql.jar

Dilip, November 05, 2008 - 7:10 am UTC

Tom,

All the answer about loading this jar files seems to be for UNIX/SOLARIS environment. Mine in Windows environment then where do I find this file and how to load this.

Please help..
Tom Kyte
November 11, 2008 - 12:27 pm UTC

in the year 2008, you shouldn't need to. You cannot really be running 8.1.6 in the year 2008 can you?

but loadjava exists on all ports - even windows.

ces.email_files

Ram, December 14, 2009 - 7:51 pm UTC

Hi Tom,
We are using standard package CES.email_files to send emails with attachments.
CES.email_files(from_name => lc_from_email_id
,to_names => l_email_id
,subject => lc_subject
,message => lc_message
,cc_names => lc_cc_email_id
,filename1 => lc_directory||'/'||l_file_name
);
It is working fine if all the emails are correct. Lets say we have 5 email recepients
1) abc@gmail.com
2) xyz@yahoo.com
3) pqr@@gmai.com
4) mnq@hotmail.com
5) srt@yahoo.com
The third email recepient has 2 @ in the id which is invalid, so the program send mails to the first 2 and ignoring the rest. How do we skip the third email and continue sending to the rest of the recepients.

Thanks in advance
Tom Kyte
December 15, 2009 - 8:38 am UTC

I guess by fixing your code?

I mean, your package CES.email_files is standard to exactly one person on the planet.

YOU.

I don't have it, they don't have it, just you do.

So, dig into it and figure out "why does it stop sending if one out of five are invalid" and do something else in the code? Change the error handling?

Probably, the API should be:

CES.email_files(from_name => lc_from_email_id
,to_names => l_email_id
,subject => lc_subject
,message => lc_message
,cc_names => lc_cc_email_id
,filename1 => lc_directory||'/'||l_file_name
,FAILED_EMAILS => l_failures );

if ( l_failures is not null )
then
do something about it.


A reader, September 09, 2011 - 3:14 am UTC

Hi Tom,

Quite not sure if this is a silly question.My oracle version is 8.1.7.4 and we have an web application. when i try to access the web page it is throwing
"ORA-29540: class oracle/plsql/net/InternetAddress does not exist ORA-06512: at "SYS.UTL_INADDR", line 21 ORA-06512: at "SYS.UTL_INADDR", line 21 ORA-06512: at line 1"

I tried
cd plsql/jlib
loadjava -user sys/password plsql.jar

but it is giving pirm/u01/app/oracle/product/8.1.7/bin/loadjava[16]: /u01/app/oracle/product/8.1.7/JRE/bin/jre: not found

can you please help

ORA-29540: class oracle/plsql/net/InternetAddress does not exist

Ramandh, October 27, 2011 - 3:00 am UTC

I will get into my application web page after verfiy the hostname of the server. The query used in the package to get the hostname is "select hostname into v_host from host_par where host_name=upper(utl_inaddr.get_host_name);" but this query is returing error ORA-29540: class oracle/plsql/net/InternetAddress does not exist
ORA-06512: at "SYS.UTL_INADDR", line 21 ORA-06512: at "SYS.UTL_INADDR", line 21

I've tried your adivce i.e loadjava -user sys/password plsql.jar but it giving error /u01/app/oracle/product/8.1.7/bin/loadjava[16]: /u01/app/oracle/product/8.1.7/JRE/bin/jre: not found

I've also tried a query on JAVA CLASS i.e "select * from dba_objects where object_type = 'JAVA CLASS' and upper(object_name) like upper('%internet%')"i could not find the "InternetAddress" java calss and the all the fetched JAVA CLASS are in invalid state.
Not sure where to go and how to slove. Your advice can help me out!!

Tom Kyte
October 27, 2011 - 11:17 am UTC

I'm not going to be much help, I don't have 8.1.7 around anywhere anymore.

It looks like your jre (java runtime environment) is not installed - do you have the jre available?

A reader, November 06, 2011 - 2:27 am UTC

Tom,

Sorry about the delay. As you suspected the JVM was corrected. We have re-installed the JVM and now OK

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library