RedHat Fuse 7.5 - Can't deploy feature - osgi

Using RedHat Fuse 7.5 for Apache Karaf platform on Windows 10. I'm defining the feature shown below:
...
<feature name="customers-data" version="${project.version}">
<feature>transaction</feature>
<feature>jndi</feature>
<feature>pax-jdbc-config</feature>
<feature>pax-jdbc-oracle</feature>
<feature>pax-jdbc-pool-dbcp2</feature>
<feature>jdbc</feature>
<feature dependency="true">aries-blueprint</feature>
<feature>jpa</feature>
<feature>hibernate</feature>
<bundle>...</bundle>
</feature>
...
Adding the the new repo works as expected but trying to install the feature:
karaf#root()> feature:install customers-data
raises the following exception:
2019-12-12 17:43:02,385 | WARN | ownloader-5-thread-7 | o.o.p.u.m.i.AetherBasedResolver | 5 - org.ops4j.pax.url.mvn - 2.6.1 | Error resolving artifact
org.apache.aries.jpa.javax.persistence:javax.persistence_2.1:jar:2.7.2: [Could not transfer artifact org.apache.aries.jpa.javax.persistence:javax.persistence_2.1:jar:2.7.2 from/to maven.central.repo
(https://repo1.maven.org/maven2/): Connect to repo1.maven.org:443 [repo1.maven.org/151.101.36.209] failed: connect timed out, Could not transfer artifact
org.apache.aries.jpa.javax.persistence:javax.persistence_2.1:jar:2.7.2 from/to redhat.ga.repo
(https://maven.repository.redhat.com/ga/): Connect to maven.repository.redhat.com:443
[maven.repository.redhat.com/23.60.31.183] failed: connect timed out
Looking up the features I got this:
karaf#root()> feature:list | grep aries-jpa
jpa | 2.7.2 | | Uninstalled | aries-jpa-2.7.2 | OSGi Persistence Container
karaf#root()>
So the feature aries-jpa-2.7.2 is registered. Trying to install it:
karaf#root()> feature:install jpa
raises the same exception as mentioned above.
Could any one please shad some light here ?
Many thanks in advance.
Kind regards,
Nicolas

The issue was caused by the fact that Karaf doesn't use the local maven install and its settings but its own one. So, when behind an HTTP proxy, as it was my case, one needs either to configure Karaf to use the HTTP proxy or to tell it to use the local maven settings. This happens in $KARAF_HOME/etc/org.ops4j.pax.url.mvn.cfg file.

Related

Bamboo-artifactory plugin dosen't work at elactic agent

I have a problem with bamboo-artifactory-plugin at bamboo elastic-agent. Build fail with error:
Could not execute task no Plugin with key 'org.jfrog.bamboo.bamboo-artifactory-plugin:maven3Task' is installed.
Bamboo agents on hardware run same build successfully.
I use Bamboo version 7.2, bamboo-artifactory-plugin version 3.2.1 and JFrog Artifactory version 6.18.1
As it looks like, the plugin is not installed on your agent. This may occur due to many reasons. Please try to reinstall the plugin and check the agent's logs.
For example, one possible reason is the lack of memory in the agent. If you see errors such as:
INFO | jvm 1 | 2020/11/10 11:12:36 | 2020-11-10 11:12:36,120 ERROR [remoteEventRebroadcasterMessageListenerContainer-1] [ScanningPluginLoader] Unable to deploy plugin 'org.jfrog.bamboo.bamboo-artifactory-plugin' from 'Unit: /Users/yahavi/bamboo-agent-home/plugins/user-installed/plugin_8527020839401694412_bamboo-artifactory-plugin-3.1.0.jar (1604999532000)'.
INFO | jvm 1 | 2020/11/10 11:12:36 | 2020-11-10 11:12:36,121 ERROR [remoteEventRebroadcasterMessageListenerContainer-1] [ScanningPluginLoader] Because of the following exception:
INFO | jvm 1 | 2020/11/10 11:12:36 | java.lang.OutOfMemoryError: GC overhead limit exceeded
That means your agent has insufficient heap size. I'd recommend on the resolution in this guide: https://confluence.atlassian.com/bamkb/outofmemory-errors-in-bamboo-server-or-in-remote-agent-307038120.html
Edit:
For Elastic agents, you can use this guide:
https://confluence.atlassian.com/bamkb/outofmemory-errors-in-bamboo-elastic-agent-826899144.html

JBoss Fuse: java.lang.IllegalStateException: Resource has no uri for installed bundle

I'm working on JBossFuse 6.2, have a CXF endpoint for which I needed to setup some special properties through httpj:engine-factory configuration block. Upon trying that I hited this issue
MapMetadataImpl not found by org.apache.cxf.cxf-rt-transports-http-jetty
The error was the following
> ERROR | pool-43-thread-1 | BlueprintContainerImpl | 14 -
> org.apache.aries.blueprint.core - 1.4.2 | Unable to start blueprint
> container for bundle test-ws java.lang.NoClassDefFoundError:
> org/apache/aries/blueprint/reflect/MapMetadataImpl at
> org.apache.cxf.transport.http_jetty.blueprint.JettyServerEngineFactoryParser.parseEngineConnector(JettyServerEngineFactoryParser.java:110)
> at
> org.apache.cxf.transport.http_jetty.blueprint.JettyServerEngineFactoryParser.parse(JettyServerEngineFactoryParser.java:83)
It appeared when trying to add the httpj block for CXF definition.
<httpj:engine-factory bus="cxf">
<httpj:engine port="${port}" host="${host}">
<httpj:threadingParameters minThreads="${minThreads}" maxThreads="${maxThreads}"/>
</httpj:engine>
</httpj:engine-factory>
I tried the solution provided, in the referred posts that is installing the osgi bundle for Blueprint Core Compatibility.
osgi:install mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core.compatibility/1.0.0
However, after installing the bundle upon container start I get the following exception:
2016-06-22 11:01:13,279 | ERROR | 63859-1-thread-1 | DeploymentAgent | ?? | 83 - io.fabric8.fabric-agent - 1.2.0.redhat-133 | Unable to update agent
java.lang.IllegalStateException: Resource has no uri
at io.fabric8.agent.service.Deployer.getBundleInputStream(Deployer.java:1354)[83:io.fabric8.fabric-agent:1.2.0.redhat-133]
at io.fabric8.agent.service.Deployer.deploy(Deployer.java:714)[83:io.fabric8.fabric-agent:1.2.0.redhat-133]
at io.fabric8.agent.service.Agent.provision(Agent.java:348)[83:io.fabric8.fabric-agent:1.2.0.redhat-133]
at io.fabric8.agent.service.Agent.provision(Agent.java:194)[83:io.fabric8.fabric-agent:1.2.0.redhat-133]
at io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:642)[83:io.fabric8.fabric-agent:1.2.0.redhat-133]
at io.fabric8.agent.DeploymentAgent$2.run(DeploymentAgent.java:256)[83:io.fabric8.fabric-agent:1.2.0.redhat-133]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_80]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_80]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_80]
Has anybody ever applied the proposed solution in JbossFuse? I don't event understand that much why that exception is being fired.
Thanks in advanced!
I anybody falls into this, I got an answer from someone at Red Hat. The problem I was having is that I was on a Fabric environment, so I had to add the OSGi Blueprint Core Compatibility bundle to the Karaf profile in the Fabric. It can be done from the karaf console by running the following command
profile-edit --bundles mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core.compatibility/1.0.0 karaf 1.x
Where 1.x is current fabric version in use.
If you are NOT on a fabric environment, then the solution posted above should work just as is.
Hope this helps!

