[JIRA] (WCARAV-6) Add sample project that demonstrates AEM integration for Caravan JAX-RS

147 views
Skip to first unread message

Paul Bjorkstrand (JIRA)

unread,
Jan 5, 2018, 6:04:41 PM1/5/18
to wcm-i...@googlegroups.com

Paul Bjorkstrand created WCARAV-6:

   Summary: Add sample project that demonstrates AEM integration for Caravan JAX-RS
       Key: WCARAV-6
       URL: https://wcm-io.atlassian.net/browse/WCARAV-6
   Project: wcm.io Caravan
Issue Type: Improvement
Components: JAX-RS
  Reporter: Paul Bjorkstrand

Currently, I see no usage instructions nor sample project that fully demonstrates usage of Caravan JAX-RS inside AEM. In trying to set it up, I have encountered numerous pitfalls (missing bundles, package conflicts, etc) that seem like they would warrant entries into the documentation.

— This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100075)

Paul Bjorkstrand (JIRA)

unread,
Jan 5, 2018, 6:07:13 PM1/5/18
to wcm-i...@googlegroups.com
[ https://wcm-io.atlassian.net/browse/WCARAV-6?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20645#comment-20645 ]

Paul Bjorkstrand commented on WCARAV-6:

If you have anything like this to help, I would greatly appreciate it being shared.

Paul Bjorkstrand (JIRA)

unread,
Jan 8, 2018, 10:45:16 PM1/8/18
to wcm-i...@googlegroups.com
[ https://wcm-io.atlassian.net/browse/WCARAV-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Bjorkstrand updated WCARAV-6:

Description: Currently, I see no usage instructions nor sample project that fully demonstrates usage of Caravan JAX-RS inside AEM (6.3). In trying to set it up, I have encountered numerous pitfalls (missing bundles, package conflicts, etc) that seem like they would warrant entries into the documentation.  (was: Currently, I see no usage instructions nor sample project that fully demonstrates usage of Caravan JAX-RS inside AEM. In trying to set it up, I have encountered numerous pitfalls (missing bundles, package conflicts, etc) that seem like they would warrant entries into the documentation.)

Add sample project that demonstrates AEM integration for Caravan JAX-RS

     Key: WCARAV-6
     URL: https://wcm-io.atlassian.net/browse/WCARAV-6
 Project: wcm.io Caravan
         Issue Type: Improvement
         Components: JAX-RS
Reporter: Paul Bjorkstrand

Currently, I see no usage instructions nor sample project that fully demonstrates usage of Caravan JAX-RS inside AEM (6.3). In trying to set it up, I have encountered numerous pitfalls (missing bundles, package conflicts, etc) that seem like they would warrant entries into the documentation.

Paul Bjorkstrand (JIRA)

unread,
Jan 8, 2018, 10:50:01 PM1/8/18
to wcm-i...@googlegroups.com

Paul Bjorkstrand commented on WCARAV-6:

Addendum: It looks like it is registering the servlet and all of the things it need so do. The registered servlet shows on the http whiteboard, but the {{service(…)}} method never gets called. I'm not sure right now if it is a version problem or what, but something just isn't going well in AEM 6.3. I did try to get the [JAX-RS OSGi Connector|https://github.com/hstaudacher/osgi-jax-rs-connector] working, and succeeded, to some extent, but I would much prefer to get this working.

Stefan Seifert (JIRA)

unread,
Jan 9, 2018, 3:53:13 AM1/9/18
to wcm-i...@googlegroups.com
[ https://wcm-io.atlassian.net/browse/WCARAV-6?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20648#comment-20648 ]

Stefan Seifert commented on WCARAV-6:

i will try to setup a small sample project.

what is your use usecase? # consuming REST services from outside in AEM # publishing REST services in AEM # using the caravan pipeline mechanics

Paul Bjorkstrand (JIRA)

unread,
Jan 9, 2018, 10:32:04 AM1/9/18
to wcm-i...@googlegroups.com

Paul Bjorkstrand commented on WCARAV-6:

The use case is publishing REST services from AEM. Basically, I am trying to get the following to work: {code:java} package project.jaxrs;

import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.osgi.service.component.annotations.Component; import io.wcm.caravan.jaxrs.publisher.JaxRsComponent;

@Component @Path("/test") @Produces(MediaType.APPLICATION_JSON) public class TestService implements JaxRsComponent {

@GET
public String get() {
  return "GET";
}
@GET
@Path("{id}")
public String getById(@PathParam("id") String id) {
  return "GET/" + id;
}

} {code}

The {{Caravan-JaxRs-ApplicationPath}} bundle instruction is set to {code:xml} <Caravan-JaxRs-ApplicationPath>/services</Caravan-JaxRs-ApplicationPath> {code}

What I am currently battling is that in AEM 6.3 SP1, the {{ServletContainerBridge}}'s {[service(..)}} method is not even being called (confirmed to be the problem by debugging). I have verified that the service & servlet are registered (both via the services listing and the Http Whiteboard).

Paul Bjorkstrand (JIRA)

unread,
Jan 9, 2018, 10:32:50 AM1/9/18
to wcm-i...@googlegroups.com

The use case is publishing REST services from AEM. Basically, I am trying to get the following to work: {code:java} package project.jaxrs;

import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.osgi.service.component.annotations.Component; import io.wcm.caravan.jaxrs.publisher.JaxRsComponent;

@Component @Path("/test") @Produces(MediaType.APPLICATION_JSON) public class TestService implements JaxRsComponent {

@GET
public String get() {
  return "GET";
}
@GET
@Path("{id}")
public String getById(@PathParam("id") String id) {
  return "GET/" + id;
}

} {code}

The {{Caravan-JaxRs-ApplicationPath}} bundle instruction is set to {code:xml} <Caravan-JaxRs-ApplicationPath>/services</Caravan-JaxRs-ApplicationPath> {code}

What I am currently battling is that in AEM 6.3 SP1, the {{ServletContainerBridge}}'s {[service(..)}} method is not even being called when I hit {{localhost:4502/services/test}} (confirmed to be the problem by debugging). I have verified that the service & servlet are registered (both via the services listing and the Http Whiteboard).

was (Author: paul.bjorkstrand): The use case is publishing REST services from AEM. Basically, I am trying to get the following to work: {code:java} package project.jaxrs;

Paul Bjorkstrand (JIRA)

unread,
Jan 9, 2018, 1:40:27 PM1/9/18
to wcm-i...@googlegroups.com

Add sample project that demonstrates AEM integration for Caravan JAX-RS

     Key: WCARAV-6
     URL: https://wcm-io.atlassian.net/browse/WCARAV-6
 Project: wcm.io Caravan
         Issue Type: Improvement
         Components: JAX-RS
Reporter: Paul Bjorkstrand

Currently, I see no usage instructions nor sample project that fully demonstrates usage of Caravan JAX-RS inside AEM (6.3). In trying to set it up, I have encountered numerous pitfalls (missing bundles, package conflicts, etc) that seem like they would warrant entries into the documentation.

Paul Bjorkstrand (JIRA)

unread,
Jan 9, 2018, 1:52:34 PM1/9/18
to wcm-i...@googlegroups.com

Paul Bjorkstrand commented on WCARAV-6:

More notes:

I have tried to pull apart the caravan functionality, and move only a barebones set of modified classes from caravan into my bundle It is almost working, but I get an exception on the call of {{ServletContainerBridge.init(ServletConfig)}}. I would be interested in knowing what the caravan does to not encounter this issue (if it does anything)

Obfuscated stack trace (removed client identifying text) {code} 09.01.2018 12:21:35.538 ERROR [qtp344374430-4310] org.apache.felix.http.jetty Error during calling init() on servlet jaxrs-servlet: ((OBFUSCATED)) (A MultiException has 6 exceptions. They are:

  1. javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

  2. javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

  3. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.server.validation.internal.ValidationBinder$DefaultValidatorFactoryProvider errors were found

  4. java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.server.validation.internal.ValidationBinder$DefaultValidatorFactoryProvider

  5. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.server.validation.internal.ValidationBinder$ConfiguredValidatorProvider errors were found

  6. java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.server.validation.internal.ValidationBinder$ConfiguredValidatorProvider

) org.glassfish.hk2.api.MultiException: A MultiException has 6 exceptions. They are:

  1. javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

  2. javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

  3. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.server.validation.internal.ValidationBinder$DefaultValidatorFactoryProvider errors were found

  4. java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.server.validation.internal.ValidationBinder$DefaultValidatorFactoryProvider

  5. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.server.validation.internal.ValidationBinder$ConfiguredValidatorProvider errors were found

  6. java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.server.validation.internal.ValidationBinder$ConfiguredValidatorProvider

    at org.jvnet.hk2.internal.Collector.throwIfErrors(Collector.java:89)
    at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:249)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:357)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
    at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
    at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2071)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:106)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88)
    at org.jvnet.hk2.internal.FactoryCreator.create(FactoryCreator.java:135)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
    at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(PerLookupContext.java:70)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2071)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:760)
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getUnqualifiedService(ServiceLocatorImpl.java:767)
    at org.jvnet.hk2.internal.IterableProviderImpl.get(IterableProviderImpl.java:111)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker$Builder.build(ResourceMethodInvoker.java:153)
    at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createInflector(RuntimeModelBuilder.java:128)
    at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createMethodRouter(RuntimeModelBuilder.java:115)
    at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createResourceMethodRouters(RuntimeModelBuilder.java:309)
    at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.buildModel(RuntimeModelBuilder.java:173)
    at org.glassfish.jersey.server.internal.routing.Routing$Builder.buildStage(Routing.java:196)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:585)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:182)
    at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:348)
    at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:345)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:345)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:384)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:362)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at ((OBFUSCATED)).jaxrs.framework.caravan.ServletContainerBridge.init(ServletContainerBridge.java:58)
    at org.apache.felix.http.base.internal.handler.ServletHandler.init(ServletHandler.java:122)
    at org.apache.felix.http.base.internal.registry.ServletRegistry.tryToActivate(ServletRegistry.java:358)
    at org.apache.felix.http.base.internal.registry.ServletRegistry.addServlet(ServletRegistry.java:161)
    at org.apache.felix.http.base.internal.registry.PerContextHandlerRegistry.registerServlet(PerContextHandlerRegistry.java:206)
    at org.apache.felix.http.base.internal.service.SharedHttpServiceImpl.registerServlet(SharedHttpServiceImpl.java:76)
    at org.apache.felix.http.base.internal.service.PerBundleHttpServiceImpl.registerServlet(PerBundleHttpServiceImpl.java:217)
    at ((OBFUSCATED)).jaxrs.framework.caravan.JaxApiInitializer$HttpServiceTracker.addingService(JaxApiInitializer.java:123)
    at ((OBFUSCATED)).jaxrs.framework.caravan.JaxApiInitializer$HttpServiceTracker.addingService(JaxApiInitializer.java:113)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
    at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
    at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
    at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
    at ((OBFUSCATED)).jaxrs.framework.caravan.JaxApiInitializer.activate(JaxApiInitializer.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224)
    at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39)
    at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617)
    at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501)
    at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:302)
    at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:294)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:298)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:109)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:749)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:675)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:430)
    at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:657)
    at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:341)
    at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:390)
    at org.apache.felix.scr.impl.Activator.access$200(Activator.java:54)
    at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:265)
    at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
    at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
    at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
    at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:517)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4542)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2173)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
    at org.apache.felix.webconsole.internal.core.BundlesServlet.doPost(BundlesServlet.java:364)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:563)
    at org.apache.felix.webconsole.internal.servlet.OsgiManager$3.run(OsgiManager.java:465)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:461)
    at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)
    at com.adobe.acs.commons.wcm.impl.AemEnvironmentIndicatorFilter.doFilter(AemEnvironmentIndicatorFilter.java:143)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:96)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:295)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:138)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:128)
    at org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Unknown Source)

Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
at org.glassfish.jersey.server.validation.internal.ValidationBinder$DefaultConfigurationProvider.provide(ValidationBinder.java:139)
at org.glassfish.jersey.server.validation.internal.ValidationBinder$DefaultConfigurationProvider.provide(ValidationBinder.java:110)
at org.jvnet.hk2.internal.FactoryCreator.create(FactoryCreator.java:153)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83)
at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2071)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:106)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:691)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:78)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:211)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:234)
... 132 common frames omitted

