我正在尝试使用bndtools编写OSGI REST包。
我在cnf项目中添加了我需要的所有jar。 然后我将它们添加到包构建路径中。
我得到以下运行时异常
OSGi包未启动:缺少要求osgi.wiring.package (&(osgi.wiring.package = javax.ws.rs)(version = 2.0.0)((版本 = 3.0.0)))
我不理解错误,因为我使用javax.ws.rs-api 2.0.1.
我尝试在buildpath中明确指定版本,如此
-buildpath: \
javax.ws.rs-api;version2.0.1 \
没有任何运气。
我使用错误的罐子吗?
谢谢
这是我的bnd
-buildpath: \
osgi.annotation,\
osgi.core,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
com.google.guava,\
lmca.ps.util;version=latest,\
lmca.ps.infrastructure;version=latest,\
org.ops4j.pax.logging.pax-logging-api,\
com.fasterxml.jackson.core.jackson-annotations,\
com.fasterxml.jackson.core.jackson-core,\
com.fasterxml.jackson.core.jackson-databind,\
com.fasterxml.jackson.jaxrs.jackson-jaxrs-base,\
com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider,\
com.fasterxml.jackson.module.jackson-module-jaxb-annotations,\
org.eclipse.jetty.alpn.server,\
org.eclipse.jetty.annotations,\
org.eclipse.jetty.cdi.core,\
org.eclipse.jetty.cdi.servlet,\
org.eclipse.jetty.cdi.websocket,\
org.eclipse.jetty.client,\
org.eclipse.jetty.continuation,\
org.eclipse.jetty.deploy,\
org.eclipse.jetty.gcloud.session,\
org.eclipse.jetty.http,\
org.eclipse.jetty.infinispan,\
org.eclipse.jetty.io,\
org.eclipse.jetty.jaas,\
org.eclipse.jetty.jmx,\
org.eclipse.jetty.jndi,\
org.eclipse.jetty.memcached.session,\
org.eclipse.jetty.nosql,\
org.eclipse.jetty.plus,\
org.eclipse.jetty.proxy,\
org.eclipse.jetty.quickstart,\
org.eclipse.jetty.rewrite,\
org.eclipse.jetty.schemas,\
org.eclipse.jetty.security,\
org.eclipse.jetty.security.jaspi,\
org.eclipse.jetty.server,\
org.eclipse.jetty.servlet,\
org.eclipse.jetty.servlets,\
org.eclipse.jetty.unixsocket,\
org.eclipse.jetty.util,\
org.eclipse.jetty.webapp,\
org.eclipse.jetty.xml,\
org.glassfish.hk2.api,\
org.glassfish.hk2.external.aopalliance-repackaged,\
org.glassfish.hk2.external.javax.inject,\
org.glassfish.hk2.locator,\
org.glassfish.hk2.osgi-resource-locator,\
org.glassfish.hk2.utils,\
org.glassfish.jersey.bundles.repackaged.jersey-guava,\
org.glassfish.jersey.containers.jersey-container-servlet,\
org.glassfish.jersey.containers.jersey-container-servlet-core,\
org.glassfish.jersey.core.jersey-client,\
org.glassfish.jersey.core.jersey-common,\
org.glassfish.jersey.core.jersey-server,\
org.glassfish.jersey.media.jersey-media-jaxb,\
javax.servlet-api,\
javax.annotation-api,\
javax.jms-api,\
javax.validation.api,\
jaxb-api,\
slf4j.api,\
org.osgi.service.log,\
org.ops4j.pax.logging.pax-logging-service,\
org.ops4j.pax.logging.pax-logging-logback,\
json,\
javax.ws.rs-api,\
persistence-api,\
javassist
-runfw: org.apache.felix.framework;version='[5.6.1,5.6.1]'
-runee: JavaSE/compact1-1.9
-runrequires: \
osgi.identity;filter:='(osgi.identity=org.apache.felix.dependencymanager.shell)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.dependencymanager)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.runtime)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
osgi.identity;filter:='(osgi.identity=com.google.guava)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.scr)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.fileinstall)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.configadmin)',\
osgi.identity;filter:='(osgi.identity=lmca.ps.util)',\
osgi.identity;filter:='(osgi.identity=lmca.ps.infrastructure)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.log)',\
osgi.identity;filter:='(osgi.identity=org.ops4j.pax.logging.pax-logging-service)',\
osgi.identity;filter:='(osgi.identity=jaxb-api)'
-runbundles: \
ch.qos.logback.classic;version='[1.1.7,1.1.8)',\
ch.qos.logback.core;version='[1.1.7,1.1.8)',\
com.google.guava;version='[20.0.0,20.0.1)',\
org.apache.felix.configadmin;version='[1.8.12,1.8.13)',\
org.apache.felix.dependencymanager;version='[4.3.0,4.3.1)',\
org.apache.felix.dependencymanager.shell;version='[4.0.4,4.0.5)',\
org.apache.felix.gogo.command;version='[0.16.0,0.16.1)',\
org.apache.felix.gogo.runtime;version='[0.16.2,0.16.3)',\
org.apache.felix.gogo.shell;version='[0.10.0,0.10.1)',\
org.apache.felix.metatype;version='[1.1.2,1.1.3)',\
slf4j.api;version='[1.7.21,1.7.22)',\
org.apache.felix.fileinstall;version='[3.5.4,3.5.5)',\
org.apache.felix.scr;version='[2.0.6,2.0.7)',\
lmca.ps.util;version=snapshot,\
lmca.ps.infrastructure;version=snapshot,\
org.apache.felix.log;version='[1.0.1,1.0.2)',\
org.ops4j.pax.logging.pax-logging-api;version='[1.9.1,1.9.2)',\
org.ops4j.pax.logging.pax-logging-service;version='[1.9.1,1.9.2)'
Bundle-Name: foo.bar
Bundle-Description: Example bundle
-runvm: -Dfelix.fileinstall.dir=/home/bar\n\
-Dfelix.fileinstall.noInitialDelay=true\n\
-Dfelix.fileinstall.poll=1000\n\
-Dorg.ops4j.pax.logging.DefaultServiceLog.level=INFO
Bundle-Activator: foo.bar.Activator
Private-Package: foo.bar
完整的错误是
could not resolve the bundles: [foo.bar-0.0.0 org.osgi.framework.BundleException: Unable to resolve foo.bar [19](R 19.0): missing requirement [foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0))) Unresolved requirements: [[foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))]
]
Failed to start bundle foo.bar-0.0.0, exception Unable to resolve foo.bar [19](R 19.0): missing requirement [foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0))) Unresolved requirements: [[foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))]
答案 0 :(得分:1)
我不得不改变
var person2 = [];
person2[0] = "John";
person2[1] = "Doe";
person2[2] = 46;
到
var person2 = [];
person2['a'] = "John";
person2['b'] = "Doe";
person2['c'] = 46;
console.log(person2); //[1: "John", 2: "Doe", 3: 46]
console.log(Object.keys(person2).length)