OSGI bundle status grace period

I am trying to install two bundles on Karaf. For one of the bundle i am getting error and when I see the bundle:diag i got below message. It is the same thing compaining in logs also. Similar kind of bundle already deploy and it has the same dependencies. first one is working but the for second bundle i am getting below error. any thoughts?
opendaylight-user#root>bundle:diag
videoweb (421)
Status: GracePeriod
Blueprint
2/10/16 6:07 PM
Missing dependencies:
(objectClass=org.osgi.service.http.HttpService)
2016-02-10 23:54:07.113 GMT+00:00 [Blueprint Extender: 3] ERROR o.a.a.b.c.BlueprintContainerImpl - Unable to start blueprint container for bundle com.xyz.videosdn.tesweb due to unresolved dependencies [(objectClass=org.osgi.service.http.HttpService)]
java.util.concurrent.TimeoutException: null
at org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:336) [org.apache.aries.blueprint.core:1.4.0]
at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48) [org.apache.aries.blueprint.core:1.4.0]
The error means that your bundle has a mandatory reference to a service with the interface org.osgi.service.http.HttpService.
So you need to install a bundle that provides this service. In karaf this service is normally provided by pax-web. It can be installed using:
feature:install http

apache karaf faild to load web bundle

I downloaded the apache karaf 4.x and installed the 'war' feature and the karaf-doc bundle using following commands:
feature:install war
bundle:install -s mvn:org.apache.karaf/manual/4.0.0/war
but karaf failed to load that web bundle:
2016-01-17 17:16:36,167 | ERROR | pool-4-thread-1 | RegisterWebAppVisitorWC | 64 - org.ops4j.pax.web.pax-web-extender-war - 3.2.6 | Registration exception. Skipping.
java.lang.NoClassDefFoundError: javax/servlet/Filter
at java.lang.ClassLoader.defineClass1(Native Method)[:1.7.0_45]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)[:1.7.0_45]
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2279)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1501)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_45]
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1844)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
at org.ops4j.pax.swissbox.core.BundleClassLoader.findClass(BundleClassLoader.java:176)
at org.ops4j.pax.swissbox.core.BundleClassLoader.loadClass(BundleClassLoader.java:194)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_45]
at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorHS.loadClass(RegisterWebAppVisitorHS.java:244)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit(RegisterWebAppVisitorWC.java:261)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:652)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.register(WebAppPublisher.java:237)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:182)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$WebAppDependencyListener.addingService(WebAppPublisher.java:135)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)[karaf-org.osgi.core.jar:]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:864)[karaf-org.osgi.core.jar:]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[karaf-org.osgi.core.jar:]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[karaf-org.osgi.core.jar:]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)[karaf-org.osgi.core.jar:]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)[karaf-org.osgi.core.jar:]
at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:101)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.WebObserver.deploy(WebObserver.java:213)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.WebObserver$1.doStart(WebObserver.java:175)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.extender.SimpleExtension.start(SimpleExtension.java:58)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at org.ops4j.pax.web.extender.war.internal.extender.AbstractExtender$1.run(AbstractExtender.java:266)[64:org.ops4j.pax.web.pax-web-extender-war:3.2.6]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_45]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]
How can I fix this ?
The Karaf doc bundle in 4.0.0 actually had an issue if you do:
feature:install war
bundle:install -s mvn:org.apache.karaf/manual/4.0.3/war
it's working right away.
Just navigate to
http://localhost:8181/karaf-doc/
you're able to see the deployed applications via:
karaf#root()> web:list
ID | State | Web-State | Level | Web-ContextPath | Name
-----------------------------------------------------------------------------------------
97 | Active | Deployed | 80 | /karaf-doc | Apache Karaf :: Manual (4.0.3)
I doubt that OSGi is dying, actually the other way round, but that is a biased opinion.
Apache Karaf and ServiceMix based on it are ready for production, don't know about Virgo.

