Apache Sling: unresolved package after Installing SlingShot sample bundle - osgi

I am Unable to run slingshot sample , apache sling i have followed these steps
Click here!
the package got installed but it didn't get activated. The detail collapsed view of bundle shows
org.apache.sling.api.resource,version=[2.2,2) -- Cannot be resolved

Your bundle import org.apache.sling.api.resource,version=[2.2,2) was not resolved.
Assuming that your sling installation is running, you should verify if the package org.apache.sling.api.resource is either not exported or exported in the wrong version.
If the package is present then adapt your import.

You didn't indicate how you built or started the Sling instance where you installed the Slingshot bundle.
I just tried with a Sling launchpad built from the launchpad/builder folder of the Sling source code, the Slingshot bundle starts without problems and the /slingshot/albums.html path mentioned in the sample's README.txt works.

Related

What is this package source starting with gav:// and how to upgrade a package from this source?

Came across the following artefact in one of the docker images that I built. So, wondering what this package source (gav://) is and how can I upgrade it?
gav://org.apache.commons:commons-compress:1.19

Can't force Apache Karaf to load a new version of the bundle (version w/o "-SNAPSHOT")

I've tried to update bundle in Karaf without changing its version. Version doesn't contain "-SNAPSHOT".
Is there a way to do it?
I've installed bundle to Apache Karaf through the mvn link
The code inside this bundle was changed without changing its (bundle's) version (according to some inner reasons).
Then I removed this bundle from Karaf, and from Nexus.
Next step was deploying new bundle to Nexus.
When I finally tried to install the "new" bundle, I saw there were no changes in it.
It looks like there is some cache inside Karaf where he stores bundles, that was already installed.
Adding flags like -c or -cc doesn't help.

Jena OSGi bundle cannot start

I want to use Jena OSGi 3.0.0 version in Felix 2.0.3, but when I install the bundle I get the exception:
Unresolved constraint in bundle org.apache.jena.osgi [1]: package; (&(package=org.apache.commons.cli)(version>=1.3.0)(!(version>=2.0.0)))
Does this mean that the package org.apache.commons.cli is not contained in the jena-osgi bundle?
Any ideas how to solve this issue?
Yes, this means that the jena-osgi bundle imports package org.apache.commons.cli. You need to install the bundle that exports this package.
Funnily enough, this package is exported by a bundle named org.apache.commons.cli which you can get from Maven Central:
http://search.maven.org/#artifactdetails|commons-cli|commons-cli|1.3.1|jar

Apache karaf how to easily install bundle from Maven repo

I am trying out Karaf and installed some bundle X. This bundle X complains about a missing requirement: Unresolved requirements ... osgi.wiring.package; (osgi.wiring.package=org.apache.commons.httpclient)]
Hence, I tried to provide the org.apache.commons.httpclient through bundle:install mvn:commons-httpclient/commons-httpclient/3.1 which worked.
But, after trying to start the X again, I still get the same error message.
thanks!
That jar is not a bundle, hence can't be deployed to karaf, it's just ignored.
Try
karaf#root>bundle:install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/3.1_7
Make it sure that your bundle has in their META-INF/MANIFEST.MF the osgi import declarations syntax. I assume that you use bndtools to generate the bundle.
Agree with #Antonio, for third party libraries which are not OSGi bundles you can also try to install them with wrap:
bundle:install -s wrap:mvn:commons-httpclient/commons-httpclient/3.1
This will create a basic OSGi MANIFEST for the library...
You can find more info here: http://karaf.apache.org/manual/latest/developers-guide/creating-bundles.html

package com.google.protobuf does not exist on OS X Maverick

I am on OS X Mavericks and starting learning about protobuf, i download the example from https://code.google.com/p/protobuf/downloads/list
I am successfully able to create the .java file from the proto but while compiling the existing java code using
make java, i am getting following error
com/example/tutorial/AddressBookProtos.java:91: package com.google.protobuf does not exist
com.google.protobuf.GeneratedMessage
^
com/example/tutorial/AddressBookProtos.java:12: package com.google.protobuf does not exist
extends com.google.protobuf.MessageOrBuilder {
^
com/example/tutorial/AddressBookProtos.java:9: package com.google.protobuf does not exist
com.google.protobuf.ExtensionRegistry registry) {
^
com/example/tutorial/AddressBookProtos.java:2495: package com.google.protobuf.Descriptors does not exist
private static com.google.protobuf.Descriptors.Descriptor
^
com/example/tutorial/AddressBookProtos.java:2498: package com.google.protobuf.GeneratedMessage does not exist
com.google.protobuf.GeneratedMessage.FieldAccessorTable
....
....
Any resolution to this?
Thanks
Met the same problem and finally got it working. Here's what I did(using version 2.6.0) on OSX 10.9:
Do everything java/README.txt tells you to
if maven package succeed, you'll get a protobuf-java-2.6.0.jar under target folder, for me it's /Users/laike9m/Dev/protobuf-2.6.0/java/target/protobuf-java-2.6.0.jar.
create ~/Library/Java/Extensions folder, note: this is platform specific operation, for OS other than OSX it should be $JAVA_HOME/lib/ext
copy protobuf-java-2.6.0.jar to ~/Library/Java/Extensions
Then you should be able to run make java successfully.
You need to include libprotobuf.jar in your CLASSPATH. Follow the instructions under java/README.txt in the Protobuf source package to build it.
What #laike9m suggested only partially worked for me. I definitely tried to do everything java/README.txt as #laike9m suggested. I had to install maven. I used brew to do that (brew install maven). I then built the protocol buffers java source using mvn package. The first time I tried that, it failed due to some obscure-ish error. I built the C++ code using ./configure && make. Next time I tried to build the java code using mvn package it worked. It put the resulting jar in a folder called target. I think went back to the examples area and was able to build the java example using make but I had to modify the Makefile by adding the -classpath... part below:
javac_middleman: AddPerson.java ListPeople.java protoc_middleman
javac -classpath .:../java/target/protobuf-java-2.6.1.jar:$$CLASSPATH AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java
#touch javac_middleman
Download protobuf.jar from below link and add jar file into libs folder.Its work for me.
https://code.google.com/archive/p/android-market-api/downloads

Resources