Shastick
Shastick

Reputation: 1258

Vespa Tutorial – HTTP API use-case fails to activate with IllegalArgumentException

I'm currently following the Vespa tutorials, and ran into an issue with the HTTP API use-case. Everything works fine from the mvn install package to the vespa-deploy prepare target/application.zip.

The call to vespa-deploy activate returns normally, but the application then never gets available on localhost:8080. Looking at /opt/vespa/logs/vespa/vespa.log (in the VM) one finds the following stack trace:

Container.com.yahoo.jdisc.core.StandaloneMain   error   Unexpected: 
  exception=
    java.lang.IllegalArgumentException: Could not create a component with id 'com.mydomain.demo.DemoComponent'.
    Tried to load class directly, since no bundle was found for spec: sample-app-http-api-searcher. 
    If a bundle with the same name is installed, there is a either a version mismatch or the installed bundle's version contains a qualifier string.
    at com.yahoo.osgi.OsgiImpl.resolveFromClassPath(OsgiImpl.java:48)
    ...

This occurred using a fresh Docker image with a clean clone of the sample-apps git repository. Preparing and activating the basic sample as well as the other http example did work seamlessly.

I checked the sources and the xml files for obvious problems but don't have any clue about what is failing and where.

target/application.zip contains

application/components/http-api-using-searcher-1.0.1-deploy.jar
application/hosts.xml
application/searchdefinitions/basic.sd
application/services.xml

And the jar itself does contain a com/mydomain/demo/DemoComponent.class file (among other things).

Potentially related issue on the github tracker: https://github.com/vespa-engine/vespa/issues/3479 I'll be posting a link to this question there as well, but I still think it's worth a SO question, at least to get some action behind the vespa tag :)

Upvotes: 1

Views: 318

Answers (1)

gjoranv
gjoranv

Reputation: 4711

The bundle id in the application's services.xml file was wrong. Please pull the application from git and try again now. See also PR: https://github.com/vespa-engine/sample-apps/pull/18

Brief explanation: The bundle id given in the bundle="<id>" declaration in services.xml must match the 'Bundle-SymbolicName' in the bundle's manifest. When the bundle has been built with the Vespa bundle-plugin, the symbolic name is by default the same as the project's artifactId. Hence, in most cases you just have to verify that the bundle id matches the artifactId.

Upvotes: 3

Related Questions