How below both deployments are different
<feature name="my-base-bundles" version="${project.version}">
<bundle start-level="86">mvn:com.my.osgi/mycomponent/0.0.1</bundle>
</feature>
and
bundle:install -s mvn:com.my.osgi/mycomponent/0.0.1
what i observed is deploying with feature shows service:list like
[com.my.osgi.mycomponent]
-----------------------------------------------------
instance.name = mycomponent.3c2c91a5-4c28-46c3-a08e-1470192ef353
service.bundleid = 76
service.factoryPid = com.my.osgi.mycomponent
service.id = 397
service.pid = com.my.osgi.mycomponent.3c2c91a5-4c28-46c3-a08e-1470192ef353
service.scope = bundle
and by deploying with bundle:install
[org.apache.felix.ipojo.Factory]
--------------------------------
component.class = com.my.osgi.mycomponent
component.description = factory name="com.my.osgi.mycomponent" bundle="77" state="valid" implementation-class="com.my.osgi.mycomponent"
requiredhandlers list="[org.apache.felix.ipojo:properties, org.apache.felix.ipojo:callback, org.apache.felix.ipojo:provides, org.apache.felix.ipojo:architect
ure]"
missinghandlers list="[]"
provides specification="com.my.osgi.mycomponent"
inherited interfaces="[com.my.osgi.mycomponent]" superclasses="[]"
component.providedServiceSpecifications = [com.my.osgi.mycomponent]
factory.name = com.my.osgi.mycomponent
factory.state = 1
service.bundleid = 77
service.id = 153
service.pid = com.my.osgi.mycomponent
service.scope = singleton
it work fine but my pax-exam tests are getting failed as after installing i look for service
serviceReferences = this.bundleContext.getServiceReferences("com.my.osgi.mycomponent", filter);
how i should deploy in pax-exam so i can access services like feature deployments?
The start level is different between the two installations.
Feature installation: start level = 86 explicitly
bundle installation: start level = defaut = 90 implicitly
So try to install the bundle with the some start-level value
Related
In a sbt project, how to get full list of dependencies(including transitive dependencies) with scope?
For Example:
xxx.jar(Compile)
yyy.jar(Provided)
zzz.jar(Test)
...
From the sbt shell you can execute one or all of the following commands:
Test / fullClasspath
Runtime / fullClasspath
Compile / fullClasspath
Which will output the jars associated with the scope (Test/Runtime/Compile).
If you want to get a bit more fancy, sbt provides a number of ways of interacting with the outputs generated through the dependency management system. The documentation is here.
For example, you could add this to your build.sbt file:
lazy val printReport = taskKey[Unit]("Report which jars are in each scope.")
printReport := {
val updateReport: UpdateReport = update.value
val jarFilter: ArtifactFilter = artifactFilter(`type` = "jar")
val testFilter = configurationFilter(name = "test")
val compileFilter = configurationFilter(name = "compile")
val testJars = updateReport.matching(jarFilter && testFilter)
val compileJars = updateReport.matching(jarFilter && compileFilter)
println("Test jars:\n===")
for (jar <- testJars.sorted) yield {println(jar.getName)}
println("\n\n******\n\n")
println("compile jars:\n===")
for (jar <- compileJars.sorted) yield {println(jar.getName)}
}
It creates a new task printReport which can be executed like a normal sbt command with sbt printReport. It takes the value of the UpdateReport which is generated by the update task, and then filters for jar files in the respective test/compile scopes before printing the results.
I am trying to configure gateway access log of wso2 apim (4.0.0) to be written to a separate log file every day so that it should contain api username and api name in a log file. To form the structure of the log file I followed the answer of following question.
The log file structure I have as below:
datetime | remoteIp | username | invoked_api_name | api_url | request | response
Now all entries is being written in wso2carbon.log
I would like it to be written in a file with following pattern:
custom_access_log_gwyyyy-mm-dd.log
Any help is welcome!
You can introduce an extra Log Appender to log the specific Handler logs in it. Find sample instructions below
Open the <apim>/repository/conf/log4j2.properties and add the following to create a Log Appender
appender.APIHANDLER_LOG.type = RollingFile
appender.APIHANDLER_LOG.name = APIHANDLER_LOG
appender.APIHANDLER_LOG.fileName = ${sys:carbon.home}/repository/logs/api-log.log
appender.APIHANDLER_LOG.filePattern = ${sys:carbon.home}/repository/logs/api-log-%d{MM-dd-yyyy}.log
appender.APIHANDLER_LOG.layout.type = PatternLayout
appender.APIHANDLER_LOG.layout.pattern = TID: [%tenantId] [%appName] [%d] %5p {%c} - %m%ex%n
appender.APIHANDLER_LOG.policies.type = Policies
appender.APIHANDLER_LOG.policies.time.type = TimeBasedTriggeringPolicy
appender.APIHANDLER_LOG.policies.time.interval = 1
appender.APIHANDLER_LOG.policies.time.modulate = true
appender.APIHANDLER_LOG.policies.size.type = SizeBasedTriggeringPolicy
appender.APIHANDLER_LOG.policies.size.size=10MB
appender.APIHANDLER_LOG.strategy.type = DefaultRolloverStrategy
appender.APIHANDLER_LOG.strategy.max = 20
appender.APIHANDLER_LOG.filter.threshold.type = ThresholdFilter
appender.APIHANDLER_LOG.filter.threshold.level = DEBUG
Add the created Appender to the appenders property at the top of the log4j2.properties
appenders=APIHANDLER_LOG, CARBON_CONSOLE, ..
Configure your package to log into the new Appender
logger.api-log-handler.name = com.sample.handlers.APILogHandler
logger.api-log-handler.level = DEBUG
logger.api-log-handler.appenderRef.APIHANDLER_LOG.ref = APIHANDLER_LOG
logger.api-log-handler.additivity = false
loggers = api-log-handler, AUDIT_LOG, ...
Save the configurations and invoke the API. Now the logs will be printed to a file called api-log.log.
I am new to Corda development and am trying to configure a Corda java template for Hello World, downloaded template while syncing the gradle throwing below error:
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.1.60/kotlin-stdlib-jre8-1.1.60.jar'.
at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.java:198)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.access$300(DefaultCacheAwareExternalResourceAccessor.java:55)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:88)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:80)
at org.gradle.cache.internal.ProducerGuard$AdaptiveProducerGuard.guardByKey(ProducerGuard.java:97)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:80)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:97)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.resolveArtifact(DefaultExternalResourceArtifactResolver.java:67)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.download(ExternalResourceResolver.java:310)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.resolveArtifact(ExternalResourceResolver.java:296)
... 27 more
build.gradle details
ext {
corda_release_group = 'net.corda'
corda_release_version = '3.3-corda'
corda_gradle_plugins_version = '3.2.1'
junit_version = '4.12'
quasar_version = '0.7.9'
spring_boot_version = '2.0.2.RELEASE'`enter code here`
spring_boot_gradle_plugin_version = '2.0.2.RELEASE'
slf4j_version = '1.7.25'
log4j_version = '2.9.1'
}
Looks like you are using an very old version of the CorDapp template. Your build.gradle says Corda version 3.3
Whereas, we are currently 4.4 right now. Please download a copy of the latest template and work on it. https://github.com/corda/cordapp-template-java
I have installed kilo devstack and have enabled the ceilometer. So It is showing me Resource Usage panel on Admin Dashboard. But my stats tab is not showing any graph for any matrix.
ceilometer.conf
[DEFAULT]
policy_file = /etc/ceilometer/policy.json
debug = True
verbose = True
notification_topics = notifications
rpc_backend = rabbit
[oslo_messaging_rabbit]
rabbit_userid = stackrabbit
rabbit_password = stackqueue
rabbit_hosts = 10.0.2.15
[service_credentials]
os_auth_url = http://10.0.2.15:5000/v2.0
os_region_name = RegionOne
os_tenant_name = service
os_password = nomoresecrete
os_username = ceilometer
[keystone_authtoken]
signing_dir = /var/cache/ceilometer
cafile = /opt/stack/data/ca-bundle.pem
auth_uri = http://10.0.2.15:5000
project_domain_id = default
project_name = service
user_domain_id = default
password = nomoresecrete
username = ceilometer
auth_url = http://10.0.2.15:35357
auth_plugin = password
[notification]
store_events = True
[database]
metering_connection = mongodb://localhost:27017/ceilometer
event_connection = mongodb://localhost:27017/ceilometer
alarm_connection = mongodb://localhost:27017/ceilometer
Please check How I enabled the ceilometer in openstack (kilo) dashboard
First go in devstack directory and search local.conf file
Paste the following content in local.conf
# Enable the ceilometer metering services
enable_service ceilometer-acompute ceilometer-acentral ceilometer-anotification ceilometer-collector
# Enable the ceilometer alarming services
enable_service ceilometer-alarm-evaluator,ceilometer-alarm-notifier
# Enable the ceilometer api services
enable_service ceilometer-api
Run the following command in devstack directory
./unstack.sh ./rejoin-stack.sh
My dashboard is showing the Resource usage in admin section but it is not showing any graph regarding the resource usage on stats tab. Please help me on this.
Stats Tab on Resource Usage is not showing any graph for any matrix, Please see the image.
I have configured Plone with the following buildout (via http://build.pythonpackages.com/buildout/plone/4.2.x):
[buildout]
allow-hosts =
*.plone.org
*.python.org
extensions = buildout.bootstrap
extends = http://dist.plone.org/release/4.2b1/versions.cfg
find-links = http://dist.plone.org/thirdparty/elementtree-1.2.7-20070827-preview.zip
parts =
mod-wsgi
plone
plone-mod-wsgi
plone-paste
versions = versions
[mod-wsgi]
recipe = collective.recipe.modwsgi
eggs = ${plone:eggs}
config-file = ${buildout:directory}/plone-mod-wsgi.ini
[plone]
recipe = plone.recipe.zope2instance
eggs =
PasteScript
Pillow
Plone
WebError
repoze.retry
repoze.tm2
repoze.vhm
products =
user = admin:admin
scripts = paster
[plone-mod-wsgi]
recipe = collective.recipe.template
url = http://build.pythonpackages.com/buildout/plone/plone-mod-wsgi.ini.in
output = ${buildout:directory}/plone-mod-wsgi.ini
[plone-paste]
recipe = collective.recipe.template
url = http://build.pythonpackages.com/buildout/plone/plone-paste.ini.in
output = ${buildout:directory}/plone-paste.ini
[versions]
distribute = 0.6.24
zc.buildout = 1.5.2
Zope2 = 2.13.11
And Apache with the following config:
<VirtualHost *:80>
…
# Use only 1 Python sub-interpreter. Multiple sub-interpreters
# play badly with C extensions.
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess plone user=aclark group=staff processes=1 \
threads=4 \
python-path=/srv/aclark.net/eggs
WSGIScriptAlias / /srv/aclark.net/parts/mod-wsgi/wsgi
<Directory /srv/aclark.net>
WSGIProcessGroup plone
Order allow,deny
Allow from all
SetEnv HTTP_X_VHM_HOST http://aclark.net
SetEnv HTTP_X_VHM_ROOT /Plone
</Directory>
</VirtualHost>
My "declarative" WSGI configuration (called by /srv/aclark.net/parts/mod-wsgi/wsgi) looks like this:
[app:plone]
use = egg:Zope2#main
zope_conf = /srv/aclark.net/parts/plone/etc/zope.conf
[pipeline:main]
pipeline =
egg:repoze.retry#retry
egg:repoze.tm2#tm
egg:repoze.vhm#vhm_xheaders
plone
# Begin logging configuration
[loggers]
keys = root
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
# End logging configuration
This all partially works, by loading http://aclark.net/Plone when you ask for http://aclark.net. However Zope2 is still generating URLs that begin with http://aclark.net/Plone.
Am I missing something? Or is this a Zope2 bug (not doing the right thing when conifgured w/repoze.vhm)
what about:
[filter:vhm]
use = egg:repoze.vhm#vhm_explicit
host = http://www.example.com
root = /mysite
Full WSGI support for Zope2 is still a work in progress. See:
https://mail.zope.org/pipermail/zope-dev/2012-January/043930.html