Re: Error with Camel JPA: java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy127
Thanks Jean. In the meanwhile I found out the root cause of the problem. For anybody else running into similar issue, Inside my blueprint I did NOT inject entityManagerFactory into my JpaComponent as following: Which was WRONG. This also explains that weird NoClassDefFoundError: at com.sun.proxy.$Proxy126.createEntityManager(Unknown Source) ~[?:?] at org.apache.camel.component.jpa.JpaHelper.getTargetEntityManager(JpaHelper.java:63) ~[67:org.apache.camel.camel-jpa:2.21.1] at org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:156) ~[67:org.apache.camel.camel-jpa:2.21.1] at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[?:?] ... 19 more Because the EntityManager reference being accessed there was simply null. After correcting as following all my Camel routes start working properly: On Sunday, June 17, 2018, 5:11:17 PM GMT+2, Jean-Baptiste Onofré wrote: Hi, it's not a feature (spring-legacy), it's a features repo. It should be part of your pom dependency set in order to the feature resolver to find it. Could you share your pom.xml ? Thanks, Regards JB On 17/06/2018 16:30, Markus Steiner wrote: > Hi > > Thanks a lot for your reply Jean, I really appreciate it. > > I don't exactly get your answer. Among others I do install spring-legacy > into my distribution as you see by my first post, that's: > > > org.apache.karaf.tooling > karaf-maven-plugin > ${karaf-version} > true > > > > > standard > enterprise > spring > spring-legacy > apache-camel > apache-cxf > activemq-karaf > hawtio-offline > my-own-app-feature > > ${jdk-version} > > > > > Do you mean I should try adding the spring-legacy repo into my own app > feature.xml? If so, I did include the following line into my feature.xml > like: > > mvn:org.apache.karaf.features/spring-legacy/${karaf-version}/xml/features > > Still no difference. And karaf-version is defined by my parent POM > (4.2.0) as you see it by my first post. > > The interesting point ist that the logged warning at the line: > > java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: > org.hibernate.jpa.spi.HibernateEntityManagerImplementor$QueryOptions not > found by org.apache.servicemix.bundles.spring-orm [160] > > Is really strange, as the hibernate > class HibernateEntityManagerImplementor is NOT inside > org.apache.servicemix.bundles.spring-orm bundle at all, but inside > hibernate-orm as far as I can say: > > https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java > > I have already a dependency to the hibernate feature (by my own feature > as you see above) which pulls hibernate-orm as well, see > > https://github.com/apache/karaf/blob/master/assemblies/features/enterprise/src/main/feature/feature.xml#L185 > > And about the main logged error above: > > Caused by: java.lang.NoClassDefFoundError: Could not initialize class > com.sun.proxy.$Proxy127 > > I've got no clue what the cause could be... > > Do you maybe have any other ideas I could try? > > On Sunday, June 17, 2018, 3:04:11 PM GMT+2, Jean-Baptiste Onofré > wrote: > > > Hi, > > did you add the spring-legacy features repo ? > > I think that's the problem. > > Regards > JB > > On 17/06/2018 11:53, Markus Steiner wrote: >> Hi >> >> I'm using my own Karaf distribution with the following versions and >> plugin setups: >> >> 5.15.4 >> 2.21.1 >> 3.2.4 >> 4.2.0 >> >> And: >> >> >> org.apache.karaf.tooling >> karaf-maven-plugin >> ${karaf-version} >> true >> >> >> >> >> standard >> enterprise >> spring >> spring-legacy >> apache-camel >> apache-cxf >> activemq-karaf >> hawtio-offline >> my-own-app-feature >> >> ${jdk-version} >> >> >> >> I also install the AMQ, Camel & CXF features: >> >> >> org.apache.activemq >> activemq-karaf >> ${activemq-version} >> features >> xml >> runtime >> >> >> >> org.apache.camel.karaf >> apache-camel >> ${camel-version} >> features >> xml >> runtime >> >> >> >> org.apache.cxf.karaf >> apache-cxf >> ${cxf-version} >> features >> xml >> runtime >> >> >> >> My feature.xml includes the following: >> >> install="auto"> >> my app >> version="${activemq-version}">activemq-broker-noweb >> activemq-client >> >> mvn:org.apache.activemq/activemq-osgi/${activemq-version} >> camel-blueprint >> camel-cxf >> camel-jms >> camel-jpa >> pax-jdbc-config >> pax-jdbc-h2 >>
unsubscribe
unsubscribe -- J.MOLIERE - Mentor/J
Re: Error with Camel JPA: java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy127
Hi, it's not a feature (spring-legacy), it's a features repo. It should be part of your pom dependency set in order to the feature resolver to find it. Could you share your pom.xml ? Thanks, Regards JB On 17/06/2018 16:30, Markus Steiner wrote: > Hi > > Thanks a lot for your reply Jean, I really appreciate it. > > I don't exactly get your answer. Among others I do install spring-legacy > into my distribution as you see by my first post, that's: > > > org.apache.karaf.tooling > karaf-maven-plugin > ${karaf-version} > true > > > > > standard > enterprise > spring > spring-legacy > apache-camel > apache-cxf > activemq-karaf > hawtio-offline > my-own-app-feature > > ${jdk-version} > > > > > Do you mean I should try adding the spring-legacy repo into my own app > feature.xml? If so, I did include the following line into my feature.xml > like: > > mvn:org.apache.karaf.features/spring-legacy/${karaf-version}/xml/features > > Still no difference. And karaf-version is defined by my parent POM > (4.2.0) as you see it by my first post. > > The interesting point ist that the logged warning at the line: > > java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: > org.hibernate.jpa.spi.HibernateEntityManagerImplementor$QueryOptions not > found by org.apache.servicemix.bundles.spring-orm [160] > > Is really strange, as the hibernate > class HibernateEntityManagerImplementor is NOT inside > org.apache.servicemix.bundles.spring-orm bundle at all, but inside > hibernate-orm as far as I can say: > > https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java > > I have already a dependency to the hibernate feature (by my own feature > as you see above) which pulls hibernate-orm as well, see > > https://github.com/apache/karaf/blob/master/assemblies/features/enterprise/src/main/feature/feature.xml#L185 > > And about the main logged error above: > > Caused by: java.lang.NoClassDefFoundError: Could not initialize class > com.sun.proxy.$Proxy127 > > I've got no clue what the cause could be... > > Do you maybe have any other ideas I could try? > > On Sunday, June 17, 2018, 3:04:11 PM GMT+2, Jean-Baptiste Onofré > wrote: > > > Hi, > > did you add the spring-legacy features repo ? > > I think that's the problem. > > Regards > JB > > On 17/06/2018 11:53, Markus Steiner wrote: >> Hi >> >> I'm using my own Karaf distribution with the following versions and >> plugin setups: >> >> 5.15.4 >> 2.21.1 >> 3.2.4 >> 4.2.0 >> >> And: >> >> >> org.apache.karaf.tooling >> karaf-maven-plugin >> ${karaf-version} >> true >> >> >> >> >> standard >> enterprise >> spring >> spring-legacy >> apache-camel >> apache-cxf >> activemq-karaf >> hawtio-offline >> my-own-app-feature >> >> ${jdk-version} >> >> >> >> I also install the AMQ, Camel & CXF features: >> >> >> org.apache.activemq >> activemq-karaf >> ${activemq-version} >> features >> xml >> runtime >> >> >> >> org.apache.camel.karaf >> apache-camel >> ${camel-version} >> features >> xml >> runtime >> >> >> >> org.apache.cxf.karaf >> apache-cxf >> ${cxf-version} >> features >> xml >> runtime >> >> >> >> My feature.xml includes the following: >> >> install="auto"> >> my app >> version="${activemq-version}">activemq-broker-noweb >> activemq-client >> >> mvn:org.apache.activemq/activemq-osgi/${activemq-version} >> camel-blueprint >> camel-cxf >> camel-jms >> camel-jpa >> pax-jdbc-config >> pax-jdbc-h2 >> hibernate >> jndi >> jpa >> transaction >> mvn:mypackageId/myartifactId/${project.version} >> >> osgi.jdbc.driver.name = H2 >> databaseName = camel;create=true >> dataSourceName = jndi/my-app-datasource >> >> >> >> >> I seem to have problem with my Camel JPA endpoints (both producer and >> consumer). When I start Karaf as my app ferature get's installed I see >> the following WARN log inside karaf.log: >> >> java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: >> org.hibernate.jpa.spi.HibernateEntityManagerImplementor$QueryOptions not >> found by org.apache.servicemix.bundles.spring-orm [160] >> at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?] >> at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:?] >> at >> > java.util.concurrent.AbstractExecutorService.doInvokeAny(AbstractExecutorService.java:193) >> ~[?:?] >> at >> >
Re: Error with Camel JPA: java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy127
Hi Thanks a lot for your reply Jean, I really appreciate it. I don't exactly get your answer. Among others I do install spring-legacy into my distribution as you see by my first post, that's: org.apache.karaf.tooling karaf-maven-plugin ${karaf-version} true standard enterprise spring spring-legacy apache-camel apache-cxf activemq-karaf hawtio-offline my-own-app-feature ${jdk-version} Do you mean I should try adding the spring-legacy repo into my own app feature.xml? If so, I did include the following line into my feature.xml like: mvn:org.apache.karaf.features/spring-legacy/${karaf-version}/xml/features Still no difference. And karaf-version is defined by my parent POM (4.2.0) as you see it by my first post. The interesting point ist that the logged warning at the line: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org.hibernate.jpa.spi.HibernateEntityManagerImplementor$QueryOptions not found by org.apache.servicemix.bundles.spring-orm [160] Is really strange, as the hibernate class HibernateEntityManagerImplementor is NOT inside org.apache.servicemix.bundles.spring-orm bundle at all, but inside hibernate-orm as far as I can say: https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java I have already a dependency to the hibernate feature (by my own feature as you see above) which pulls hibernate-orm as well, see https://github.com/apache/karaf/blob/master/assemblies/features/enterprise/src/main/feature/feature.xml#L185 And about the main logged error above: Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy127 I've got no clue what the cause could be... Do you maybe have any other ideas I could try? On Sunday, June 17, 2018, 3:04:11 PM GMT+2, Jean-Baptiste Onofré wrote: Hi, did you add the spring-legacy features repo ? I think that's the problem. Regards JB On 17/06/2018 11:53, Markus Steiner wrote: > Hi > > I'm using my own Karaf distribution with the following versions and > plugin setups: > > 5.15.4 > 2.21.1 > 3.2.4 > 4.2.0 > > And: > > > org.apache.karaf.tooling > karaf-maven-plugin > ${karaf-version} > true > > > > > standard > enterprise > spring > spring-legacy > apache-camel > apache-cxf > activemq-karaf > hawtio-offline > my-own-app-feature > > ${jdk-version} > > > > I also install the AMQ, Camel & CXF features: > > > org.apache.activemq > activemq-karaf > ${activemq-version} > features > xml > runtime > > > > org.apache.camel.karaf > apache-camel > ${camel-version} > features > xml > runtime > > > > org.apache.cxf.karaf > apache-cxf > ${cxf-version} > features > xml > runtime > > > > My feature.xml includes the following: > > > my app > activemq-broker-noweb > activemq-client > > mvn:org.apache.activemq/activemq-osgi/${activemq-version} > camel-blueprint > camel-cxf > camel-jms > camel-jpa > pax-jdbc-config > pax-jdbc-h2 > hibernate > jndi > jpa > transaction > mvn:mypackageId/myartifactId/${project.version} > > osgi.jdbc.driver.name = H2 > databaseName = camel;create=true > dataSourceName = jndi/my-app-datasource > > > > > I seem to have problem with my Camel JPA endpoints (both producer and > consumer). When I start Karaf as my app ferature get's installed I see > the following WARN log inside karaf.log: > > java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: > org.hibernate.jpa.spi.HibernateEntityManagerImplementor$QueryOptions not > found by org.apache.servicemix.bundles.spring-orm [160] > at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?] > at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:?] > at > java.util.concurrent.AbstractExecutorService.doInvokeAny(AbstractExecutorService.java:193) > ~[?:?] > at > java.util.concurrent.AbstractExecutorService.invokeAny(AbstractExecutorService.java:225) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$4.call(ScheduledExecutorServiceWrapper.java:182) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$15.call(ScheduledExecutorServiceWrapper.java:443) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.RWLock.runReadOperation(RWLock.java:33) > ~[?:?] > at >
unsubscribe
unsubscribe
Re: Error with Camel JPA: java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy127
Hi, did you add the spring-legacy features repo ? I think that's the problem. Regards JB On 17/06/2018 11:53, Markus Steiner wrote: > Hi > > I'm using my own Karaf distribution with the following versions and > plugin setups: > > 5.15.4 > 2.21.1 > 3.2.4 > 4.2.0 > > And: > > > org.apache.karaf.tooling > karaf-maven-plugin > ${karaf-version} > true > > > > > standard > enterprise > spring > spring-legacy > apache-camel > apache-cxf > activemq-karaf > hawtio-offline > my-own-app-feature > > ${jdk-version} > > > > I also install the AMQ, Camel & CXF features: > > > org.apache.activemq > activemq-karaf > ${activemq-version} > features > xml > runtime > > > > org.apache.camel.karaf > apache-camel > ${camel-version} > features > xml > runtime > > > > org.apache.cxf.karaf > apache-cxf > ${cxf-version} > features > xml > runtime > > > > My feature.xml includes the following: > > > my app > activemq-broker-noweb > activemq-client > > mvn:org.apache.activemq/activemq-osgi/${activemq-version} > camel-blueprint > camel-cxf > camel-jms > camel-jpa > pax-jdbc-config > pax-jdbc-h2 > hibernate > jndi > jpa > transaction > mvn:mypackageId/myartifactId/${project.version} > > osgi.jdbc.driver.name = H2 > databaseName = camel;create=true > dataSourceName = jndi/my-app-datasource > > > > > I seem to have problem with my Camel JPA endpoints (both producer and > consumer). When I start Karaf as my app ferature get's installed I see > the following WARN log inside karaf.log: > > java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: > org.hibernate.jpa.spi.HibernateEntityManagerImplementor$QueryOptions not > found by org.apache.servicemix.bundles.spring-orm [160] > at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?] > at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:?] > at > java.util.concurrent.AbstractExecutorService.doInvokeAny(AbstractExecutorService.java:193) > ~[?:?] > at > java.util.concurrent.AbstractExecutorService.invokeAny(AbstractExecutorService.java:225) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$4.call(ScheduledExecutorServiceWrapper.java:182) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$15.call(ScheduledExecutorServiceWrapper.java:443) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.RWLock.runReadOperation(RWLock.java:33) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.runUnlessShutdown(ScheduledExecutorServiceWrapper.java:440) > ~[?:?] > at > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.invokeAny(ScheduledExecutorServiceWrapper.java:177) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListener(BlueprintEventDispatcher.java:188) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListeners(BlueprintEventDispatcher.java:178) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintEventDispatcher.blueprintEvent(BlueprintEventDispatcher.java:133) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:426) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:278) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:299) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:268) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:264) > ~[?:?] > at > org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:254) > ~[?:?] > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) > ~[?:?] > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) > ~[?:?] > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) > ~[?:?] > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) > ~[?:?] > at > org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) > ~[?:?] > at >
Error with Camel JPA: java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy127
Hi I'm using my own Karaf distribution with the following versions and plugin setups: 5.15.4 2.21.1 3.2.4 4.2.0 And: org.apache.karaf.tooling karaf-maven-plugin ${karaf-version} true standard enterprise spring spring-legacy apache-camel apache-cxf activemq-karaf hawtio-offline my-own-app-feature ${jdk-version} I also install the AMQ, Camel & CXF features: org.apache.activemq activemq-karaf ${activemq-version} features xml runtime org.apache.camel.karaf apache-camel ${camel-version} features xml runtime org.apache.cxf.karaf apache-cxf ${cxf-version} features xml runtime My feature.xml includes the following: my app activemq-broker-noweb activemq-client mvn:org.apache.activemq/activemq-osgi/${activemq-version} camel-blueprint camel-cxf camel-jms camel-jpa pax-jdbc-config pax-jdbc-h2 hibernate jndi jpa transaction mvn:mypackageId/myartifactId/${project.version} osgi.jdbc.driver.name = H2 databaseName = camel;create=true dataSourceName = jndi/my-app-datasource I seem to have problem with my Camel JPA endpoints (both producer and consumer). When I start Karaf as my app ferature get's installed I see the following WARN log inside karaf.log: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org.hibernate.jpa.spi.HibernateEntityManagerImplementor$QueryOptions not found by org.apache.servicemix.bundles.spring-orm [160] at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:?] at java.util.concurrent.AbstractExecutorService.doInvokeAny(AbstractExecutorService.java:193) ~[?:?] at java.util.concurrent.AbstractExecutorService.invokeAny(AbstractExecutorService.java:225) ~[?:?] at org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$4.call(ScheduledExecutorServiceWrapper.java:182) ~[?:?] at org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$15.call(ScheduledExecutorServiceWrapper.java:443) ~[?:?] at org.apache.aries.blueprint.utils.threading.RWLock.runReadOperation(RWLock.java:33) ~[?:?] at org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.runUnlessShutdown(ScheduledExecutorServiceWrapper.java:440) ~[?:?] at org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.invokeAny(ScheduledExecutorServiceWrapper.java:177) ~[?:?] at org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListener(BlueprintEventDispatcher.java:188) ~[?:?] at org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListeners(BlueprintEventDispatcher.java:178) ~[?:?] at org.apache.aries.blueprint.container.BlueprintEventDispatcher.blueprintEvent(BlueprintEventDispatcher.java:133) ~[?:?] at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:426) ~[?:?] at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:278) ~[?:?] at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:299) ~[?:?] at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:268) ~[?:?] at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:264) ~[?:?] at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:254) ~[?:?] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) ~[?:?] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) ~[?:?] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) ~[?:?] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) ~[?:?] at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) ~[?:?] at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179) ~[?:?] at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730) ~[?:?] at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485) ~[?:?] at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?] at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?] at
Re: Web whiteboard: use whiteboard context instead of alias for servlet
Hey, I see in your code examples servlets but I can not see HttpContext instance. You specify org.osgi.service.http.HttpContext to be different than default but do not register service which have such id. Cheers, Łukasz -- Code-House http://code-house.org > On 16 Jun 2018, at 18:31, Steinar Bang wrote: > > I'm trying to replace alias with web context for a whiteboard servlet > started with DS. I tried to copy-paste an example that works and edit > it as needed. > > However the end result didn't work (I just got 404 on the path), and I > wonder where I went wrong...? > > I have this servlet that works, ie. I get the expected results on > "/ukelonn/*": > @Component( >property= { >HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN+"=/*", >HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT + "=(" + > HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME +"=ukelonn)", >HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME+"=ukelonn"}, >service=VaadinServlet.class, >immediate=true > ) > public class UkelonnServlet extends TouchKitServlet { > ... > } > > (it sort of works if the service is Servlet.class as well, just not as > well) > > So I have this: > @Component(service={Servlet.class}, property={"alias=/frontend-karaf-demo"} ) > public class ReactServlet extends HttpServlet { > ... > } > > and tried replacing this with: > @Component( >property= { >HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN+"=/*", >HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT + "=(" + > HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME +"=frontend-karaf-demo)", > > HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME+"=frontend-karaf-demo"}, >service=Servlet.class, >immediate=true > ) > public class ReactServlet extends HttpServlet { > ... > } > > But that just gave me 404 on /frontend-karaf-demo and > /frontend-karaf-demo/ > > So where did I go wrong? > > Thanks! >