Hello,
i have an 3D-Animation that shows positions of Sensors in a 3D-Map. In my jMonkey SDK and as exported .jar everything runs well, but if I start it as an Applet (what I have to “at the end”) the position-data are not read. The app runs, but only that point fails.
Can anybodey help me why? What do i have to change in case of running it in an applet?
It looks like a problem there (Line27): Client client = Client.create();
Exception in thread “Thread-13” java.lang.ExceptionInInitializerError
at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.(AbstractMessageReaderWriterProvider.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:192)
at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:179)
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166)
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:256)
at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:160)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
at com.sun.jersey.api.client.Client.init(Client.java:342)
at com.sun.jersey.api.client.Client.access$000(Client.java:118)
at com.sun.jersey.api.client.Client$1.f(Client.java:191)
at com.sun.jersey.api.client.Client$1.f(Client.java:187)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.api.client.Client.(Client.java:187)
at com.sun.jersey.api.client.Client.(Client.java:159)
at com.sun.jersey.api.client.Client.create(Client.java:669) at wsn.JerseyClientPHP.actualizeSensors(JerseyClientPHP.java:27)
at wsn.JerseyClientPHP.getNodes(JerseyClientPHP.java:19)
at wsn.DbHandler.getSensors(DbHandler.java:40)
at wsn.Controller.run(Controller.java:136)
at java.lang.Thread.run(Unknown Source) Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission com.sun.jersey.core.util.ReaderWriter.BufferSize read)
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.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at com.sun.jersey.core.util.ReaderWriter.getBufferSize(ReaderWriter.java:91)
at com.sun.jersey.core.util.ReaderWriter.(ReaderWriter.java:87)
… 28 more
A thread is unlikely to cause a problem. The securityException comes because you are trying to breach the applet’s sandbox. Read up on applet sandboxes and see if you can work out what you are doing that breaches it.
Ok. What would be a better way than a seperate thread?
I call the HTTP-Get every second, because it isn´t neccessary to get the coordinates more often.
If i put the method into the loop() it is called many times a second!?
Maybe there is another way to call methods “timed”?
I just said the thread probably isn’t your problem…so why are you still looking at the thread? Or did you do a test and find that it does work if you don’t thread it?
@3H said:
There is clearly a problem calling a native constructor. Do natives need to be unpacked from applet jars?
You cannot distribute binaries with applets unless you have a valid certificate. If you have that you can, theres lots of info on that on :google:
The jme binaries are covered by the lwjgl certificate so they will work out of the box if you use the applet deployment in the SDK (if not, again, its a well documented topic)
I just said the thread probably isn’t your problem…so why are you still looking at the thread? Or did you do a test and find that it does work if you don’t thread it?
Sorry, I misunderstood it with my bad english. (I thought you meant that a seperate thread is not good in an applet)
You all are right,
the Thread wasn´t the problem, the Jersey-package threw the SecurityException. I solved it with another method to call the HTTP-Get:
URL url = new URL(“http://…/display-nodes.php?node=all”);
URLConnection con = url.openConnection();
InputStream in = con.getInputStream();