• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
peter johansson
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic