• 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

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

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this --
Thread.getContextClassLoader().loadClass(driver);
Let me know if that works,
Matt
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What difference would Thread.getContextClassLoader().loadClass() would make ? howz it different from Class.forName() ?
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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???
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic