osgi

Cq5.5 applying a servlet filter to a specific path

馋奶兔 提交于 2019-12-04 06:22:55
I'm working on a custom form handler in cq5.5 and everything is going great. I'm now working on locking down some of the security and one of my tasks is to implement a request throttling filter to the form handlers path. Currently I have something like @Component(immediate = true, metatype = true) @Service(javax.servlet.Filter.class) @Properties({ @Property(name="service.pid", value="com.xxxxxx.cq.core.filter.FormFilter",propertyPrivate=false), @Property(name="service.description",value="FormFilter", propertyPrivate=false), @Property(name="service.vendor",value="xxxxxx - Microsites",

Using JavaCompiler in an OSGi Bundle

Deadly 提交于 2019-12-04 05:51:47
I'm in the process of refactoring a Java application to use OSGi. One feature of the application is on-the-fly Java compilation using javax.tools.JavaCompiler . In the original application this process worked by feeding the compiler the existing classpath, like so. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); String[] options = {"-classpath", System.getProperty("java.class.path")}; DiagnosticListener<JavaFileObject> listener = new DiagnosticListener<JavaFileObject>() {...}; StandardJavaFileManager fileManager = compiler.getStandardFileManager(listener, null, null); Iterable<?

Printing OSGI bundle classpath?

不羁岁月 提交于 2019-12-04 05:21:38
In a normal java application its possible to print the content of the classpath with: String ss = System.getProperty("java.class.path"); System.out.println(ss); But how do I print the classpath of an OSGI bundle created using the eclipse PDE wizard? In the activator its possible to get the current bundle like: public void start(BundleContext context) throws Exception { super.start(context); plugin = this; Bundle b = context.getBundle(); // java doc: This bundle's class loader is not used to search for entries. b.findEntries(path, filePattern, recurse) But the javadoc says that the findEntries

Clojure hot code swapping for uberjars/.classes

岁酱吖の 提交于 2019-12-04 04:34:12
I want to have hot code swapping between project updates, but I haven't found any information about how to load .class files dynamically. More specifically, I want something like that: Make lein uberjar , obtain some-client-0.0.0-standalone.jar . Run it with java -jar some-client-0.0.0-standalone.jar . Make changes to project. Obtain new program version, some-client-0.0.1-standalone.jar , copy it to some-client-0.0.0-standalone.jar directory. Client receive sequence of commands needed to update to new version. (optional) Updates resources. Resources from old jar are no longer used. (optional)

Log4j2 api cannot find Log4j2 core in OSGi environment

江枫思渺然 提交于 2019-12-04 04:08:16
I'm trying to use log4j2 OSGi bundles, but it seems log4j2 api cannot find log4j2 core in an OSGi environment. I'm continuously getting the following exception : ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console I found the same exception discussed in few places but still I could not figure out this issue. Isuspect I'm getting this issue because log4j2 api cannot find the log4j-provider.properties inside the META-INF directory of log4j2 core. Is there any clue why I'm getting this exception and

What is a p2 repository?

拜拜、爱过 提交于 2019-12-04 04:04:10
I'm working on a project now for a few months where we use "p2-repositories". I know that I get my dependencies from them. But now I want do dive deeper into the subject and I wonder what exactly is a p2-repository - the definition. I think it has something to do with OSGi and with Nexus. But where does it come from? Am I bound to Nexus when I use p2 repositories? Or is this the common standard from OSGi? Or Eclipse/Maven/Tycho? Why do I need p2-repositories, when I can have Maven? Or why can't I use Maven? P2 repositories are very common in the eclipse ecosystem. They combine the artifacts

How handle different logging solutions in OSGi (Apache Felix)

与世无争的帅哥 提交于 2019-12-04 04:03:39
问题 In OSGi there is a separation between the logging frontend and the actual output. So, by using the LogService , this doesnt mean that anything is written to the console for example. This is what a LogReaderService is responsible for. In my current runtime, I am addind org.apache.felix.log which brings a LogReaderService-Implementation which should take care of the output. But I still dont see anything on the console...despite a lot of other stuff from other bundles. In the next step I created

multiple slf4j bindings in Eclipse RCP Plugin

爱⌒轻易说出口 提交于 2019-12-04 03:20:34
I have a simple Eclipse Plugin which gives me following error on activation: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [bundleresource://103.fwk8918249:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundleresource://103.fwk8918249:4/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. both URLs resolve to the exact same jar in the bundle libs/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class How can i solve the problem? How come that the bundle loads the jar

How to setup an Eclipse Project with multiple Subprojects (OSGi-Bundles)

故事扮演 提交于 2019-12-04 03:15:41
问题 Sherlog is an OSGi-based log analyzer, if I import this project as an workspace snapshot I receive lot's of projects in my workspace, but I would prefere to have them as subprojects in a project. The other option would be to checkout from svn, but then I face other problems (I don't know how to setup the dependencies for automatically build) Does anyone have an idea or good links on this topic? Thanks 回答1: EDIT: For Eclipse 4.5 and newer please see https://stackoverflow.com/a/34134833/53897

How to include a dependency to a jar file from an eclipse/osgi application?

此生再无相见时 提交于 2019-12-04 03:03:47
问题 I created an Eclipse 4 application and I needed a jar offering a functionality as part of my application (this could be anything e.g. log4j to make it trivial). I added the jar as part of my project's classpath ( Right Click->Configure Build Path ) but on runtime my service failed with a ClassNotFound error (from OSGI I guess?). Anyway searching this it turned out, at least as I have understand it, that I should add the jar as part of another Plugin and create a dependency from my application