WSO2 CEP 4.1.0 Event adaptor - wso2-cep

I wrote a custom event adaptor and I have placed the jar in dropping folder, but the CLI does not show custom logging nor does it appear within the output adaptor.
I have read the 4.1.0 guide without success and tried to read the source code of:
http://dist.wso2.org/maven2/org/wso2/carbon/org.wso2.carbon.event.input.adaptor.email/1.0.1/

Perhaps the bundle which you put into dropins has not being activated.
To check whether it's active, you can start the WSO2 CEP server on OSGI console mode as follows:
Go to <CEP_HOME>/bin and execute command (assuming you're using Linux):
./wso2server.sh -DosgiConsole
After the server has started, you will see the OSGI prompt.
osgi>
Then run type ss <bundle_name>
For example:
ss org.wso2.carbon.event.output.adapter.custom.websocket
sample output:
id State Bundle
285 RESOLVED org.wso2.carbon.event.output.adapter.custom.websocket_5.0.12.SNAPSHOT
Note that you do not need to specify the complete bundle name with version and all but specifying a part of the name would be sufficient.
It will show you whether the bundle is ACTIVE or not.
If it's not in ACTIVE state, you can diagnose your bundle using its ID. E.g.
diag 285
This will show you the list of missing imported packages.
You can refer to [1] and [2] to learn about OSGI console commands.
Then make sure to expose those using your bundle pom file.
For example, refer to following portion of a pom file. It has exposed certain packages using the Export-Package element.
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Private-Package>
org.wso2.carbon.event.output.adapter.websocket.local.internal,
org.wso2.carbon.event.output.adapter.websocket.local.internal.*
</Private-Package>
<Export-Package>
!org.wso2.carbon.event.output.adapter.websocket.local.internal,
!org.wso2.carbon.event.output.adapter.websocket.local.internal.*,
org.wso2.carbon.event.output.adapter.websocket.local.*,
</Export-Package>
<Import-Package>
org.wso2.carbon.event.output.adapter.core.*,
javax.xml.namespace; version=0.0.0,
*;resolution:=optional,
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
[3] might have some useful info too.
References
[1] http://movingaheadblog.blogspot.com/2014/01/how-to-debug-wso2-carbon-products-using.html
[2] https://isurues.wordpress.com/2009/01/01/useful-equinox-osgi-commands
[3] http://wso2.com/library/articles/getting-started-wso2-carbon/

Related

Unresolved constraint in bundle suddenly in new version of JBossFuse

I have already searched for solution online but none of them has actually worked. I am moving from JBossFuse 6.2.1. to JbossFuse 6.3.0. This includes upgrading dependencies which I have managed, most of them. Right now I am stuck with this error:
Error executing command: Error starting bundles:
Unable to start bundle 390: Unresolved constraint in bundle pipeline-reception-ws-external-cxf [390]: Unable to resolve 390.0: missing requirement [390.0] osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.ssl)
I am using maven-bundle-plugin which is configured this way:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Import-Package>
org.apache.camel.*;version="[${camel.range.start},${camel.range.end})",
ms.common.wsdl,template.velocity,org.eclipse.jetty.server,*
</Import-Package>
<Export-Package>
eu.unicorn.basse.ms.pipeline.reception.route.ws.external.cxf.*
</Export-Package>
<_removeheaders>Import-Service</_removeheaders>
</instructions>
</configuration>
</plugin>
I am not sure why this does not work if it works on older JbossFuse environment. Question is, how to solve this issue.
This error indicates that your environment does not contain a bundle which exports the package org.eclipse.jetty.http.ssl. As there is no version information in your package import it indicates that you also don't have a suitably bundled version of it in your bundle's build path (if you did then the maven-bundle-plugin would have found a version and added it to your import).
Either this requirement on org.eclipse.jetty.http.ssl is new to your bundle, or it was previously supplied by another bundle in Fuse 6.2.1 which is no longer present in Fuse 6.3.0.
In any event you need to start by fixing your bundle, either by putting the relevant parts of Jetty on the build path so that you get a version range on your import, or by removing the new dependency which has leaked into your bundle. Then, if needed, you can simply deploy the other bundles that your bundle requires.

Could not start bundle Unresolved constraint in bundle osgi.wiring.package=org.apache.commons.configuration version>=1.9.0 ! version>=2.0.0

