Re: Directing Sling job logging output to separate files?
> How do I provide the XML configuration to my sifting appender? Do I just > define a ConfigProvider that provides an InputSource with the XML, and > register that like: So far the usage pattern is that you register fully configured Appenders as OSGi service. The xml config support is more like stitching of logback config. So can try the way you are approaching i.e. register the ConfigProvider and see if it works > 2.) If I need to filter what is logged to error.log by the default Sling > Logging configuration (I want to ensure that the messages handled by the > sifting appender are not also logged to error.log), what is the best way to > to it? Register the filter as OSGi service with appenders="*" [1] Chetan Mehrotra [1] https://sling.apache.org/documentation/development/logging.html#filters-as-osgi-services On Fri, Sep 15, 2017 at 11:20 PM, John Logan wrote: > Thanks, Chetan. Actually, I ran into a problem where I need to create a > subclass of SiftingAppender to ensure that the appender is closed at the end > of a log session, so it looks like configuring the logging via OSGI instead > of a custom logback.xml might make more sense. > > > From looking at the Sling Logging page and WebConsoleTestActivator.java from > the Sling source as a starting point, it looks like would register my custom > appender and filter like so in the BundleActivator.start() method: > > > final Dictionary appenderProps = new > Hashtable(); > final String[] loggers = { "ROOT" }; > appenderProps.put("loggers", loggers); > context.registerService(Appender.class.getName(), new > CloseableSiftingAppender(), appenderProps); > > final Dictionary filterProps = new Hashtable Object>(); > filterProps.put("appenders", "CloseableSiftingAppender"); > context.registerService(Filter.class.getName(), new > RemoveUndirectedMessageFilter(), filterProps); > > From there I have a couple of questions: > > 1.) How do I provide the XML configuration to my sifting appender? Do I just > define a ConfigProvider that provides an InputSource with the XML, and > register that like: > > context.registerService(ConfigProvider.class.getName(), new > MyConfigProvider(), null); > > 2.) If I need to filter what is logged to error.log by the default Sling > Logging configuration (I want to ensure that the messages handled by the > sifting appender are not also logged to error.log), what is the best way to > to it? > > John > > > > > From: Chetan Mehrotra > Sent: Thursday, September 14, 2017 1:23:45 AM > To: users@sling.apache.org > Subject: Re: Directing Sling job logging output to separate files? > > While providing a custom logback.xml do remember to add Sling specific > handlers [1]. Otherwise OSGi integration of logging config would not > work as expected > > Chetan Mehrotra > [1] > https://sling.apache.org/documentation/development/logging.html#external-config-file > > On Thu, Sep 14, 2017 at 6:45 AM, John Logan wrote: >> I got this working and thought I'd follow up with what I did in case anyone >> else needs this sort of thing. >> >> >> I used SiftingAppender pretty much as shown in any of the examples one can >> find online. I put the following logback.xml in my sling.home, and pointed >> the OSGI configuration variable >> org.apache.sling.commons.log.configurationFile to it: >> >> >> >> >> >> jobId >> /var/log/sling/error.log >> >> >> > class="ch.qos.logback.core.FileAppender"> >> ${logPath} >> >> %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - >> %msg%n >> >> >> >> >> >> >> >> >> >> >> >> An abstract wrapper implementation of JobExecutor sets up the MDC to conform >> to what's expected in the logback.xml, and provides a few other niceties. >> Replace the SlingResourceProvider/StorageNode stuff with whatever you use to >> access files and Sling nodes; it's just a simple abstraction layer that we >> happen to be using. >> >> >> package com.xyz.content.sling.processor; >> >> import java.io.BufferedReader; >> import java.io.IOException; >> import java.nio.charset.StandardCharsets; >> import java.nio.file.Files; >> import java.nio.file.Path; >> import java.nio.file.Paths; >> >> import org.apache.sling.api.resource.LoginException; >> import org.apache
Re: Directing Sling job logging output to separate files?
While providing a custom logback.xml do remember to add Sling specific handlers [1]. Otherwise OSGi integration of logging config would not work as expected Chetan Mehrotra [1] https://sling.apache.org/documentation/development/logging.html#external-config-file On Thu, Sep 14, 2017 at 6:45 AM, John Logan wrote: > I got this working and thought I'd follow up with what I did in case anyone > else needs this sort of thing. > > > I used SiftingAppender pretty much as shown in any of the examples one can > find online. I put the following logback.xml in my sling.home, and pointed > the OSGI configuration variable > org.apache.sling.commons.log.configurationFile to it: > > > > > > jobId > /var/log/sling/error.log > > > > ${logPath} > > %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - > %msg%n > > > > > > > > > > > > An abstract wrapper implementation of JobExecutor sets up the MDC to conform > to what's expected in the logback.xml, and provides a few other niceties. > Replace the SlingResourceProvider/StorageNode stuff with whatever you use to > access files and Sling nodes; it's just a simple abstraction layer that we > happen to be using. > > > package com.xyz.content.sling.processor; > > import java.io.BufferedReader; > import java.io.IOException; > import java.nio.charset.StandardCharsets; > import java.nio.file.Files; > import java.nio.file.Path; > import java.nio.file.Paths; > > import org.apache.sling.api.resource.LoginException; > import org.apache.sling.api.resource.ResourceResolver; > import org.apache.sling.api.resource.ResourceResolverFactory; > import org.apache.sling.event.jobs.Job; > import org.apache.sling.event.jobs.consumer.JobExecutionContext; > import org.apache.sling.event.jobs.consumer.JobExecutionResult; > import org.apache.sling.event.jobs.consumer.JobExecutor; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > import org.slf4j.MDC; > > import com.xyz.content.sling.storage.SlingResourceProvider; > import com.xyz.storage.StorageNode; > > /** > * Sling job executor with build job logging. > * > * This class wraps build processing with job-specific log management. > * Job submitters need to configure the following job properties > * prior to submitting a job: > * * jobId - A symbolic identifier for the job. This value must be > * unique throughout the life of the job. Subclasses > * may use this value as a job name for submitting > * and monitoring SLURM jobs. > * * logPath - The pathname to the build log file. > * * damLogPath - If specified, the DAM resource to which > *the log output should be copied upon build completion. > * * clearLog - An option boolean parameter which, when true, > * removes the build log file if it exists prior > * to commencing the build. > * > * @author john > * > */ > public abstract class BuildJobExecutor implements JobExecutor { > private static Logger LOG = > LoggerFactory.getLogger(BuildJobExecutor.class); > > /** > * Retrieve a resource resolver factory for build processing. > * > * @return the resource resolver factory > */ > protected abstract ResourceResolverFactory getResolverFactory(); > > /** > * Subclass-specific build processing method. > * > * @param job > * @param context > * @param resolver > * @return the result of build processing > */ > protected abstract JobExecutionResult build(Job job, JobExecutionContext > context, ResourceResolver resolver); > > @Override > public JobExecutionResult process(Job job, JobExecutionContext context) { > // > // Prepare for the log directory and file. > // > final String jobId = job.getProperty("jobId", String.class); > final Path logPath = Paths.get(job.getProperty("logPath", > String.class)); > final Path logParentPath = logPath.getParent(); > if (logParentPath != null) { > try { > Files.createDirectories(logParentPath); > } > catch (final IOException e) { > return handleError(context, "Unable to create log directory " > + logParentPath); > } > } > > if (Boolean.TRUE.equals(job.getProperty("resetLog"))) { > try { > Files.deleteIfExists(logPath); > } > catch (final IOEx
Re: Sling w/ oak w/ RDBDocumentStore in production
On Sun, May 21, 2017 at 5:50 AM, Ioan Eugen Stan wrote: > How stable is Sling with RDBDocumentStore? > > How about with a PostgreSQL back-end? > It would be better to post these queries on us...@jackrabbit.apache.org. > Any recommendations / things to avoid using the RDBDocumentStore? No such list as of now. However do ensure that binaries are not stored in Database and you make use of any external DataStore Chetan Mehrotra
Re: Not-sticky sessions with Sling?
> Each time we remove an > instance, those users will go to a new Sling instance, and experience the > inconsistency. Each time we add an instance, we will invalidate all > stickiness and users will get re-assigned to a new Sling instance, and > experience the inconsistency. I can understand issue around when existing Sling server is removed from the pool. However adding a new instance should not cause existing users to be reassigned Now to your queries --- > 1) When a brand new Sling instance discovers an existing JCR (Mongo), does it > automatically and immediately go to the latest head revision? It sees the latest head revision > Increasing load increases the number of seconds before a "sync," however > it's always near-exactly a second interval. Yes there is a "asyncDelay" setting in DocumentNodeStore which defaults to 1 sec. Currently its not possible to modify it via OSGi config though. >- What event is causing it to "miss the window" and wait until the next 1 >second synch interval? this periodic read also involves some other work. Like local cache invalidation, computing the external changes for observation etc which cause this time to increase. More the changes done more would be the time spent on that kind of work Stickyness and Eventual Consistency - There are multiple level of eventual consistency [1]. If we go for sticky session then we are trying for "Session Consistency". However what we require in most cases is read-your-write consistency. We can discuss ways to do that efficiently with current Oak architecture. Something like this is best discuss on oak-dev though. One possible approach can be to use a temporary issued sticky cookie. Under this model 1. Sling cluster maintains a cluster wide service which records the current head revision of each cluster node and computes the minimum revision of them. 2. A Sling client (web browser) is free to connect to any server untill it performs a state change operation like POST or PUT 3. If it performs a state change operation then the server which performs that operation issues a cookie which is set to be sticky i.e. Load balancer is configured to treat that as cookie used to determine stickiness. So from now on all request from this browser would go to same server. This cookie lets say record the current head revision 4. In addition the Sling server would constantly get notified of minimum revision which is visible cluster wide. Once that revision becomes older than revision in #3 it removes the cookie on next response sent to that browser This state can be used to determine if server is safe to be taken out of the cluster or not. This is just a rough thought experiment which may or may not work and would require broader discussion! Chetan Mehrotra [1] http://www.allthingsdistributed.com/2008/12/eventually_consistent.html
Re: Not-sticky sessions with Sling?
On Tue, Jan 17, 2017 at 1:46 AM, lancedolan wrote: > It's ironic that the cluster which involves multiple datastores (tar), and > thus should have a harder time being consistent, is the one that can > accomplish consistency.. Thats not how it is. Cluster which involves multiple datastores (tar) is also eventually consistent. Changes are either "pushed" to each tar instance via some replication or changes done on one of the cluster node surfaces on other via reverse replication. In either case change done is not immediately visible on other cluster nodes > More importantly, is it a function of Repo size, or repo activity? > If the repo grows in size (number of nodes) and grows in use (number of > writes/sec) does this impact how frequently Sling Cluster instances grab the > most recent revision? Its somewhat related to number of writes and is not dependent on repo size > Less importantly... Myself and colleagues are really curious as to why > jackrabbit is implemented this way. Is there a performance benefit to being > eventually, when the shared datastore is actually consistent? What's the > reasoning for not always hitting the latest data? Also... Is there any way > to force all reads to read the most recent revision, perhaps through some > configuration? Thats a question best suited for discussion on oak-dev mailing list (oak-...@jackrabbit.apache.org) Chetan Mehrotra
Re: Not-sticky sessions with Sling?
On Sat, Jan 14, 2017 at 2:08 AM, lancedolan wrote: > To be honest, however, I don't understand fully > what you said in your last post and I also know that AEM 6.1 can do what I'd > like, which is really just Sling+Oak. If they can do it, I don't understand > why we can't. > > ref: > https://docs.adobe.com/docs/en/aem/6-1/administer/security/encapsulated-token.html That links talks about scaling of publish instance which are in most cases based on Segment/Tar setup and hence not forming a "homegenous" cluster. Each cluster node has separate segment store and only potentially shares the DataStore > B) There are separate versions of that property stored in Mongo (perhaps > this is what you meant by the word revision) and it's possible for a > sling-instance to be reading an old version of a property from Mongo. Thats bit closer to whats happening. [1] talks about the data model being used for persistence in Mongo/RDB. For example if there is a property 'prop' on root node i.e. /@prop then its stored in somewhat following form in Mongo { "_id" : "0:/", "prop" : { "r13fcda91720-0-1" : "\"foo\"", "r13fcda919eb-0-1" : "\"bar\"", } } The value for this property is function of revision at which read operation is performed. So 'prop' value is 'foo' at rev r1 and 'bar' at rev r2. These revisions are based on timestamp. Now each cluster node also has a "head" revision. So any read call on that cluster node would only see those values whose revision are <= '"head" revision. This head revision is updated periodically via background read. Due to this snapshot isolation model you see the write skew [2] Chetan Mehrotra [1] https://jackrabbit.apache.org/oak/docs/nodestore/documentmk.html [2] https://jackrabbit.apache.org/oak/docs/architecture/transactional-model.html
Re: Not-sticky sessions with Sling?
On Fri, Jan 13, 2017 at 12:20 AM, lancedolan wrote: > In an architecture with > only one Mongo instance, the moment one instance writes to the JCR, another > instance will read the same data and agree consistently. It seems to me that > the JCR state is strongly consistent. No. DocumentNodeStore in each Sling node which are part of cluster would periodically poll the backend root node state revision. If there is any change detected it would update its head revision to match with last seen root node revision from Mongo and then it would generate an external observation event. So any change done on cluster node N1 would be _visible sometime later_ on cluster node N2. So if you create a node on N1 and immediately try to read it on N2 then that read would fail as that change might not be "visible" on other cluster node. So any new session opened on N2 would have its base revision set to current head revision of that cluster node and which may be older than current head revision in Mongo. However the writes would still be consistent. So if you modify same property concurrently from different cluster nodes that one of the write would succeed and other would fail with a conflict. Some details are provided at [1] Chetan Mehrotra [1] https://jackrabbit.apache.org/oak/docs/architecture/transactional-model.html
Re: Not-sticky sessions with Sling?
If you are running a cluster with Sling on Oak/Mongo then sticky sessions would be required due to eventual consistent nature of repository. Changes done on one cluster node would not be immediately visible on other cluster node. Hence to provide a consistent user experience sticky sessions would be required Chetan Mehrotra On Thu, Jan 12, 2017 at 7:34 AM, lancedolan wrote: > The only example code I can find to authenticate to Sling will use the JEE > servlet container's "j_security_check" which then stores the authenticated > session in App Server memory. A load-balancer without sticky-sessions > enabled will cause an unstable experience for users, in which they are > suddenly unauthenticated. > > -Does Sling already offer a mechanism for authenticating without storing > that JCR session in Servlet Container Session? > -Do any of you avoid sticky sessions without writing custom code? > > I'm thinking that this problem *must* be solved already. Either there's an > authenticationhandler in Sling that I haven't found yet, or there's an > open-source example that somebody could share with me :) > > If I must write this myself, is this the best place to start? > https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-authenticationhandler.html > https://sling.apache.org/apidocs/sling8/org/apache/sling/auth/core/spi/AuthenticationHandler.html > > ... as usual, thanks guys. I realize I'm really dominating the mail list > lately. I've got a lot to solve :) > > > > > -- > View this message in context: > http://apache-sling.73963.n3.nabble.com/Not-sticky-sessions-with-Sling-tp4069530.html > Sent from the Sling - Users mailing list archive at Nabble.com.
Re: Retrieving content length for file node without retrieving object from S3 backend?
Hi John, This issue is being addressed as part of OAK-4837. With that binary should not get downloaded for just getting the metadata Chetan Mehrotra On Fri, Oct 7, 2016 at 3:00 AM, John Logan wrote: > I forgot, the other Oak modules are at 1.5.7 also. Here is the oak.txt file > for the launchpad. > > > [feature name=oak] > oak.version=1.5.7 > org.apache.jackrabbit/oak-core/${oak.version} > org.apache.jackrabbit/oak-commons/${oak.version} > org.apache.jackrabbit/oak-lucene/${oak.version} > org.apache.jackrabbit/oak-blob/${oak.version} > org.apache.jackrabbit/oak-jcr/${oak.version} > [artifacts startLevel=15 runModes=oak_tar] > org.apache.jackrabbit/oak-segment/${oak.version} > [artifacts startLevel=15 runModes=oak_mongo] > org.apache.sling/org.apache.sling.jcr.oak.server/1.1.0 > > jaas.classname="org.apache.jackrabbit.oak.spi.security.authentication.GuestLoginModule" > > jaas.classname="org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl" > > jaas.classname="org.apache.jackrabbit.oak.security.authentication.token.TokenLoginModule" > jaas.defaultRealmName="jackrabbit.oak" > > org.apache.jackrabbit.oak.security.authentication.AuthenticationConfigurationImpl > org.apache.jackrabbit.oak.authentication.configSpiName="FelixJaasProvider" > org.apache.jackrabbit.oak.security.user.UserConfigurationImpl > org.apache.jackrabbit.oak.security.user.RandomAuthorizableNodeName > > org.apache.jackrabbit.oak.spi.security.user.action.DefaultAuthorizableActionProvider > > enabledActions=["org.apache.jackrabbit.oak.spi.security.user.action.AccessControlAction"] > [configurations runModes=oak_tar] > org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService > [configurations runModes=oak_mongo] > org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService > > > > From: John Logan > Sent: Thursday, October 6, 2016 2:07:17 PM > To: users@sling.apache.org > Subject: Re: Retrieving content length for file node without retrieving > object from S3 backend? > > > Hi Robert, > > > By S3 backend, yes, I mean Oak using the S3SharedDataStore, which I believe > in turn uses the class: > > > org.apache.jackrabbit.oak.blob.cloud.aws.s3.S3Backend.java > > > which appears to encapsulate all of the AWS SDK calls. > > > I am using a copy of the Sling 9 launchpad to create my instance, and have > modified the oak_s3.txt provisioning file as follows. Does this provide you > with the information that you need? > > > [feature name=oak_s3] > > [variables] > oak.version=1.5.7 > > [artifacts startLevel=5] > joda-time/joda-time/2.9.4 > > [artifacts startLevel=15] > com.fasterxml.jackson.core/jackson-core/2.8.2 > com.fasterxml.jackson.core/jackson-databind/2.8.2 > com.fasterxml.jackson.core/jackson-annotations/2.8.2 > > org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri/1.4.5_1 > com.amazonaws/aws-java-sdk-osgi/1.10.27 > org.apache.jackrabbit/oak-blob-cloud/${oak.version} > > > > From: Robert Munteanu > Sent: Thursday, October 6, 2016 2:01:21 PM > To: users@sling.apache.org > Subject: Re: Retrieving content length for file node without retrieving > object from S3 backend? > > Hi Johnm > > On Thu, 2016-10-06 at 18:15 +, John Logan wrote: >> Hi! I have a Sling instance set up using the S3 backend and am >> making a request like this to perform a HEAD operation on a large >> file node: > > What does the S3 backend mean? Oak using the S3DataStore ? It would > also help if we knew the version of Oak you're suing. > > Thanks, > > Robert
Re: Change in log level removes appenders attached to async appender
Thanks for the details. Would try to have a look at the issue soon Chetan Mehrotra On Thu, Jun 2, 2016 at 4:17 PM, piyush goyal wrote: > Hi Chetan, > > Thanks for the response. I tried using the work around you referred to. > Eating up stop() call to didn't work. > Next was to define our own LoggerContextListener and onReseting starting > the appender and adding it to async appender. > This is what I tried to do in the reset method of Listener: > > final ch.qos.logback.classic.Logger ricLogger = > context.getLogger(logger); > AsyncAppender ricAsyncAppender = (AsyncAppender) > ricLogger.getAppender("ricAsyncAppender"); > asyncAppender.addAppender(redisAppender); > > I tried to add redis appender to already existing async appender of my > logger. Well this didnt work either because AsyncAppenderBase class uses a > counter "appenderCount". The problem with this counter is it is only > updated when an appender is added to async appender and never gets reset to > 0 either through detachAppender or stop or any method. > > Now the already existing thread of asyncAppender has the value of > appenderCount as 1 but there was no appender attached to it. And since it > was greater than 0, we can't attach any appender to asyncAppender. :( > > The last alternative was to remove the existing asyncAppender from the > logger. Create a new Async Appender and add that to the logger. Again a new > problem. The existing AsyncAppender was already registered as a service. > And any new appender again has to be registered as a service. So now till > the time I don't unregister the existing appender(Service), my list of > unused services/appenders kept on increasing because everytime a change in > log level means a new appender. > Finally, I was forced to put in a hack with following statements: > > if (asyncAppenderRegistration != null) { > asyncAppenderRegistration.unregister(); > } > > asyncAppenderRegistration = > bundleContext.registerService(Appender.class.getName(), asyncAppender, > serviceRegistrationProps); > > That is unregistering the previously defined async appender as services and > registering new appender as service. > > Hope to see the bug fix soon. > > Thanks and Regards > Piyush Goyal > > On Wed, Jun 1, 2016 at 5:39 PM, Chetan Mehrotra > > wrote: > > > Looks like a bug in Sling Logback integration. What happens here is that > > > > 1. On initial registration of Appender the AppenderTracker in Sling > Commons > > Log would "start" the appender and attach it to logger > > > > 2. When you change the log level via global config it kinds of reset the > > Logback. In reset it would "stop" the appender and detach it > > > > 3. Post reset Sling Commons Log would again "attach" the appender but > would > > not start it again. > > > > Now for in memory appenders this would not cause issue. But for async > > appender once it is stopped the backing thread is shutdown and as there > is > > no further start the thread does not get started again. > > > > Can you open a bug for this in Sling? > > > > For now you can go for workaround > > > > 1. Implement a LoggerContextListener [1] and have its isResetResistant > > return true > > 2. Register this listener with LoggerContext - You can get that via > casting > > org.slf4j.LoggerFactory.getILoggerFactory() > > 3. Then onReset you start the appender again > > > > Or you eat out the stop call and stop it upon your component > deactivation! > > > > Chetan Mehrotra > > > > [1] > > > > > http://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/LoggerContextListener.html > > > > On Wed, Jun 1, 2016 at 3:49 PM, piyush goyal > > wrote: > > > > > Hi Team, > > > > > > We are trying to writing our custom appenders on top of sling in AEM > and > > > referred to documentation > > > < > > > > > > https://sling.apache.org/documentation/development/logging.html#appenders-as-osgi-services > > > >. > > > We want to send logs of the configured loggers to redis. For this, we > > wrote > > > a custom Redis Appender extending UnsynchronizedAppenderBase which > would > > > just send the logs to redis. This redis appender is wrapped inside an > > async > > > appender which is getting registered as an OSGI service after reading > the > > > redis related configurations from config manager page. Below is a small > &
Re: Change in log level removes appenders attached to async appender
Looks like a bug in Sling Logback integration. What happens here is that 1. On initial registration of Appender the AppenderTracker in Sling Commons Log would "start" the appender and attach it to logger 2. When you change the log level via global config it kinds of reset the Logback. In reset it would "stop" the appender and detach it 3. Post reset Sling Commons Log would again "attach" the appender but would not start it again. Now for in memory appenders this would not cause issue. But for async appender once it is stopped the backing thread is shutdown and as there is no further start the thread does not get started again. Can you open a bug for this in Sling? For now you can go for workaround 1. Implement a LoggerContextListener [1] and have its isResetResistant return true 2. Register this listener with LoggerContext - You can get that via casting org.slf4j.LoggerFactory.getILoggerFactory() 3. Then onReset you start the appender again Or you eat out the stop call and stop it upon your component deactivation! Chetan Mehrotra [1] http://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/LoggerContextListener.html On Wed, Jun 1, 2016 at 3:49 PM, piyush goyal wrote: > Hi Team, > > We are trying to writing our custom appenders on top of sling in AEM and > referred to documentation > < > https://sling.apache.org/documentation/development/logging.html#appenders-as-osgi-services > >. > We want to send logs of the configured loggers to redis. For this, we wrote > a custom Redis Appender extending UnsynchronizedAppenderBase which would > just send the logs to redis. This redis appender is wrapped inside an async > appender which is getting registered as an OSGI service after reading the > redis related configurations from config manager page. Below is a small > snapshot of the custom code: > >redisAppender = new RedisAppender(host, port, redisList); > asyncAppender = new AsyncAppender(); > asyncAppender.setName("ASYNC"); > asyncAppender.setDiscardingThreshold(0); > asyncAppender.addAppender(this.redisAppender); > > Dictionary asyncProps = new Hashtable Object>(); > > String[] loggers = { > "com.foo.base" > }; > > asyncAppenderRegistration = > bundleContext.registerService(Appender.class.getName(), asyncAppender, > asyncProps); > > > As soon as the async appender is registered as a service, we can see our > logs reaching the redis instance. Since no logging level is defined for the > logger, it inherits from the ROOT logger which is by default INFO. The > problem comes when we try to change the log level of ROOT logger. We saw > that when we change the log level, logbackManager class is called and a > context reset method is executed. After this process, although Async > Appender is still linked to the defined loggers, but async appender looses > the redis appender attached to it. > > I tried doing the same process with config fragment as well, but everytime > a change in log level causes redis appender to be detached from the async > appender. I even tried creating factory.config so that I can directly > change the logger level of the my logger and not inheriting it from ROOT > level. But here also async appender detaches the redis appender attached to > it. > > What could be the reason behind it? And what should be the correct approach > to be taken so that after changing the log level, async appender does not > detach redis appender. > > Thanks and Regards > Piyush Goyal >
[ANN] Apache Sling Log Tracer version 1.0.0 Released
The Apache Sling team is pleased to announce the release of Apache Sling Log Tracer version 1.0.0 Apache Sling is a web framework that uses a Java Content Repository, such as Apache Jackrabbit, to store and manage content. Sling applications use either scripts or Java servlets, selected based on simple name conventions, to process HTTP requests in a RESTful way. Log Tracer provides support for enabling the logs for specific category at specific level and only for specific request. It provides a very fine level of control via config provided as part of HTTP request around how the logging should be performed for given category. https://sling.apache.org/documentation/bundles/log-tracers.html This release is available from http://sling.apache.org/site/downloads.cgi Building from verified sources is recommended, but convenience binaries are also available via Maven: org.apache.sling org.apache.sling.tracer 1.0.0 Release Notes: New feature being introduced with this release is around Tracer Recording [1] which allows retrieving all collected trace data for a given request in json format for further analysis ** New Feature * [SLING-5459] - Recording of tracer logs ** Sub-task * [SLING-5504] - Reduce memory footprint of stored recording data * [SLING-5505] - Allow recording of caller stacktrace with the logs * [SLING-5507] - Collect more details around query execution Enjoy! -The Sling team [1] https://sling.apache.org/documentation/bundles/log-tracers.html#tracer-recording
Re: Out of memory during query
> select * from [nt:base] where uploadToImageManagerFlag = true Logically this query should not consume much memory (no order by also). Given that its JR 1.0 (per comments above Jackrabbit 1.0, not Oak) cannot say much on how it works and how to get it perform better. Have you analyed heap dump to see what all is being held up? Chetan Mehrotra On Sat, Mar 26, 2016 at 2:47 AM, Jason Bailey wrote: > I don't think you'll find that specific answer on this list. > > From a practical point of view. I had to create a service that provided a > report on all the pages in our system that we considered an active page. > > That would be iterating through ~400k pages across 70 sites and checking > several properties on each page. To minimize the memory consumption, each > time I would find a matching node, I would write the path out to the response > object and not actually keep the node reference in memory. > > That process, running on our hardware, would spit 370k results in just over a > minute. > > The best we could ever get it to run in jackrabbit with a query was 10 > minutes. > > > -Original Message- > From: Roll, Kevin [mailto:kevin-r...@idexx.com] > Sent: Friday, March 25, 2016 4:51 PM > To: users@sling.apache.org > Subject: RE: Out of memory during query > > A practical question on #3... I'm trying it and it seems to work well. Let's > say I do this: > > final Session session = resourceResolver.adaptTo(Session.class); > final Node rootNode = session.getRootNode(); > > ...and then start recursively traversing all of the nodes. Is there anything > in the Session that will accumulate the nodes I traverse? Or, will they be > reclaimable as soon as I am finished with them? Again, I am extremely > paranoid about memory usage and I cannot have an out-of-memory condition. > > > -Original Message- > From: Jason Bailey [mailto:jason.bai...@sas.com] > Sent: Friday, March 25, 2016 1:01 PM > To: users@sling.apache.org > Subject: RE: Out of memory during query > > A couple of observations. > > 3. Queries are generally slow. In the most counter intuitive experience I've > ever had. We've discovered it is far faster to manually descend through the > resources and identify the items that you are searching for than any query > we've created.
Re: How to reindex lucene
Thanks Julian for jumping in! OAK-3504 is different. So far we have not seen such corruption reported on Segment @Roy - Would be helpful if you can get a support case opened so that we can get handle to repository content (if possible) which would allow us to investigate better Chetan Mehrotra On Wed, Jan 6, 2016 at 5:48 PM, Julian Sedding wrote: > I missed the last two messages. The issue mentioned is fixed in 1.0.23 > (you are running 10.0.22). Since Chetan fixed it he may know much > better than I do if you may be observing the same issue ;) > > Regards > Julian > > On Wed, Jan 6, 2016 at 1:15 PM, Julian Sedding wrote: >> Hi Roy >> >> The issue you observe may be >> https://issues.apache.org/jira/browse/OAK-3504. I don't know which Oak >> version you are running, compare to the issue's fix version. If you >> are running a "fixed" version, please report the issue on the Oak >> list. Thanks. >> >> Regards >> Julian >> >> >> On Wed, Jan 6, 2016 at 12:58 PM, Roy Teeuwen wrote: >>> Hey Julian, >>> >>> I indeed already took this action, it just recreated the index folder but >>> the error messages keep coming. >>> >>> The only way to “solve" it is by temporary disabling the oak-lucene bundle >>> so that I can access the JCR Explorer with decent performance, set the >>> reindex property for oak:index/lucene on true and then restart the >>> oak-lucene bundle. During the recreation of the Lucene index you still see >>> the exceptions being thrown in the error log but from the moment it >>> finishes the reindexing the error messages disappear. >>> >>> Shall I put this on the mailing list for Jackrabbit oak? >>> >>> Thanks! >>> Roy >>> >>>> On 06 Jan 2016, at 12:47, Julian Sedding wrote: >>>> >>>> Hi Roy >>>> >>>> This relates more to Jackrabbit Oak then to Sling, so you might get >>>> better assistance there. >>>> >>>> The Lucene-Index implementation in Oak copies the index data from the >>>> repository to the local file system as an I/O optimization. Therefore >>>> the files on the file system are redundant. >>>> >>>> You can try the following: >>>> - shut down your Sling instance >>>> - delete /opt/aem_author/crx-quickstart/repository/index >>>> - start your Sling instance >>>> >>>> If all goes as expected, you will see that the folder >>>> /opt/aem_author/crx-quickstart/repository/index is recreated and the >>>> log messages disappear. If this is not the case, please report back >>>> with your observations. >>>> >>>> Hope this helps. >>>> >>>> Regards >>>> Julian >>>> >>>> >>>> On Wed, Jan 6, 2016 at 10:14 AM, Roy Teeuwen wrote: >>>>> I am having a problem with my lucene index, it is throwing the exception >>>>> shown in the logs below. Last time I got this solved by setting the >>>>> reindex >>>>> property on true for the oak:index/lucene but now my system is so slow >>>>> because it throws the exception so many times per second that I can't even >>>>> get into the explorer to set the property on true. Is there a way to let >>>>> my >>>>> lucene index reindex by changing a property on the filesystem? Or is >>>>> there a >>>>> fix for this exception because reindexing every time also doesn't seem to >>>>> be >>>>> a correct way of handling this. >>>>> >>>>> 06.01.2016 09:55:16.310 *WARN* [oak-lucene-0] >>>>> org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier >>>>> [/oak:index/lucene] Error occurred while copying file [segments_1rt] from >>>>> Directory for /oak:index/lucene to >>>>> MMapDirectory@/opt/aem_author/crx-quickstart/repository/index/e5a943cdec3000bd8ce54924fd2070ab5d1d35b9ecf530963a3583d43bf28293/2 >>>>> lockFactory=NativeFSLockFactory@/opt/aem_author/crx-quickstart/repository/index/e5a943cdec3000bd8ce54924fd2070ab5d1d35b9ecf530963a3583d43bf28293/2 >>>>> java.io.FileNotFoundException: segments_1rt >>>>>at >>>>> org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory.openInput(OakDirectory.java:133) >>>>>at org.apache.lucene.store.Directory.copy(Directory.java:
Re: How to reindex lucene
On Wed, Jan 6, 2016 at 5:28 PM, Roy Teeuwen wrote: > Shall I put this on the mailing list for Jackrabbit oak? That would be better. Given the issue is being seen on AEM instance it might also be better to go for AEM Support so that we can get more data easily. btw is it on SegmentMK or Mongo? And whats the Oak version in use here? Chetan Mehrotra
Re: Sling retrieving out-of-date data
On Wed, Dec 2, 2015 at 7:10 PM, H K wrote: > but is there a way to use the same Node Store when connecting through an Oak > application? NodeStore is an in vm manifestation. Before going further wanted to understand your usecase and flow. The code which connects using Oak is that to be run outside of Sling or you can have a customer servlet in Sling which you can invoke from outside > Furthermore, as for connecting over RMI: the reason why I abandoned that > cause was because unlike in Sling 7 Not sure on that part but may be you can try DavEx based remoting [1]. I believe that should work Chetan Mehrotra [1] http://wiki.apache.org/jackrabbit/RemoteAccess#DavEx
Re: Sling retrieving out-of-date data
On Wed, Dec 2, 2015 at 4:13 PM, Oliver Lietz wrote: > Thanks, Chetan. Is it really the _new Oak_ or the new NodeStore which sets up > a cluster? Its new NodeStore > The Oak documentation for clustering could be more expressive... Yes docs are not upto the mark. Would try to find some time and update them Chetan Mehrotra
Re: Sling retrieving out-of-date data
On Wed, Dec 2, 2015 at 2:20 PM, Oliver Lietz wrote: > but this is not the case for a single node, right? And I assume a non-cluster > setup as H K didn't mention it. Code that HK mentioned above // REST service createChildFolder running on localhost:8040 public void createChildFolder(String parentPath, String childName) { DB database = new MongoClient("127.0.0.1", 27017).getDB("sling"); DocumentNodeStore store = new DocumentMK.Builder().setMongoDB(database).getNodeStore(); Repository repo = new Jcr(new Oak(store)).createRepository(); SimpleCredentials creds = new SimpleCredentials("admin", "admin".toCharArray()); Session session = (javax.jcr.Session) repository.login(creds); Node parent = session.getRootNode().getNode(parentPath); Node child = parent.addNode(childName, "sling:Folder"); session.save(); session.logout(); store.dispose(); } It technically creates a new Oak instances and thus you have a cluster! Had he connected to Sling using Remoting and not via Oak then it would be a single node case Chetan Mehrotra
Re: Sling retrieving out-of-date data
On Tue, Dec 1, 2015 at 10:07 PM, H K wrote: > My problem is that when I write data to the repository through my > application, Sling does not seem to get it fast enough, which may be because > it is caching or because it only periodically checks to see if the data it > has is up-to-date or not What you are observing here is the result of eventual consistency model of Oak which is a MVCC based store [1]. When using DocumentNodeStore (used for Mongo) each cluster node periodically polls the backend for change in root node and then updates its head revision to make those changes visible to current cluster node. So change done by one cluster not would not be immediately *visible* on other cluster nodes. > This was not a problem using Sling 7 with Jackrabbit (instead of Oak) and > connecting over RMI. That was because there you were not using a cluster. You were connecting to the JR running within Sling using RMI. So it was a single node setup. If you use RMI now also and connect to same Sling node then it would work as expected. Chetan Mehrotra [1] http://jackrabbit.apache.org/oak/docs/architecture/nodestate.html
Re: Remotely configuring a bundle
On Wed, Sep 30, 2015 at 8:48 PM, Roll, Kevin wrote: > Is this documented anywhere? Its partially documented at http://felix.apache.org/documentation/subprojects/apache-felix-web-console/web-console-restful-api.html#configuration-admin-plugin Chetan Mehrotra
Re: quick way to see all service user mappings?
Try looking to /system/console/status-Configurations which dumps all the configs on one page Chetan Mehrotra On Thu, Aug 6, 2015 at 4:02 PM, Nicolas Peltier wrote: > Hi, > > right now when i want to see which user is tied to such service for > monitoring purpose, i need to go to felix console, and check one by one the > 49 (on my local aem 6.1 instance) lines labelled [0] in configuration manager… > is there another way i’m not aware of? > > Nicolas > > [0] > org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended.17455344-de8d-43ff-b1ff-94e6abfcf600
Re: Logging relative to a specific path
> sling.log.root = ${sling.home} +1. This would also allows using Sling Logging in non Sling Container easily Chetan Mehrotra On Fri, Nov 28, 2014 at 7:33 PM, Felix Meschberger wrote: > Hi > > How about a sling.log.root property, which we define as > >> sling.log.root = ${sling.home} > > in the sling.properties ? > > Regards > Felix > >> Am 28.11.2014 um 11:16 schrieb Jörg Hoh : >> >> Hi Felix, >> >> I would like to stick to OSGI-based configuration and rather no use any >> logback configuration file. I will then try to come up with a patch. Thanks >> for your help. >> >> regards, >> Jörg >> >> 2014-11-28 7:50 GMT+01:00 Felix Meschberger : >> >>> Hi >>> >>> It used to be that the Sling SLF4J implementation had the code to resolve >>> relative paths against sling.home and that was not configurable. >>> >>> In the meantime we switched over to embedding Logback instead. Looks like >>> this is still part of the logging configuration. See LogConfigManager which >>> uses sling.home as the root directory handed over to the >>> LogWriterManagedServiceFactory for OSGi-based logging configuration. >>> >>> On the other hand Logback configuration files are supported as well these >>> days and I am not really sure how relative paths are handled there. >>> >>> Regards >>> Felix >>> >>>> Am 27.11.2014 um 23:07 schrieb Jörg Hoh : >>>> >>>> Hi, >>>> >>>> I am just evaluating if it's possible to specifiy a directory, which is >>>> used to resolve all relative log file against. The documentation states, >>> it >>>> always resolves against the "sling.home" directory, but can I change >>> this? >>>> I haven't found any pointer neither in the source nor on the >>> documentation >>>> page. >>>> >>>> >>>> kind regards && thanks, >>>> Jörg >>> >>> >> >> >> -- >> Cheers, >> Jörg Hoh, >> >> http://cqdump.wordpress.com >> Twitter: @joerghoh >
Re: OSGi Config Admin Files in Sling Launchpad
You can do that via Sling File Install Provider which provide features similar to Felix FileInstall * Specify a system property (or framework property) 'sling.fileinstall.dir' to point to directory where you would place your config file * Place your file to install folder and it would be pickedup and deployed (.cfg or even bundles). Removing them would cause them to be removed Chetan Mehrotra On Mon, Jul 14, 2014 at 11:56 PM, David Bosschaert wrote: > Thanks Chetan, > > Sorry, I didn't mention this. I do not want to modify the launchpad > jar file. So I would rather copy these files to a directory that is > available at runtime (I presume somewhere under the sling/ directory > that is created when starting up). > > I tried copying them to sling/config/foo/bar/Something.config but that > didn't work... > > Thanks, > > David > > On 14 July 2014 19:19, Chetan Mehrotra wrote: >> Trying placing the cfg files in >> https://github.com/apache/sling/tree/trunk/launchpad/builder/src/main/config >> folder and Launchpad plugin should package them as part of launchpad >> jar >> Chetan Mehrotra >> >> >> On Mon, Jul 14, 2014 at 11:33 PM, David Bosschaert >> wrote: >>> Hi all, >>> >>> I was wondering how I can provide configuration files for OSGi config >>> admin using the default Sling standalone Launchpad. >>> So basically I would like to copy some file to some place when the >>> launchpad is running to set some OSGi Config Admin configuration >>> dynamically. >>> >>> This is basically what the Felix File install allows you to do with >>> .cfg files. Is there something like this available in what you get >>> with the launchpad? >>> >>> Thanks, >>> >>> David
Re: OSGi Config Admin Files in Sling Launchpad
Trying placing the cfg files in https://github.com/apache/sling/tree/trunk/launchpad/builder/src/main/config folder and Launchpad plugin should package them as part of launchpad jar Chetan Mehrotra On Mon, Jul 14, 2014 at 11:33 PM, David Bosschaert wrote: > Hi all, > > I was wondering how I can provide configuration files for OSGi config > admin using the default Sling standalone Launchpad. > So basically I would like to copy some file to some place when the > launchpad is running to set some OSGi Config Admin configuration > dynamically. > > This is basically what the Felix File install allows you to do with > .cfg files. Is there something like this available in what you get > with the launchpad? > > Thanks, > > David
Re: Extending default PostOperations
Thanks Justin and Bertrand for reviewing the approach! >That's where the proposed POST pipeline would help Okie. Now I appreciate the requirement. Would keep a watch on that Chetan Mehrotra On Tue, Mar 25, 2014 at 5:52 PM, Bertrand Delacretaz wrote: > Hi Chetan, > > On Mon, Mar 24, 2014 at 12:19 PM, Chetan Mehrotra > wrote: >> ...For now I am dong this by >> 1. Defining a custom operation 'my_modify' >> 2. Implement a custom org.apache.sling.servlets.post.PostOperation >> 3. Internall in custom PostOperation [2] I do my pre processing and then >>use a Service reference of default ModifyOperation >>(sling.post.operation=modify) and delegate to that >> 4. The client would now use ':my_operation' as part of POST form data... > > This looks good to me, I don't think you can do better to implement > pre-processing with the current POST servlet. That's where the > proposed POST pipeline would help, but I don't think anyone is working > on that right now. > > -Bertrand
Re: Extending default PostOperations
Any feedback on the proposed approach below? Chetan Mehrotra On Mon, Mar 24, 2014 at 4:49 PM, Chetan Mehrotra wrote: > Hi, > > At times we have a requirement to extend the logic of Sling Post > Servlet and do some pre-processing and then continue with the default > behavior of PostServlet. > > For example if the POST request is modifying some content and we need > to change the ACL for the target path before that content gets created > I need a way to enhance the default logic in ModifyOperation > > For now I am dong this by > 1. Defining a custom operation 'my_modify' > 2. Implement a custom org.apache.sling.servlets.post.PostOperation > 3. Internall in custom PostOperation [2] I do my pre processing and then >use a Service reference of default ModifyOperation >(sling.post.operation=modify) and delegate to that > 4. The client would now use ':my_operation' as part of POST form data > > So wanted to confirm if above approach is fine or it would cause issues? > > Chetan Mehrotra
Extending default PostOperations
Hi, At times we have a requirement to extend the logic of Sling Post Servlet and do some pre-processing and then continue with the default behavior of PostServlet. For example if the POST request is modifying some content and we need to change the ACL for the target path before that content gets created I need a way to enhance the default logic in ModifyOperation For now I am dong this by 1. Defining a custom operation 'my_modify' 2. Implement a custom org.apache.sling.servlets.post.PostOperation 3. Internall in custom PostOperation [2] I do my pre processing and then use a Service reference of default ModifyOperation (sling.post.operation=modify) and delegate to that 4. The client would now use ':my_operation' as part of POST form data So wanted to confirm if above approach is fine or it would cause issues? Chetan Mehrotra
[ANN] Apache Sling Commons Log version 4.0.0 Released
The Apache Sling team is pleased to announce the release of Apache Sling Commons Log version 4.0.0 Apache Sling is a web framework that uses a Java Content Repository, such as Apache Jackrabbit, to store and manage content. Sling applications use either scripts or Java servlets, selected based on simple name conventions, to process HTTP requests in a RESTful way. Sling Commons Log bundle provides logging support based on Logback in OSGi env. Apart from default Logback feature set it enables extending Logback via OSGi constructs http://sling.apache.org/documentation/development/logging.html This release is available from http://sling.apache.org/site/downloads.cgi and Maven: org.apache.sling org.apache.sling.commons.log 4.0.0 Release Notes: Release Notes - Sling - Version Commons Log 4.0.0 ** Bug * [SLING-3037] - IllegalArgumentException in logback Logger * [SLING-3045] - [logback]Warning logs logged for 'No appenders present in context [sling] for logger' * [SLING-3047] - Log message from other loggers get added to error.log * [SLING-3069] - Allow attaching an Appender to a Logger without changing its existing Log level * [SLING-3185] - ClassCastException in o.a.s.commons.log's LogbackManager at bundle activation * [SLING-3189] - LogbackManager causes lockup on second startup * [SLING-3258] - [regression] Sling log support webconsole no longer links to logger configurations * [SLING-3344] - log bundle is too conservative in exporting logback * [SLING-3364] - All rotated log files are not made part of the zip provided through webconsole ** Improvement * [SLING-2024] - Replace file logger with logback * [SLING-2897] - [LOG] Enhance web console plugin with edit feature * [SLING-3242] - Allow refering to OSGi appenders from within Logback config * [SLING-3251] - Enable Logback ChangeLevelDispatcher by default if JUL Integration is enabled * [SLING-3257] - Make logback packaging data in stacktraces configurable * [SLING-3275] - Add Buffered Logging Configuration in "Apache Sling Logging Logger" * [SLING-3363] - Make Logback status part of Configuration Printer output * [SLING-3410] - Log the Logback initialization related logs to normal log for transient errors * [SLING-3411] - Enable configuring the maxCallerDataDepth in Logback LoggerContext ** New Feature * [SLING-2588] - Add support for slf4j MDC in log message * [SLING-3060] - Enable Logback to use OSGi services for Filters and TurboFilters ** Task * [SLING-3252] - Remove checked in Logback related classes before 4.x release Enjoy! -The Sling team
Re: Multiple Dynamic service references and service.ranking
Also have a look at [1] which maintains a map of services in sorted order. Chetan Mehrotra [1] https://gist.github.com/chetanmeh/3918574 On Tue, Nov 26, 2013 at 12:03 PM, Sean Steimer wrote: > Bertrand, > > Thanks for the reply. I'm interested to look into the ServiceTracker, as > that's not a concept I was previously aware of. > > I decided to just add a getServiceRanking() method to my interface and sort > based on that value in my bind method. I'm not sure that's the most > elegant solution since there's no guarantee (other than interface as > contract) that implementations will actually return their service ranking > from that method, but it will certainly work in this case since I have > control over the interface & implementations. > > --Sean > > > On Mon, Nov 25, 2013 at 10:16 PM, Bertrand Delacretaz < > bdelacre...@apache.org> wrote: > >> Hi, >> >> On Tuesday, November 26, 2013, Sean Steimer wrote: >> >> > ...Is there a way to force unbind and bind to happen for all Services >> which >> > implement MyServiceInterface anytime a single instance changes?... >> >> I don't think so. >> >> > ...Alternatively, is there a good way to retrieve the service.ranking >> value >> > from my bind method, so that I can just sort them there?... >> >> the simplest is to sort the ServiceReference objects, which as per [1] take >> the service ranking into account for comparison. Lowest service ranking >> comes on top after sorting IIRC. >> >> We also have a SortedServiceTracker [2] that does that. >> >> -Bertrand >> >> [1] >> >> http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/ServiceReference.html >> [2] >> >> https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/SortingServiceTracker.java >>
Re: Setting framework property at command line
On Tue, Nov 5, 2013 at 7:36 PM, Felix Meschberger wrote: > This is obviously wrong and must be fixed. Created the issue SLING-3231 [1] for this. For now the patch just creates the key in parseCommandLine like Da1 regards Chetan [1] https://issues.apache.org/jira/browse/SLING-3231 Chetan Mehrotra
Setting framework property at command line
Hi, Looking at Sling Launchpad docs [1] it mentions that one can set framework property via -D n=v pair. I tried passing multiple properties like * -D a1=b1 -D a2=b2 * -Da1=b1 -Da2=b2 In both cases only the last property is set while the others are ignored. is there any other way it should be set? Also looking at the command line parsing logic it appears that it probably does not handle such multiple properties [2] that well. So wanted to confirm if anyone has been able to pass multiple framework property via command line Chetan Mehrotra [1] http://sling.apache.org/documentation/the-sling-engine/the-sling-launchpad.html [2] https://github.com/apache/sling/blob/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java#L121
Features required in Sling Commons Log
Hi, Recently we modified the Sling Commons Log to use Logback (SLING-2024). Along with this change many new features were added (more details at [1]) * Compatible with existing Sling Commons Log * LogBack configuration can be provided via Logback config xml * ConfigurationAdmin integration - Logback Config can be enhanced via config obtained from OSGi configuration admin * Supports Appenders registered as OSGi Services * Supports Filters and TurboFilters registered as OSGi Services * Sling FIlter to expose various request properties as part of MDC (SLING-3048) * Support providing Logback config as fragments through OSGi Service Registry * Feature rich WebConsole Plugin and Configuration Printer support With all these features its now possible to obtain precise logs and simplify debugging process in a running Sling server. As of now most of the planned feature work in this area is done. Would like to know if Sling users require any other feature to be added to the Log component. Any suggestion or feedback are welcome!! Chetan Mehrotra [1] https://github.com/chetanmeh/sling-logback
Re: JcrResourceListener : this.resourceResolver.adaptTo(Session.class) is null
Done https://issues.apache.org/jira/browse/SLING-2573 Chetan Mehrotra
Re: JcrResourceListener : this.resourceResolver.adaptTo(Session.class) is null
I am also facing the same issue where JcrResourceListener activate is failing with a NPE. On debugging it appears that session instance returned is null. Which happens because 'requiredFactories' in RootResourceProviderEntry.loginToRequiredFactories [1] empty. This is probably happening because of a startup order. ResourceResolverFactoryImpl which is responsible for setting the requiredFactories in RootResourceProviderEntry has an Optional, Multiple dependency on ResourceProviderFactory. So it can happen that when a ResourceResolverFactory is published in OSGi SR it does not have any reference to ResourceProviderFactory and in that time JcrResourceListener tries to access it. May be the dependency should be set to Required, Multiple to ensure that ResourceResolverFactoryImpl is properly initialized. Chetan Mehrotra [1] org.apache.sling.resourceresolver.impl.tree.RootResourceProviderEntry.loginToRequiredFactories(ResourceResolverContext) On Wed, Aug 22, 2012 at 2:02 AM, Dascalita Dragos wrote: > Hi, > I actually managed to reproduce the error on my local machine as well, by > stopping and starting Apache Sling JCR Resource Resolver > org.apache.sling.jcr.resource< > http://hendrix.local.adobe.com:8080/system/console/bundles/36> > bundle. > > Regards, > Dragos Dascalita Haut > > On Tue, Aug 21, 2012 at 10:59 PM, Dascalita Dragos >wrote: > > > Hello, > > I'm trying to understand the cause of the error in the title.My Sling > > version is built from Rev. 1375551, but this error was happening > > previously. It's not happening when running Sling in my local machine, > but > > it's happening when I'm running it on a Cent OS 6.2 machine, with java > > version: > > > > java version "1.6.0_22" , OpenJDK Runtime Environment (IcedTea6 1.10.6) > > (rhel-1.25.1.10.6.el5_8-x86_64) , OpenJDK 64-Bit Server VM (build > 20.0-b11, > > mixed mode) > > > > > > *ERROR* [FelixStartLevel] org.apache.sling.jcr.resource > > [org.apache.sling.jcr.resource.internal.JcrResourceListener] The activate > > method has thrown an exception (java.lang.NullPointerException) > > java.lang.NullPointerException > > > > at > > > org.apache.sling.jcr.resource.internal.JcrResourceListener.activate(JcrResourceListener.java:133) > > > > The code goes into ResourceResolverImpl.getSession(). > this.factory.getRootProviderEntry().adaptTo(this.context, > > Session.class); returns a null session. > > > > It seems like final Iterator i = > > this.adaptableProviders.getProviders(ctx, null); (within > > RootResourceProviderEntry.java class) returns an empty list, and > > therefore the result is null, causing the session in JcrResourceListener > to > > be null and then the NPE. > > > > I'm trying to understand how come SortedProvidersList.getProviders() is > > empty and if providers can be configured, or what can I do to workaround > > this issue. > > > > > > Thanks for your help, > > > > Dragos Dascalita Haut > > > > > > > > > > > > > > > > >
Re: Launching Sling standalone in exploded format
This looks promising!!. So to confirm - I need to package file installer bundle explicitly at boot level. Or I just need to pass on the directory path via system property as Bertrand suggested - When the installer merges the two list what constitutes as a latest version. Does it compares the timestamp (as both are snapshots) Chetan Mehrotra On Mon, Aug 20, 2012 at 2:18 PM, Carsten Ziegeler wrote: > Hi, > > if you're using the Sling launchpad, then all the bundles are > installed by launchpad and not the OSGi installer. > We(=Adobe)'re using this configuration for the launchpad plugin instead: > install > bundles > Now only bundles marked as boot level bundles are installed by > launchpad, everything else is installed by the OSGi installer. Of > course this requires the OSGi installer and some other bundles to be > in the boot level. If you now put the file installer bundle there as > well and point it to a directory like Bertrand suggested, the OSGi > installer will get two bundles lists, one from the launchpad and one > from the file installer, merges it and installs the latest versions. > > Carsten > > 2012/8/20 Chetan Mehrotra : > > Hi Bertrand, > > > > In current setup the bundles I am working are related to Oak and I need > to > > start the system from a clean state to validate some changes. So the > > updated bundles has to be picked up at the first launch itself. > > > > The method you suggest works fine for already running system or restarts > > but for fresh install I need a way to update the existing bundle present > in > > the standalone jar/resources/install folder. > > > > Chetan Mehrotra > > > > > > On Mon, Aug 20, 2012 at 1:40 PM, Bertrand Delacretaz < > bdelacre...@apache.org > >> wrote: > > > >> Hi Chetan, > >> > >> On Mon, Aug 20, 2012 at 7:31 AM, Chetan Mehrotra > >> wrote: > >> ... > >> > 4. Update certain bundles in resources/install folder based on #2. For > >> this > >> > install them in Maven first > >> > 5. Clean existing sling home directory > >> > 6. Repackage Sling standalone so that updated bundle from #4 gets > picked > >> up... > >> > >> Can't you just copy your new/modified bundles to an install folder on > >> the filesystem, that's picked up by the file installer? > >> > >> You can specify the name of that folder with > >> -Dsling.fileinstall.dir=/path-to-that-folder on the JVM command line. > >> > >> You could also install them directly via the OSGi console or the > >> maven-sling-plugin. > >> > >> -Bertrand > >> > > > > -- > Carsten Ziegeler > cziege...@apache.org >
Re: Launching Sling standalone in exploded format
Hi Bertrand, In current setup the bundles I am working are related to Oak and I need to start the system from a clean state to validate some changes. So the updated bundles has to be picked up at the first launch itself. The method you suggest works fine for already running system or restarts but for fresh install I need a way to update the existing bundle present in the standalone jar/resources/install folder. Chetan Mehrotra On Mon, Aug 20, 2012 at 1:40 PM, Bertrand Delacretaz wrote: > Hi Chetan, > > On Mon, Aug 20, 2012 at 7:31 AM, Chetan Mehrotra > wrote: > ... > > 4. Update certain bundles in resources/install folder based on #2. For > this > > install them in Maven first > > 5. Clean existing sling home directory > > 6. Repackage Sling standalone so that updated bundle from #4 gets picked > up... > > Can't you just copy your new/modified bundles to an install folder on > the filesystem, that's picked up by the file installer? > > You can specify the name of that folder with > -Dsling.fileinstall.dir=/path-to-that-folder on the JVM command line. > > You could also install them directly via the OSGi console or the > maven-sling-plugin. > > -Bertrand >
Launching Sling standalone in exploded format
For some work I have to frequently launch Sling standalone jar with clean start. The development flow is like 1. Start sling 2. Debug startup logic and initial installation 3. Shutdown 4. Update certain bundles in resources/install folder based on #2. For this install them in Maven first 5. Clean existing sling home directory 6. Repackage Sling standalone so that updated bundle from #4 gets picked up 7. Use the newly created standalone jar In this flow step #6 takes some time (~30-40 sec). To reduce the turnaround time I would like to run the standalone jar in exploded format. So that I can bypass #6 and just update the jar in install folder directly. I tried to run Sling by exploding the standalone jar and explicitly passing Main class in startup. However this does not work as it uses ClassloaderResourceProvider and in that getChilderen() does not work. Is there any other way I can simplify my development workflow such that I can bypass repackaging step #6? Otherwise I was thinking to modify the MainDelgate to uses some sort FilesystemResourceProvider depending on startup mode. Any thoughts/suggestions!! Chetan Mehrotra
Re: Unit Test Problem in OsgiConsoleTest class
You can specify server ready timeout via 'server.ready.timeout.seconds' system property. Then you do not have to perform sleep in your logic and Sling Testing fwk would take care of that Chetan Mehrotra On Sun, Aug 5, 2012 at 2:18 PM, Bhathiya Jayasekara wrote: > Hi all, > > When I run OsgiConsoleTest class as a junit test (in eclipse), I get > this[1] error. But when I add LINE_X in [2], it works fine. Is there any > known reason for this? I would like to know if there is any way to get this > work without having a Thread.sleep(..). > > Thanks in advance. > > Regards, > --Bhathiya > > > [1] > 05.08.2012 14:11:03.299 *INFO* [main] Setting sling.home=sling (default) > 05.08.2012 14:11:03.301 *INFO* [main] Starting Sling in sling > (/home/bhathiya/Apps/Sling/sling/testing/samples/integration-tests/sling) > 05.08.2012 14:11:03.313 *INFO* [main] Checking launcher JAR in folder sling > 05.08.2012 14:11:03.341 *INFO* [main] Existing launcher is up to date, > using it: 2.3.0 (org.apache.sling.launchpad.base.jar) > 05.08.2012 14:11:03.361 *INFO* [main] Loading launcher class > org.apache.sling.launchpad.base.app.MainDelegate from > org.apache.sling.launchpad.base.jar > 05.08.2012 14:11:03.386 *INFO* [main] Starting launcher ... > 05.08.2012 14:11:03.393 *INFO* [main] HTTP server port: 8080 > org.apache.http.conn.HttpHostConnectException: Connection to > http://localhost:8080 refused > at > > org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158) > at > > org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149) > at > > org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121) > at > > org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:562) > at > > org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415) > at > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820) > at > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754) > at > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732) > at > > org.apache.sling.testing.tools.http.RequestExecutor.execute(RequestExecutor.java:131) > at > > org.apache.sling.testing.samples.integrationtests.http.OsgiConsoleTest.testSomeConsolePaths(OsgiConsoleTest.java:46) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) > at > > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) > at > > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) > at > > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) > at > > org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) > at > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) > at org.junit.runners.ParentRunner.run(ParentRunner.java:236) > at > > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) > at > > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) > Caused by: java.net.ConnectException: Connection refused > at java.net.PlainSocketImpl.socketConnect(Native Method) > at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) > at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) >
Re: 500, Denied Access denied - for post from JAVA
The 500 error is coming because HttpClient does not send the username/pwd by default. Use preemptive authentication by adding following line to your code httpClient.getParams().setAuthenticationPreemptive(true); This would send u/p by default in first call itself and you should get 201 response Chetan Mehrotra On Wed, Jul 11, 2012 at 5:45 AM, André Basse wrote: > Hi all, > > I have some trouble with my Java post request. Sling issues a 500 > error when I try to post my JPG to /images. > > I can find following line in the log file in Sling: > 11.07.2012 10:09:54.604 *ERROR* [127.0.0.1 [1341965394583] POST > /images/tubu2.jpg HTTP/1.1] > org.apache.sling.servlets.post.impl.operations.ModifyOperation Access > Denied Access denied. > > Below is my Java code. Any help is much appreciated. > > > public static void main(String[] args) throws HttpException, IOException { > >Credentials credentials = new > UsernamePasswordCredentials("admin", "admin"); >HttpClient httpClient = new HttpClient(); >httpClient.getState().setCredentials(AuthScope.ANY, > credentials); > >String url = "http://localhost:8080/images/tubu2.jpg";; >String fieldName = "./"; >File localFile = new File("C:/temp/test.jpg"); >String typeHint = "nt:file"; > >final Part[] parts = new Part[typeHint == null ? 1 : 2]; >parts[0] = new FilePart(fieldName, localFile); >if (typeHint != null) { >parts[1] = new StringPart(fieldName + "@TypeHint", typeHint); >} > >final PostMethod post = new PostMethod(url); >post.setFollowRedirects(false); >post.setRequestEntity(new MultipartRequestEntity(parts, > post.getParams())); >final int status = httpClient.executeMethod(post); > >System.out.println(Integer.toString(status)); > > } > > } > > > > Thanks, > > Andre >
Re: currentResource in OSGi
> aarghh ;-) I knew it is coming :) I understand that threadlocals are dangerous but they do have there uses in infrastructure components like in Security context , Transaction context propagation. Couple of examples where I feel they help 1. I had to implement a Client SDK for a remote server in Sling. The usecase involved flow like Http Request -> Sling Servlet -> OSGi Service Proxy -> Outpbound RPC call over Web Service. In such a scenario I had pass in the invoking user identity. For this I need to access the ResourceResolver associated with current thread and extract the user identity from the associated JCR session 2. Using RequestprogressTracker as poor man profiler - I like the RequestProgressTracker feature of Sling and would like to use it to capture time taken in some of the lower layers of my system. For example in scenario mentioned earlier I would like to keep a log of the time taken for the remote RPC call however that layer does not have access to request instance Probably the usecases I have dealt with might not be generic but having the current request's ResourceResolver available via ThreadLocal helps in write some infrastructure components!! Chetan Mehrotra On Mon, May 14, 2012 at 7:37 PM, Bertrand Delacretaz wrote: > On Mon, May 14, 2012 at 2:55 PM, Chetan Mehrotra > wrote: > > ...It would be helpful if we can expose the current > SlingHttpServletRequest or > > ResourceResolver via a threadlocal... > > aarghh ;-) > > > ..This would simplify code where we need > > pass the request as method parameters . This can be done via a simple > > FIlter which publishes the request into a thread local and have a new API > > class which makes this request accessible > > This would work, but I would be against including such a filter in the > Sling codebase. > > Passing the request to a method clearly indicates that you expect that > method to deal with it. It's a few more characters to type, but it > makes things clear. > > IMHO, it's too easy to create a mess with threadlocals, which are just > another kind of global variables. > > -Bertrand >
Re: currentResource in OSGi
It would be helpful if we can expose the current SlingHttpServletRequest or ResourceResolver via a threadlocal. This would simplify code where we need pass the request as method parameters . This can be done via a simple FIlter which publishes the request into a thread local and have a new API class which makes this request accessible. Thoughts? Chetan Mehrotra On Mon, May 14, 2012 at 4:56 PM, Sarwar Bhuiyan wrote: > the resource will be different for every instance so annotation is not a > good candidate to pass this anyway. annotations would be used to wire up > services when the services start on osgi bundle installation or update. > > Sarwar > > On Mon, May 14, 2012 at 12:00 PM, Davide wrote: > > > On 14/05/2012 11:55, Sarwar Bhuiyan wrote: > > > it's just called resource, not currentResource in JSPs. In servlets, > you > > > get the resource from request.getResource or > > > resourceResolver.getResource(path). Not sure what you're asking in > terms > > > of @Reference. Are you talking about when you are not in a servlet? > If > > > you're using some java service or helper class, why not pass the > resource > > > object in the parameter? > > > > Yes, I'm in a java class. Normally I pass in the SlingHttpServletRequest > > and it works. I was just wondering about any annotation we could use. > > > > thanks > > Davide > > > > >
Re: New Sling Script Console plugin
Sure ... or we can keep the service disabled by default and the plugin page displays a message that it should be enabled before being used. And then a user can enable it from WebConsole Chetan Mehrotra On Fri, May 4, 2012 at 1:46 PM, Bertrand Delacretaz wrote: > Hi Chetan, > > On Fri, May 4, 2012 at 5:18 AM, Chetan Mehrotra > wrote: > > ...Let me know if any other change is required from my side for this > feature > > to be included in Sling... > > I haven't looked in detail yet, but IIUC your service allows arbitrary > code to be executed from a POST request (which is cool in the context > of testing that I saw in your example). > > As that can be a security risk, maybe it would be good to have some > form of warning, that people must be aware of the implications if > enabling that service? Maybe just a WARN log message at activation > time, or something similar that reasonable users shouldn't ignore. > > -Bertrand >
Re: New Sling Script Console plugin
Thanks for all the feedback!! As Sling GitHub repository is readonly so a regular pull request would not work. I have created SLING-2463 [1] and attached the implementation as a patch. Kindly have a look at that. Let me know if any other change is required from my side for this feature to be included in Sling Chetan Mehrotra [1] https://issues.apache.org/jira/browse/SLING-2463
New Sling Script Console plugin
I have implemented a Felix WebConsole plugin for evaluating scripts making use of existing infrastructure present in Sling. It provides support for following items * Support evaluation of script in any language as supported by Sling e.g. Groovy, JavaScript, Ruby, Python etc. You would need to ensure that relevant language bundle is deployed * Code editor with syntax highlighting support based on CodeMirror Javascript library * Hot key support * Execute remote testcase via evaluating test scripts The code is pushed to my forked Git repo for Sling at [1]. Complete details about the plugin (with screen shots) is provided at [2]. Comments and feedback welcome!! Chetan Mehrotra [1] https://github.com/chetanmeh/sling/tree/script-console [2] https://github.com/chetanmeh/c/wiki/Sling-Script-Console
Re: Specific property types in JSON initial-content files
Looking at JsonReader source code it appears that intent of the implementation was to have separate nodes and properties entries from JSON tree. However implementation does not follow that intent. So possibly a bug wrt mismatch between documentation and implementation. Chetan Mehrotra On Mon, Apr 30, 2012 at 8:19 PM, David G. wrote: > Chetan, > > Thanks - this is perfect - I must be thinking thinking of something else. > > Do you happen to know off the top of your head if the jcrcontent > loader is used for JSON initial-content? Just curious as to what the > documentation I found on the Sling site is in referenced to (using the > "properties" and "nodes" keys). > > On Mon, Apr 30, 2012 at 2:41 AM, Chetan Mehrotra > wrote: > > Hi David, > > > > Looking at the JsonReader implementation [1] getType > > > >protected int getType(String name, Object object) { > >if (object instanceof Double || object instanceof Float) { > >return PropertyType.DOUBLE; > >} else if (object instanceof Number) { > >return PropertyType.LONG; > >} else if (object instanceof Boolean) { > >return PropertyType.BOOLEAN; > >} else if (object instanceof String) { > >if (name.startsWith(REFERENCE)) return PropertyType.REFERENCE; > >if (name.startsWith(PATH)) return PropertyType.PATH; > >if (name.startsWith(NAME)) return PropertyType.NAME; > >if (name.startsWith(URI)) return PropertyType.URI; > >if (jsonDate.matcher((String) object).matches()) return > > PropertyType.DATE; > >} > > > >// fall back to default > >return PropertyType.UNDEFINED; > >} > > > > It appears that type is inferred from the JSON representation itself. And > > in some cases from propetyName prefixes. So keeping {"foo":1} should > create > > foo of type integer > > > > Chetan Mehrotra > > [1] > > > http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java?view=markup > > > > On Mon, Apr 30, 2012 at 3:57 AM, David G. > wrote: > > > >> Can someone refresh my memory how to specify property types in a JSON > >> file used in a Bundle's initial-content? > >> > >> I could swear i remember reading it on the Sling site, but can't find it > >> again -- i swear that sites randomizes its content every few days just > so I > >> can't find anything on it :) > >> > >> I tried using the properties key as seen here: > >> http://sling.apache.org/site/content-loading-jcrcontentloader.html > >> > >> "properties": { > >> "foo": { > >> "value": 1, > >> "type": "Long" > >> } > >> } > >> > >> > >> > >> However that just creates > >> .../node/properties/foo.value = [String] 1 > >> .../node/properties/foo.type = [String] Long > >> > >> As I would expect. > >> > >> Thanks > >> > >> -- > >> David Gonzalez > >> Sent with Sparrow (http://www.sparrowmailapp.com/?sig) > >> > >> >
Re: Specific property types in JSON initial-content files
Hi David, Looking at the JsonReader implementation [1] getType protected int getType(String name, Object object) { if (object instanceof Double || object instanceof Float) { return PropertyType.DOUBLE; } else if (object instanceof Number) { return PropertyType.LONG; } else if (object instanceof Boolean) { return PropertyType.BOOLEAN; } else if (object instanceof String) { if (name.startsWith(REFERENCE)) return PropertyType.REFERENCE; if (name.startsWith(PATH)) return PropertyType.PATH; if (name.startsWith(NAME)) return PropertyType.NAME; if (name.startsWith(URI)) return PropertyType.URI; if (jsonDate.matcher((String) object).matches()) return PropertyType.DATE; } // fall back to default return PropertyType.UNDEFINED; } It appears that type is inferred from the JSON representation itself. And in some cases from propetyName prefixes. So keeping {"foo":1} should create foo of type integer Chetan Mehrotra [1] http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java?view=markup On Mon, Apr 30, 2012 at 3:57 AM, David G. wrote: > Can someone refresh my memory how to specify property types in a JSON > file used in a Bundle's initial-content? > > I could swear i remember reading it on the Sling site, but can't find it > again -- i swear that sites randomizes its content every few days just so I > can't find anything on it :) > > I tried using the properties key as seen here: > http://sling.apache.org/site/content-loading-jcrcontentloader.html > > "properties": { > "foo": { > "value": 1, > "type": "Long" > } > } > > > > However that just creates > .../node/properties/foo.value = [String] 1 > .../node/properties/foo.type = [String] Long > > As I would expect. > > Thanks > > -- > David Gonzalez > Sent with Sparrow (http://www.sparrowmailapp.com/?sig) > >
Re: Where to set sling.bootdelegation?
You can specify the bootdelegation package via servlet init param in web.xml of the sling webapp Sling Servlet sling org.apache.sling.launchpad.webapp.SlingServlet ... sling.bootdelegation.com.sun.org.apache com.sun.org.apache.* 100 Chetan Mehrotra On Fri, Jul 22, 2011 at 9:19 PM, Markus Joschko wrote: > On Fri, Jul 22, 2011 at 5:41 PM, Justin Edelson > wrote: > > That's correct. boot delegation is something defined at the time the > > OSGi framework starts and is then fixed for the lifetime of that > > framework instance. You can change the contents of sling.properties at > > any time, but it requires a restart to take effect. > > OK, no big deal as that is hopefully not happening that often. > But in addition I would like to add this to the sling.properties which > is backed into the launchpad so I have it already available > when setting up a new environment. > What's the best way to extend the "default" sling.properties? > I added a sling.properties file to my launchpad project and that > completely replaces the default sling.properties. > Do I have to add the default entries by hand or is there another way > so only my one entry is added to the default sling.properties? > > Thanks, > Markus > > > > > > > On Fri, Jul 22, 2011 at 11:24 AM, Markus Joschko > > wrote: > >> OK, so there is no way to "contribute" that information from the > >> bundle that requires the information? > >> Just to make sure I do not miss something: sling.properties I either > >> configure in the launchpad or by hand after the initial installation? > >> > >> > >> On Fri, Jul 22, 2011 at 5:19 PM, Justin Edelson > >> wrote: > >>> Also sling.properties > >>> > >>> On Jul 22, 2011, at 11:17 AM, Markus Joschko > wrote: > >>> > >>>> Hi, > >>>> I need to make the class com.sun.xml.internal.ws.api.message.Header > >>>> available to a bundle. > >>>> I can get this done by adding the package to the > >>>> org.osgi.framework.bootdelegation in sling.properties > >>>> > >>>> After having read http://sling.apache.org/site/configuration.html I > >>>> would rather set a sling.bootdelegation property. > >>>> But where do I add this property? Can I set it from the bundle? > >>>> > >>>> Must be something very obvious, but I miss it somehow. > >>>> > >>>> Thanks, > >>>> Markus > >>> > >> > > >