wood burning stoves 2.0*
The moose likes Java in General and the fly likes Property() and Class.forName()  error in jdk1.1/1.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Property() and Class.forName()  error in jdk1.1/1.3" Watch "Property() and Class.forName()  error in jdk1.1/1.3" New topic
Author

Property() and Class.forName() error in jdk1.1/1.3

mike zhang
Ranch Hand

Joined: Feb 26, 2002
Posts: 59
I use java.util.Properties class to read property data including jdbc oracle driver, and then use Class.forName(driver) to connect to database. However, if I do this in jdk1.1 it works fine; when I use the same code in jdk1.3, I got error like:
****
...
..
java.net.URLClassLoader.
java.lang.ClassLoader.loadClass()
java.lang.Class.forName0(Native method)
java.lang.Class.forName()
*****
Does somebody know the reason and how to fix it ?
Thanks,
mike
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Mike,
I'm not totally sure about this one, but it appears to be a security issue. It looks like you're trying to load a class over a network connection. You may try creating a policy file that grants universal permission just to test this.
Hope this helps
Michael Morris
SCJP2


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
may be this is elementary. You have the driver in the classpath?
Yeah i understand that you would probably get no class def found error or some stuff like that if it's not so.
Anyway you w'd want to check if classes12.zip (or the ora driver you are using) in the classpath
mike zhang
Ranch Hand

Joined: Feb 26, 2002
Posts: 59
The classpath does include the driver. The situation is: using the same code, same driver, it works in jdk1.1 but not in jdk1.3. If it is a security reason, why doesn't it happen in jdk1.1 ?
where should this security policy file be put ?
thanks,
mike
Matt Siegel
Ranch Hand

Joined: Jul 18, 2000
Posts: 55
Try this --
Thread.getContextClassLoader().loadClass(driver);
Let me know if that works,
Matt
Mandan Happy
Ranch Hand

Joined: Dec 17, 2001
Posts: 65
What difference would Thread.getContextClassLoader().loadClass() would make ? howz it different from Class.forName() ?
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by mike zhang:
****
...
..
java.net.URLClassLoader.
java.lang.ClassLoader.loadClass()
java.lang.Class.forName0(Native method)
java.lang.Class.forName()
*****
[/QB]

What are the dots standing for? What Error/Exception are you getting???


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Pete Lyons
Ranch Hand

Joined: Aug 18, 2002
Posts: 109
Please post the relevant code and complete error message/stack trace. If you are running an application, I don't think you will get any security exceptions. Also, I don't think that the presence of URLClassLoader in the stack trace necessarily indicates network class loading.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Property() and Class.forName() error in jdk1.1/1.3
 
Similar Threads
Class.forName()
connection without class.forName
Class.forName() error
Loading Driver.
Very Basic Question ....