There are some major difficulties working with curnits on the server.
curnits require AWT
At least any ones that create a java.awt.Frame or javax.swing.JFrame, which will be nearly all of them. The VM needs a graphics environment in which to do this. Servers run headless. Setting java.awt.headless=true doesn't do the trick because frames can't be created in that mode.
The trick is to run an X virtual frame buffer. This page has good notes:
http://products.davisor.com/doc/headless.html
can't set URLStreamHandlerFactory
Application servers don't let you set the URLStreamHandlerFactory, which is a pretty severe inter-app security problem. I'll see what happens when you set it on the application server in JAVA_OPTS, but this makes for more difficult deploying and server setup...
I tried this and there was no improvement:
export JAVA_OPTS="-Djava.protocol.handler.pkgs=net.sf.sail.core.net"
What it takes (in Tomcat) is to set up a custom Security Manager by editing catalina.policy and running with "-security" option.
// SAIL needs permission to set the stream handler - turadg permission java.lang.NetPermission "specifyStreamHandler"; permission java.lang.RuntimePermission "setFactory"; // and convert needs to create temp files permission java.io.FilePermission "temp", "write";
But even when I grant all
grant {
permission java.io.AllPermission;
};
It doesn't work and I still see this in the logs:
catalina.out:INFO: Cannot install sail url stream handler factory
Until we can solve this, I believe it means no unmarshalling the curnit server-side.
Comments (4)
Jul 12, 2006
Scott Cytacki says:
Curnits do not need to require JFrame. They are mainly a collections of componen...Curnits do not need to require JFrame. They are mainly a collections of components. There should be a way to work with them that just uses those components not the JFrame. Using components without frames in headless mode can work. But I believe you still need the X11 libraries installed on the server.
I ran into the same problem with the URLStreamHandler factory when embedding sail in Eclipse. The solution there was to figure out how eclipse handles urls and make our curnit and podar handlers fit into that way. I would assume tomcat has something similar. Adding our handler packages to the standard factory using the java.protocol.handler.pkgs doesn't work (at least in java 1.4) because of the secure way it is looking for the classes in those packages. The reason it probably isn't working even with your allpermissions, is because tomcat already installed one, and you can't install more than one. So you have to figure out how to work with the one tomcat installed.
A better solution would be to remove the need for our own url handlers. This would make it easier to embed sail inside of other application frameworks: tomcat, eclipse, ...
Jul 12, 2006
Turadg Aleahmad says:
I think I can make it work without setting the URLStreamHandlerFactory, at least...I think I can make it work without setting the URLStreamHandlerFactory, at least for the converter. Track at OWL-232@issues
Jul 12, 2006
Scott Cytacki says:
Why did you want to unmarshal on the server? I'm sure there several reasons, but...Why did you want to unmarshal on the server? I'm sure there several reasons, but what was it the prompted this work?
Jul 12, 2006
Turadg Aleahmad says:
Online wobnit > curnit converter PAS35@issuesOnline wobnit -> curnit converter PAS-35@issues