ServiceMix bundle status is "Active" even though bundle deployment fails

I have (intentionally created situation to test my CI setup) a bundle which does not have all dependencies configured correctly. When I deploy that the deployment fails with an exception as it should:
2014-02-07 09:17:15,738 | ERROR | rint Extender: 3 | BlueprintCamelContext | 103 - org.apache.camel.camel-blueprint - 2.10.7 | Error occurred during starting Camel: CamelContext(ura) due "org.xmlsoap.schemas.soap.envelope" doesnt contain ObjectFactory.class or jaxb.index
javax.xml.bind.JAXBException: "org.xmlsoap.schemas.soap.envelope" doesnt contain ObjectFactory.class or jaxb.index
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_11]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_11]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:143)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:310)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:412)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:375)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:279)[89:org.apache.servicemix.specs.jaxb-api-2.2:2.2.0]
at org.apache.camel.dataformat.soap.SoapJaxbDataFormat.createContext(SoapJaxbDataFormat.java:303)[206:org.apache.camel.camel-soap:2.10.7]
at org.apache.camel.converter.jaxb.JaxbDataFormat.doStart(JaxbDataFormat.java:254)[187:org.apache.camel.camel-jaxb:2.10.7]
at org.apache.camel.dataformat.soap.SoapJaxbDataFormat.doStart(SoapJaxbDataFormat.java:101)[206:org.apache.camel.camel-soap:2.10.7]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)[100:org.apache.camel.camel-core:2.10.7]
at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62)
The problem is that the bundle status is still "Active". Why?
karaf#root> osgi:list
START LEVEL 100 , List Threshold: 50
ID State Blueprint Spring Level Name
[ 242] [Active ] [Created ] [ ] [ 80] integraatiot-foo (1.0.0.SNAPSHOT)
I would like to setup my CI builds to that they detect failed bundles using http://code.citytechinc.com/osgi-bundle-status-maven-plugin/. This idea fails since bundle status is always "Active".
The bundle is active because it has been activated. This is normal. If an error occurred in some code within the bundle, that is nothing to do with the OSGi active state.
So you need to work out some way to report your internal failure such that it can be picked up by a CI build. I suggest using the OSGi LogService.
You'll need to make sure all your dependencies are required and with the correct version.
In this case it might be that the package your importing does existing in the wrong version.
Or better did you make sure you only import the right version of the package with [2,3.0) for example. Especially the stack trace makes it suspicious to me that your using import without version range and therefore do import the JRE jaxb classes which usually do have version 0.0.0
To check which bundles are actually used for import log in the shell and do a bundle:header [bundleID]

Resources