Re: Aries jax-rs whiteboard

2019-11-17 Thread Matthias Leinweber
Hello Tim,

thank you, again you improved my knowledge. I just stripped my code for
simplicity.

Ok, but why and how does it work for the default application?
There i don't need to select an extension in the resource but serialization
works? I can not see that JsonProviderPrototypeServiceFactory somehow adds
a property for the default app. Or is there some voodoo with
SERVICE_RANKING?. Tbh i don't even find the point where the configuration
for pid org.apache.aries.jax.rs.jackson is created.

Besides the versioning of org.apache.aries.jax.rs.jackson seems broken and
the feature has a hardcoded dep on version 1.0.0 which source i cant find
at all.. and the artifacts in current source aren't build at all.

kr,
Matthias

So somehow the extension selection logic looks odd. Or is this made
media-type mapping?


Tim Ward  schrieb am Fr., 15. Nov. 2019, 17:23:

> Hi Matthias,
>
> So from the example that you’ve given I’m not sure why you have the
> whiteboard application at all. Providing an empty whiteboard application
> doesn’t really give you any benefit - the primary use case is for
> registering existing non-OSGi JAX-RS applications, or for where you already
> have a bunch of resource classes.
>
> In any event, the reason that what you have isn’t working for you is that
> the JSON extension isn’t targeting your application. It’s not enough to
> just put "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)” on the
> resource, it must also go on the extension, meaning that you need to
> configure the Aries JAX-RS support to add that property.
>
>
> The other suggested fix, as Oleg outlined, is for example:
>
> @Component(
> service = Application.class,
> property = {
>   "osgi.jaxrs.name=MyApp",
>   "osgi.jaxrs.application.base=/app",
> })
> public class MyApp extends Application {
> @Reference(target="(osgi.jaxrs.name=jaxb-json)”)
> Object writer;
>
> @Override
> public Set getSingletons() {
> Feature f = fc -> fc.register(writer, MessageBodyWriter.class,
> MessageBodyReader.class);
> Set singletons = new HashSet<>();
> singletons.add(f);
> return singletons;
> }
> }
>
> @Path("/service")
> @Component(
> service = MyService.class,
> property = {
>   "osgi.jaxrs.resource=true",
>   "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)",
> })
> public class MyService ...
>
>
> On 15 Nov 2019, at 15:35, Oleg Cohen  wrote:
>
> Hi Matthias,
>
> I was in the same situation. Here is what I ended up doing. Perhaps it
> will work for you.
>
> Here is my code:
>
> *import* java.util.HashSet;
> *import* java.util.Set;
>
> *import* javax.ws.rs.core.Application;
>
> *import* org.apache.logging.log4j.Logger;
> *import* org.osgi.service.component.annotations.Activate;
> *import* org.osgi.service.component.annotations.Component;
> *import*
> org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationBase;
> *import* org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName;
>
> *import* com.fasterxml.jackson.annotation.JsonInclude.Include;
> *import* com.fasterxml.jackson.databind.DeserializationFeature;
> *import* com.fasterxml.jackson.databind.ObjectMapper;
> *import* com.fasterxml.jackson.databind.SerializationFeature;
> *import* com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
>
> @Component(service = Application.*class*)
> @JaxrsApplicationBase(“my-app")
> @JaxrsName(“MyApplication")
> *public* *class* MyApplication *extends* Application {
>
> *private* *static* *final* Logger *logger* =
> org.apache.logging.log4j.LogManager.*getLogger*(MyApplication.*class*);
>
> *private* JacksonJsonProvider jsonProvider;
>
> @Activate
> *private* *void* activate() {
>
> *logger*.info(“MyApplication.activate(): Entry ...");
>
> ObjectMapper objectMapper = *new* ObjectMapper();
>
> objectMapper = *new* ObjectMapper();
>
> objectMapper.setSerializationInclusion(Include.*NON_NULL*);
>
> objectMapper.configure(SerializationFeature.*WRITE_DATES_AS_TIMESTAMPS*,
> *false*);
>
> objectMapper.configure(DeserializationFeature.
> *ADJUST_DATES_TO_CONTEXT_TIME_ZONE*, *false*);
>
> jsonProvider = *new* JacksonJsonProvider(objectMapper);
>
> *logger*.info(“MyApplication.activate(): jsonProvider = " + jsonProvider);
> }
>
> @Override
> *public* Set getSingletons() {
>
> Set singletons = *new* HashSet<>();
>
> singletons.add(jsonProvider);
>
> *return* singletons;
> }
> }
>
>
> On Nov 15, 2019, at 10:26 AM, Matthias Leinweber <
> m.leinwe...@datatactics.de> wrote:
>
> Ok that is something i already tried. But i don't want to use a own
> MessageWriter/Reader. I just want to use the one provided by aries-http
> whiteboard:
> [javax.ws.rs.ext.MessageBodyReader, javax.ws.rs.ext.MessageBodyWriter]
> --
>  jackson.jaxb.version = 2.9.6
>  jackson.jaxrs.json.version = 2.9.6
>  osgi.jaxrs.extension = true
>  osgi.jaxrs.media.type = application/json
>  

Re: Error installing openjpa/3.0.0 in karaf 4.2.7

2019-11-17 Thread Jean-Baptiste Onofré
Hi,

I confirm the issue (related to XBean update/import range).

I created https://issues.apache.org/jira/browse/KARAF-6521 about that.

It will be fixed in Karaf 4.2.8.

Sorry for the inconvenience.

Regards
JB

On 17/11/2019 12:49, tvogel wrote:
> I am unable to install openjpa/3.0.0 in a clean distribution of karaf 4.2.7.  
> 
> Similar / Same error as in this post 
> http://karaf.922171.n3.nabble.com/Openjpa-feature-resolution-error-on-Karaf-4-2-2-tp4054700.html
> 
>   
> 
> Is there a solution to this error?
> Thanks,
> Timothy
> 
> my full session:
> karaf@root(bundle)> feature:install -v jdbc jndi transaction jpa openjpa
> Adding features:
> jpa/[2.7.2,2.7.2],openjpa/[3.0.0,3.0.0],jndi/[4.2.7,4.2.7],transaction/[2.0.0,2.0.0],jdbc/[4.2.7,4.2.7]
> Changes to perform:
>   Region: root
> Bundles to install:
>   mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
>  
> mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1
>   mvn:org.ops4j.pax.jdbc/pax-jdbc/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/1.4.0
>   mvn:org.osgi/org.osgi.service.jdbc/1.0.0
> Installing bundles:
>   mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
>  
> mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1
>   mvn:org.ops4j.pax.jdbc/pax-jdbc/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/1.4.0
>   mvn:org.osgi/org.osgi.service.jdbc/1.0.0
> Starting bundles:
>   org.apache.geronimo.specs.geronimo-jta_1.1_spec/1.1.1
>   org.osgi.service.jdbc/1.0.0.201505202023
>   org.ops4j.pax.jdbc.pool.common/1.4.0
>   org.ops4j.pax.jdbc/1.4.0
>   org.apache.servicemix.bundles.jasypt/1.9.3.1
>   org.ops4j.pax.jdbc.config/1.4.0
> Done.
> org.apache.felix.resolver.reason.ReasonException: Unable to resolve root:
> missing requirement [root] osgi.identity; osgi.identity=openjpa;
> type=karaf.feature; version="[3.0.0,3.0.0]";
> filter:="(&(osgi.identity=openjpa)(type=karaf.feature)(version>=3.0.0)(version<=3.0.0))"
> [caused by: Unable to resolve openjpa/3.0.0: missing requirement
> [openjpa/3.0.0] osgi.identity; osgi.identity=org.apache.openjpa;
> type=osgi.bundle; version="[3.0.0,3.0.0]"; resolution:=mandatory [caused by:
> Unable to resolve org.apache.openjpa/3.0.0: missing requirement
> [org.apache.openjpa/3.0.0] osgi.wiring.package;
> filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"]]
> at
> org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
> at
> org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392)
> at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
> at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
> at
> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
> at
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:393)
> at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
> at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
> resolve openjpa/3.0.0: missing requirement [openjpa/3.0.0] osgi.identity;
> osgi.identity=org.apache.openjpa; type=osgi.bundle; version="[3.0.0,3.0.0]";
> resolution:=mandatory [caused by: Unable to resolve
> org.apache.openjpa/3.0.0: missing requirement [org.apache.openjpa/3.0.0]
> osgi.wiring.package;
> filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"]
> at
> org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
> ... 12 more
> Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
> resolve org.apache.openjpa/3.0.0: missing requirement
> [org.apache.openjpa/3.0.0] osgi.wiring.package;
> filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"
> at
> org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
> ... 13 more
> Error executing command: Unable to resolve root: missing requirement [root]
> osgi.identity; osgi.identity=openjpa; type=karaf.feature;
> version="[3.0.0,3.0.0]";
> 

Re: Error installing openjpa/3.0.0 in karaf 4.2.7

2019-11-17 Thread Jean-Baptiste Onofré
Hi,

the features might be updated.

Let me try to reproduce (the openjpa feature should be covered by itests
though).

I keep you posted.

Regards
JB

On 17/11/2019 12:49, tvogel wrote:
> I am unable to install openjpa/3.0.0 in a clean distribution of karaf 4.2.7.  
> 
> Similar / Same error as in this post 
> http://karaf.922171.n3.nabble.com/Openjpa-feature-resolution-error-on-Karaf-4-2-2-tp4054700.html
> 
>   
> 
> Is there a solution to this error?
> Thanks,
> Timothy
> 
> my full session:
> karaf@root(bundle)> feature:install -v jdbc jndi transaction jpa openjpa
> Adding features:
> jpa/[2.7.2,2.7.2],openjpa/[3.0.0,3.0.0],jndi/[4.2.7,4.2.7],transaction/[2.0.0,2.0.0],jdbc/[4.2.7,4.2.7]
> Changes to perform:
>   Region: root
> Bundles to install:
>   mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
>  
> mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1
>   mvn:org.ops4j.pax.jdbc/pax-jdbc/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/1.4.0
>   mvn:org.osgi/org.osgi.service.jdbc/1.0.0
> Installing bundles:
>   mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
>  
> mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1
>   mvn:org.ops4j.pax.jdbc/pax-jdbc/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.4.0
>   mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/1.4.0
>   mvn:org.osgi/org.osgi.service.jdbc/1.0.0
> Starting bundles:
>   org.apache.geronimo.specs.geronimo-jta_1.1_spec/1.1.1
>   org.osgi.service.jdbc/1.0.0.201505202023
>   org.ops4j.pax.jdbc.pool.common/1.4.0
>   org.ops4j.pax.jdbc/1.4.0
>   org.apache.servicemix.bundles.jasypt/1.9.3.1
>   org.ops4j.pax.jdbc.config/1.4.0
> Done.
> org.apache.felix.resolver.reason.ReasonException: Unable to resolve root:
> missing requirement [root] osgi.identity; osgi.identity=openjpa;
> type=karaf.feature; version="[3.0.0,3.0.0]";
> filter:="(&(osgi.identity=openjpa)(type=karaf.feature)(version>=3.0.0)(version<=3.0.0))"
> [caused by: Unable to resolve openjpa/3.0.0: missing requirement
> [openjpa/3.0.0] osgi.identity; osgi.identity=org.apache.openjpa;
> type=osgi.bundle; version="[3.0.0,3.0.0]"; resolution:=mandatory [caused by:
> Unable to resolve org.apache.openjpa/3.0.0: missing requirement
> [org.apache.openjpa/3.0.0] osgi.wiring.package;
> filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"]]
> at
> org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
> at
> org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392)
> at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
> at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
> at
> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
> at
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:393)
> at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
> at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
> resolve openjpa/3.0.0: missing requirement [openjpa/3.0.0] osgi.identity;
> osgi.identity=org.apache.openjpa; type=osgi.bundle; version="[3.0.0,3.0.0]";
> resolution:=mandatory [caused by: Unable to resolve
> org.apache.openjpa/3.0.0: missing requirement [org.apache.openjpa/3.0.0]
> osgi.wiring.package;
> filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"]
> at
> org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
> ... 12 more
> Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
> resolve org.apache.openjpa/3.0.0: missing requirement
> [org.apache.openjpa/3.0.0] osgi.wiring.package;
> filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"
> at
> org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
> ... 13 more
> Error executing command: Unable to resolve root: missing requirement [root]
> osgi.identity; osgi.identity=openjpa; type=karaf.feature;
> version="[3.0.0,3.0.0]";
> filter:="(&(osgi.identity=openjpa)(type=karaf.feature)(version>=3.0.0)(version<=3.0.0))"
> [caused by: 

Error installing openjpa/3.0.0 in karaf 4.2.7

2019-11-17 Thread tvogel
I am unable to install openjpa/3.0.0 in a clean distribution of karaf 4.2.7.  

Similar / Same error as in this post 
http://karaf.922171.n3.nabble.com/Openjpa-feature-resolution-error-on-Karaf-4-2-2-tp4054700.html

  

Is there a solution to this error?
Thanks,
Timothy

my full session:
karaf@root(bundle)> feature:install -v jdbc jndi transaction jpa openjpa
Adding features:
jpa/[2.7.2,2.7.2],openjpa/[3.0.0,3.0.0],jndi/[4.2.7,4.2.7],transaction/[2.0.0,2.0.0],jdbc/[4.2.7,4.2.7]
Changes to perform:
  Region: root
Bundles to install:
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
 
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1
  mvn:org.ops4j.pax.jdbc/pax-jdbc/1.4.0
  mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.4.0
  mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/1.4.0
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
Installing bundles:
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
 
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1
  mvn:org.ops4j.pax.jdbc/pax-jdbc/1.4.0
  mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.4.0
  mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/1.4.0
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
Starting bundles:
  org.apache.geronimo.specs.geronimo-jta_1.1_spec/1.1.1
  org.osgi.service.jdbc/1.0.0.201505202023
  org.ops4j.pax.jdbc.pool.common/1.4.0
  org.ops4j.pax.jdbc/1.4.0
  org.apache.servicemix.bundles.jasypt/1.9.3.1
  org.ops4j.pax.jdbc.config/1.4.0
Done.
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root:
missing requirement [root] osgi.identity; osgi.identity=openjpa;
type=karaf.feature; version="[3.0.0,3.0.0]";
filter:="(&(osgi.identity=openjpa)(type=karaf.feature)(version>=3.0.0)(version<=3.0.0))"
[caused by: Unable to resolve openjpa/3.0.0: missing requirement
[openjpa/3.0.0] osgi.identity; osgi.identity=org.apache.openjpa;
type=osgi.bundle; version="[3.0.0,3.0.0]"; resolution:=mandatory [caused by:
Unable to resolve org.apache.openjpa/3.0.0: missing requirement
[org.apache.openjpa/3.0.0] osgi.wiring.package;
filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"]]
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
at
org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392)
at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
at
org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:393)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
resolve openjpa/3.0.0: missing requirement [openjpa/3.0.0] osgi.identity;
osgi.identity=org.apache.openjpa; type=osgi.bundle; version="[3.0.0,3.0.0]";
resolution:=mandatory [caused by: Unable to resolve
org.apache.openjpa/3.0.0: missing requirement [org.apache.openjpa/3.0.0]
osgi.wiring.package;
filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"]
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
... 12 more
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
resolve org.apache.openjpa/3.0.0: missing requirement
[org.apache.openjpa/3.0.0] osgi.wiring.package;
filter:="(&(osgi.wiring.package=org.apache.xbean.asm6)(version>=6.1.0)(!(version>=7.0.0)))"
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
... 13 more
Error executing command: Unable to resolve root: missing requirement [root]
osgi.identity; osgi.identity=openjpa; type=karaf.feature;
version="[3.0.0,3.0.0]";
filter:="(&(osgi.identity=openjpa)(type=karaf.feature)(version>=3.0.0)(version<=3.0.0))"
[caused by: Unable to resolve openjpa/3.0.0: missing requirement
[openjpa/3.0.0] osgi.identity; osgi.identity=org.apache.openjpa;
type=osgi.bundle; version="[3.0.0,3.0.0]"; resolution:=mandatory [caused by:
Unable to resolve org.apache.openjpa/3.0.0: missing requirement
[org.apache.openjpa/3.0.0] osgi.wiring.package;