EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CAJ Options
From: "J. Lewis Muir" <[email protected]>
To: [email protected]
Date: Tue, 15 May 2007 14:35:53 -0400
David Dudley wrote:
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

Hi, David.


It looks like it might be failing because the applet does not have write permission to *set* the system property "com.cosylab.epics.caj.CAJContext.addr_list" in the System.setProperty call.

You could try the approach I suggested earlier to see if it might work instead:

  DefaultConfiguration conf = new DefaultConfiguration("applet");
  conf.setAttribute("class", "com.cosylab.epics.caj.CAJContext");
  ...
  JCALibrary.getInstance().createContext(conf);

-lewis



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





References:
CAJ Options David Dudley
Re: CAJ Options David Dudley

Navigate by Date:
Prev: Re: CAJ Options David Dudley
Next: Re: CAJ Options David Dudley
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: CAJ Options David Dudley
Next: Re: CAJ Options David Dudley
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·