I am trying to install a latest version of my apache camel application using feature:install on Karaf
this new version has a dependency of org.apache.commons.configuration ver 1.9
but getting the below error
error:
Error executing command: Could not start bundle mvn: in feature(s)<package> : Unresolved constraint in bundle <bundle> [414]: Unable to resolve 414.0: missing requirement [414.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.configuration)(version>=1.9.0)(!(version>=2.0.0)))
I had included it in the pom.xml
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
also have tried several ways suggested in sof but none is working
have also put the for org.apache.commons.configuration under the plugins
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
org.apache.cxf.service.model,
org.apache.cxf.message,
org.apache.commons.configuration,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
But still not able to resolve. Could anyone please help resolve this?
thanks
You need to ensure that the jar is installed in Karaf.
In order to do this you need to wrap the jar as a bundle:
osgi:install wrap:mvn:commons-configuration/commons-configuration/1.9
After you've done this make sure to remove the addition you made to Import-Package as it's not needed.
If you want the dependency to be installed along with your application's feature just add the following element to your feature:
<bundle>wrap:mvn:commons-configuration/commons-configuration/1.9</bundle>
Do you really want to import it from another deployed bundle or should it be a simple embedded dependency?
Since you list it under Import-Package, you expect the first. For that to work you need to have another bundle deployed in the container that exports org.apache.commons.configuration.
If you want to embedded it as simple dependency in the same bundle, you have to exclude it from Import-Package with ! as prefix and probably use Embed-Dependency instruction like the example in this answer: https://stackoverflow.com/a/30532447/8035582

Adding Embeded-Dependency in maven

Actually when i build my project it deploys the bundle to the running OSGI console. Now the bundle is in installed state and shows an red alert that commons-net bundle can not be find.
One way of solving this is problem is to install the bundle to the running osgi framework itself explicitly.
Another way could be adding Embeded-Dependency to the maven. But this approach is not working.
I added Embeded-Dependency to the instruction tag in maven-build-plugin. It didn't show any error.
Please let me know if any suggestions.
Embeded-Dependency did not show any error as you can place anything into the instructions. If the key-value pair is not known it will be simply inserted into the MANIFEST.MF as it is. Try writing Embed-Dependency, that should make it work.
A good example could be the following (how we created hibernate bundle for ourselves):
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<_exportcontents>
!org.hibernate.validator.*,
org.hibernate.*;-noimport:=true,
</_exportcontents>
<Import-Package>
javax.persistence*;version="1.1.0",
javax.naming*,
javax.sql,
javax.transaction*;version="1.1.0",
javax.xml.stream.*,
javax.xml.*,
org.slf4j,
org.w3c.dom,
org.xml.sax*,
antlr.*,
org.jboss.logging.*,
org.dom4j*,
*;resolution:=optional
</Import-Package>
<Embed-Dependency>
groupId=org.hibernate;artifactId=hibernate-core,
groupId=org.hibernate;artifactId=hibernate-entitymanager,
groupId=org.hibernate.common;artifactId=hibernate-commons-annotations
</Embed-Dependency>
</instructions>
</configuration>
</plugin>

Cannot use PAX-URL's assembly protocol with auto started bundles in Felix config.properties

I'm trying to use PAX-URL so I can have non-packed bundles assembled on the fly.
If I put pax-url-assembly-1.2.1.jar in the autostart bundles, and then type
install assembly:path/to/my/folder
everything works. The trouble is, I want to give felix those folders in the config file using > felix.auto.start.1=assembly:path/to/my/folder
If I do so, I get an "Unknown protocol: assembly" exception.
I've tried loading PAX-URL at level 1 and set the default start level of all other bundles to 10. Won't help. I think it's the "System Bundle" itself that reads the configuration before any bundle is loaded and therefore "assembly" is not understood.
My guess is I need to tell Felix to load PAX-URL right when Felix itself starts.
Any ideas? Did I get it all wrong? :)
Thanks!
Try putting PAX-URL into bundle folder in Apache Felix and launch it with -Djava.protocol.handler.pkgs=org.ops4j.pax.url options.
Here is a post describing Apache Felix development in Eclipse
One more thing!
If you are using Declarative Services with the maven-SCR-plugin, pax-url won't find the servicecomponents.xml, since the plugin by default puts it directly in target (as opposed to target/classes). For this to work, you'll have to add a config stanza to your scr plugin changing the output directory, like so:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.7.0</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
<configuration>
<!-- Without this, PAX-URL won't work -->
<outputDirectory>target/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

mvn release:perform automatically specify scm tag that includes release version

I would like to setup my maven release to run in batch mode, but I'm not a fan of the default scm tag ${artifactId}-${releaseVersion}. Instead, I'd like to simply tag it with ${releaseVersion}; however, I'm unclear if such a property exists (ie. without the -SNAPSHOT suffix).
I'd like the configuration to resemble the code below. Is such a default tagging possible with the maven-release-plugin?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
<configuration>
<tag>${releaseVersion}</tag>
</configuration>
</plugin>
I just got this to work when using Hudson to do my release. I noted that Hudson (with the Maven Release Plugin) is initiating the command with a property like -Dproject.rel.com.example:my-artifact-id=1.0.1. Using the following plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<tag>REL-${project.rel.com.example:my-artifact-id}</tag>
</configuration>
</plugin>
Resulted in the tag being REL-1.0.1
I'm new to the release plugin but I would assume something similar would work from the command line.
You can pass in the properties for:
releaseVersion -- What version you want it to be released as (1.0)
developmentVersion -- The next version (2.0-SNAPSHOT)
tag -- The name of the tag
a 1.0-SNAPSHOT implies a 1.0 release version, but doesn't set it. You can set that property in your POM file as a regular property.
try this:
<configuration>
<tag>${project.version}</tag>
</configuration>

Resources