Community
Participate
Working Groups
Build Identifier: Currently CDO (and more specifically Net4j) uses System.getProperty() to get configuration properties like net4j.config. This works fine in most setups. In particular, when CDO is used inside OSGi, config.ini can be used to set these properties. However when OSGi is deployed inside servlet container via servletbridge, this doesn't work anymore. The reason is that in this particular setup properties specified in config.ini are not stored in global system properties and are instead stored in a private copy of FrameworkProperties, available through BundleContext.getProperty() method (something I have learned from bug 209013). If CDO/Net4j used BundleContext.getProperty() instead of System.getProperty() it would have no negative impact on existing installations as FrameworkProperties are typically backed up by system properties anyway (unless osgi.framework.useSystemProperties is set to false). With current implementation, the only solution is to set properties globally for the whole servlet container (e.g. inside Tomcat start scripts). This is not an optimal solution when the servlet container hosts more web applications and prevents it from hosting multiple CDO servers (altough that might not be a frequent scenario). Reproducible: Always
Created attachment 167890 [details] Patch that makes Net4j use BundleContext.getProperty() when used in OSGi Here's a proposal of a patch for org.eclipse.net4j.util. The patch was made against HEAD but can also be applied to R2_0_maintenance after excluding unmatched changes. The main part are the changes to AbstractPlatform and OSGiPlatform. But to support properties like org.eclipse.net4j.util.io.tmpdir (which I consider less important) I had to make the two getProperty methods public and push them to OMPlatform interface as well. There might be other places using System.getProperty() outside org.eclipse.net4j.util which honestly I haven't checked.
Good catch, Michal. Thank you ;-) Committed to HEAD
Michal, please confirm that: 1) The number of lines that you changed is smaller than 250. 2) You are the only author of these changed lines. 3) You apply the EPL to these changed lines.
(In reply to comment #3) > Michal, please confirm that: > > 1) The number of lines that you changed is smaller than 250. > 2) You are the only author of these changed lines. > 3) You apply the EPL to these changed lines. I confirm all three points.
Comment on attachment 167890 [details] Patch that makes Net4j use BundleContext.getProperty() when used in OSGi Thank you!
Available in 3.0 GA: http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/