Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problems when trying to retreive a connection using JNDI from an Applet

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have this problem with an applet. I'm currently working on a project that concerns Weblogic Server6.1 and an applet-communication. What i'm trying to do is asking the JNDI-service for a connection(from the connection pool created) which resides within the weblogic server. My applet is signed with all permissions there is but i still get a security permission. I tried to make my webbrowser use my own policy-file as well but i'm not sure if that is the right approach...i still belive that a signed applet with fully permissions should be enough. Yes i have tried this code within an ordinary application and it works like a charm

Here is a code-snippet along with the security exception(Note:the security exception happens on the line where i create a new InitialContext-object):
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, m_sWebLogicURL);
env.put(Context.SECURITY_PRINCIPAL, "test");
env.put(Context.SECURITY_CREDENTIALS, "test");
Context ctx = new InitialContext(env); //Throws a java.lang.SecurityException
mDataSource = (javax.sql.DataSource)ctx.lookup( m_sConnectionPool );
WebLogicPersist.init: caught a SecurityException...
java.lang.SecurityException: java/security/AccessController.doPrivileged: Only fully trusted classes can have native methods as members.
at java/security/AccessController.doPrivileged (AccessController.java)
at com/sun/naming/internal/VersionHelper12.getJndiProperties (VersionHelper12.java:88)
at com/sun/naming/internal/ResourceManager.getInitialEnvironment (ResourceManager.java:131)
at javax/naming/InitialContext.init (InitialContext.java:218)
at javax/naming/InitialContext.<init> (InitialContext.java:199)
at BAS/data/server/WebLogicPersist.init (WebLogicPersist.java)
at BAS/data/server/WebLogicPersist.<init> (WebLogicPersist.java)
at BAS/BASClient.run (BASClient.java)
at java/lang/Thread.run (Thread.java)

regards,
/Peter
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic