Re: JAXBContext in applet doesn't work

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JAXBContext in applet doesn't work

forums
I have lost my problem. Solution was very simple. JAXBContext.newInstance...
has to access to file system. But java security doesn't allow to do that. If
you want to allow this access you have to add "privileged" block in your
method and add your "access here JAXBContext.newInstance.." in this block.
With Access controller it will be possible. My solution : public String
testApplet (final String data) { ------ // the same code as above
AccessController.doPrivileged(new PrivilegedAction() { @Override public
Object run() { System.out.println(error.getId); JAXBContext jc =
JAXBContext.newInstance(ErrorMessage.class); System.out.println("context was
created"); try { System.out.println("context was successful created"); ; }
catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block
e.printStackTrace(); } return null; } }); More information you get in google.
(search after Access controller)

--

[Message sent by forum member 'mallerborn']

View Post: http://forums.java.net/node/898813


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JAXBContext in applet doesn't work

forums
Yes, you are right. To work with JAXB in applets or Java Web Start you have
to grant JAXB some privileges.

--

[Message sent by forum member 'yaroska']

View Post: http://forums.java.net/node/898813


Loading...