{code}

Stefan Seifert (JIRA)

unread,
Jan 9, 2018, 4:32:24 PM1/9/18
to wcm-i...@googlegroups.com

Stefan Seifert commented on WCARAV-6:

i've added a simple example application here: https://github.com/wcm-io-caravan/caravan-jaxrs/tree/develop/examples/aem-caravan-jaxrs-sample

from the stacktrace – maybe you've missed to deploy the {{hibernate-validator}} bundle to you instances? see list of deployed dependencies in my example.

Paul Bjorkstrand (JIRA)

unread,
Jan 9, 2018, 4:32:53 PM1/9/18
to wcm-i...@googlegroups.com

Paul Bjorkstrand commented on WCARAV-6:

I dug down, and think I found the issue, but have no proposal for a resolution, yet. I'll try to explain the issue as best as I can.

In the bundle {{jersey-bean-validation-2.20.jar}} there is a java service listed in {{META-INF/services}}. The service interface is {{org.glassfish.jersey.internal.spi.ForcedAutoDiscoverable}}, which exposes the {{org.glassfish.jersey.server.validation.internal.ValidationAutoDiscoverable}} service implementation.

This service locator is preventing glassfish from finding/creating a Validator implementation, which causes the thrown exception when calling {{ServletContainer.init(ServletConfig)}} (that is largely a guess, I don't know Glassfish/javax.validation that well).

When you remove that service locator from that jar, then rewrap it all together, it starts working just fine. After some heavy debugging, I found that the exact spot it was throwing, and made an educated guess as to the cause. To help guide my testing, I compared what was in the service registry in http://central.maven.org/maven2/com/eclipsesource/jaxrs/jersey-min/2.22.2/ to what was in the nested jars in http://central.maven.org/maven2/io/wcm/osgi/wrapper/io.wcm.osgi.wrapper.jersey/2.20-0000/ .

This was the first difference between the two, with respect to service locator. This explains why the JAX-RS OSGi Connector works, when using its dependencies, while Caravan does not, when using the listed dependencies (aka, the two different Jersey combined jars).

Paul Bjorkstrand (JIRA)

unread,
Jan 9, 2018, 5:01:38 PM1/9/18
to wcm-i...@googlegroups.com

Paul Bjorkstrand commented on WCARAV-6:

Heh, we both posted within a minute of each other :-)

