After putting a bunch more comments in my Applet file, what I find is that the call to JCALibrary.getInstance() completes successfully, but the call to jca.createContext() fails.
My code is:
â-------------------------
try
{
URL codebase=this.getCodeBase();
String host=codebase.getHost();
// Get the JCALibrary instance
jca=JCALibrary.getInstance();
System.out.println("Instance initialization passed");
System.setProperty("com.cosylab.epics.caj.CAJContext.addr_list",host);
System.setProperty("com.cosylab.epics.caj.CAJContext.auto_addr_list","false");
// Create a thread safe context with default configuration values
ctxt=jca.createContext(JCALibrary.CHANNEL_ACCESS_JAVA);
System.out.println("Context creation passed");
System.setProperty("com.cosylab.epics.caj.CAJContext.addr_list",host);
System.setProperty("com.cosylab.epics.caj.CAJContext.auto_addr_list","false");
}
catch(Exception ex)
{
System.err.println("Initialization failed for " + dpm.dataSource+":\n" + ex);
System.exit(1);
}
â-------------------------
The console outputs:
Instance initialization passed
Initialization failed for Util1:Tot:KW:
java.security.AccessControlException: access denied (java.util.PropertyPermission com.cosylab.epics.caj.CAJContext.addr_list write)
java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.1)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkExit(Unknown Source)
at java.lang.Runtime.exit(Unknown Source)
at java.lang.System.exit(Unknown Source)
at Applet1.initDPM(Applet1.java:279)
at Applet1.init(Applet1.java:61)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Line 279 (the error line) is the line number of the System.exit(1) function call.
ideas??
David Dudley
>>> Kay-Uwe Kasemir <[email protected]> 5/15/2007 12:13 PM >>>
On May 15, 2007, at 12:16 , David Dudley wrote:
> OK, all you JCA and CAJ people, here's a problem for you-
>
> I'm setting up JCA/CAJ to run through an applet. How do I prevent
> them
> from *attempting* to find the JCALibrary.properties file?
>
> When an applet tries to find the file, it creates an access security
> exception, since Applets, by nature, can't access the underlying file
> system.
>
> I tried doing System.setProperty commands to set
> 'com.cosylab.epics.caj.CAJContext' to values before the createContext,
> but the moment that createContext is accessed, I get an error.
Interesting.
In jca-2.3.0/src/core/gov/aps/jca/JCALibrary.java
there's this code:
try {
InputStream is = JCALibrary.class.getResourceAsStream
( "JCALibrary.properties" );
if (is == null)
throw new RuntimeException("resource not found.");
_builtinProperties.load( is );
} catch( Throwable ressourceEx ) {
System.out.println( "Unable to load default configuration....);
}
I would think the worst that can happen is a println,
and your System.setProperty calls would actually win.
But maybe that attempt to read a file does worse things
to an applet, something that the catch() doesn't catch?
I'd try to change that code section somewhat to see
what's happening in your case.
-Kay
BEGIN:VCARD
VERSION:2.1
X-GWTYPE:USER
FN:David Dudley
TEL;WORK:880-3740
ORG:;MIS
TEL;PREF;FAX:880-3741
EMAIL;WORK;PREF;NGW:[email protected]
N:Dudley;David
END:VCARD
- Replies:
- Re: CAJ Options J. Lewis Muir
- References:
- CAJ Options David Dudley
- Navigate by Date:
- Prev:
CAJ Options David Dudley
- Next:
Re: CAJ Options J. Lewis Muir
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
<2007>
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
CAJ Options David Dudley
- Next:
Re: CAJ Options J. Lewis Muir
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
<2007>
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|