metatech created KARAF-2359:
-------------------------------

             Summary: DirectoryWatcher for "deploy" directory should be 
configured to wait until framework start level reaches 60
                 Key: KARAF-2359
                 URL: https://issues.apache.org/jira/browse/KARAF-2359
             Project: Karaf
          Issue Type: Bug
          Components: karaf-config
    Affects Versions: 2.2.11
         Environment: ServiceMix 4.4.2 and 4.5.1
            Reporter: metatech


Problem :

By default, the DirectoryWatcher of Felix scans for new files very early in the 
start process.  If a new application bundle is added to the "deploy" directory, 
it might be detected and started while the framework start level is still at 
30, although the application bundle start should be postponed until level 60 is 
reached.  

If not, a typical problem will be that Camel-core is deployed after the 
application bundle, thereby not using the OSGi-aware CamelContext, causing some 
Camel components not to be found, with errors such as the following : 
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve 
endpoint: sql://SELECT 1 from DUAL?dataSourceRef=myDS due to: No component 
found with scheme: sql
A hint to the root cause of the problem can be found in the logs :
CamelNamespaceHandler            | OSGi environment not detected.

By default, the property "felix.fileinstall.start.level" in file 
"org.apache.felix.fileinstall-deploy.cfg" is unconfigured, resulting in the 
default "0" level being used.  Although this means that the new bundle's start 
level will be configured at level 60 (as configured in the 
"karaf.startlevel.bundle" property), another unwanted side effect is also 
observed : there is no wait in method "DirectoryWatcher:run()".

Solutions :

To avoid such race conditions between the starting of Camel-core bundle and an 
application bundle, it would be safer to explicitly configure the property 
"felix.fileinstall.start.level" to 60 in Felix 3.1.*, or property 
"felix.fileinstall.active.level" to 60 in Felix 3.2.*, or change the code of 
DirectoryWatcher to retrieve the default start level, in case it is unspecified 
in the properties.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to