I tried to add the dependencies, and it was still not working, but maybe I missed something. I'll take a look at your sample and try it out. I would much prefer to use the already available bundles, rather than having to generate & house one in the project.

Stefan Seifert (JIRA)

unread,
Jan 25, 2018, 7:16:04 AM1/25/18
to wcm-i...@googlegroups.com

Add sample project that demonstrates AEM integration for Caravan JAX-RS

     Key: WCARAV-6
     URL: https://wcm-io.atlassian.net/browse/WCARAV-6
 Project: wcm.io Caravan
         Issue Type: Improvement
         Components: JAX-RS
Reporter: Paul Bjorkstrand

Currently, I see no usage instructions nor sample project that fully demonstrates usage of Caravan JAX-RS inside AEM (6.3). In trying to set it up, I have encountered numerous pitfalls (missing bundles, package conflicts, etc) that seem like they would warrant entries into the documentation.

— This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100077)

Stefan Seifert (JIRA)

unread,
Aug 30, 2018, 9:35:22 AM8/30/18
to wcm-i...@googlegroups.com

[ https://wcm-io.atlassian.net/browse/WCARAV-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert closed WCARAV-6.
-------------------------------

> Add sample project that demonstrates AEM integration for Caravan JAX-RS
> -----------------------------------------------------------------------
>
> Key: WCARAV-6
> URL: https://wcm-io.atlassian.net/browse/WCARAV-6
> Project: wcm.io Caravan
> Issue Type: Improvement
> Components: JAX-RS
> Reporter: Paul Bjorkstrand
>
> Currently, I see no usage instructions nor sample project that fully demonstrates usage of Caravan JAX-RS inside AEM (6.3). In trying to set it up, I have encountered numerous pitfalls (missing bundles, package conflicts, etc) that seem like they would warrant entries into the documentation.



--
This message was sent by Atlassian Jira
(v1001.0.0-SNAPSHOT#100091)
Reply all
Reply to author
Forward
0 new messages