File not found errors when trying to setup asciidoctor - build.gradle

I am trying to configure asciidoctor with Spring restdocs. I am upgrading it from org.asciidoctor.convert to org.asciidoctor.jvm.convert but am getting the error that it can't find the pages and load the snippets. And based on the errors I get it doesn't do anything with the configurations I set inside my gradle build file. I have tried to add asciidoctorExtensions in order to replace the deprecated asciidoctor but nothing seems to work.
The errors:
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/substitutors.rb sub_macros
INFO: possible invalid reference: synchronization
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb preprocess_include_directive
SEVERE: errors.adoc: line 23: include file not found: C:/Users/User/Documents/Projects/Trips/{snippets}/send not serializable date/response-body.adoc
include file not found: C:/Users/User/Documents/Projects/Trips/{snippets}/send not serializable date/response-body.adoc :: errors.adoc :: C:/Users/User/Documents/Projects/Trips/C:/Users/User/Documents/Projects/Trips/src/main/docs/errors.adoc:23 (uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb:preprocess_include_directive)
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb preprocess_include_directive
SEVERE: index.adoc: line 51: include file not found: C:/Users/User/Documents/Projects/Trips/synchronization.adoc
include file not found: C:/Users/User/Documents/Projects/Trips/synchronization.adoc :: index.adoc :: C:/Users/User/Documents/Projects/Trips/C:/Users/User/Documents/Projects/Trips/src/main/docs/index.adoc:51 (uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb:preprocess_include_directive)
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb preprocess_include_directive
SEVERE: index.adoc: line 67: include file not found: C:/Users/User/Documents/Projects/Trips/errors.adoc
include file not found: C:/Users/User/Documents/Projects/Trips/errors.adoc :: index.adoc :: C:/Users/User/Documents/Projects/Trips/C:/Users/User/Documents/Projects/Trips/src/main/docs/index.adoc:67 (uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb:preprocess_include_directive)
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb preprocess_include_directive
SEVERE: index.adoc: line 78: include file not found: C:/Users/User/Documents/Projects/Trips/app-user-settings.adoc
include file not found: C:/Users/User/Documents/Projects/Trips/app-user-settings.adoc :: index.adoc :: C:/Users/User/Documents/Projects/Trips/C:/Users/User/Documents/Projects/Trips/src/main/docs/index.adoc:78 (uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb:preprocess_include_directive)
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb preprocess_include_directive
SEVERE: index.adoc: line 82: include file not found: C:/Users/User/Documents/Projects/Trips/miscellaneous-calls.adoc
include file not found: C:/Users/User/Documents/Projects/Trips/miscellaneous-calls.adoc :: index.adoc :: C:/Users/User/Documents/Projects/Trips/C:/Users/User/Documents/Projects/Trips/src/main/docs/index.adoc:82 (uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb:preprocess_include_directive)
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/html5.rb convert_document
WARNING: C:/Users/User/Documents/Projects/Trips/src/main/docs/index.adoc: stylesheet does not exist or cannot be read: C:/Users/User/Documents/Projects/Trips/riak.css
jun. 18, 2021 2:56:10 P.M. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/substitutors.rb sub_macros
C:/Users/User/Documents/Projects/Trips/src/main/docs/index.adoc: stylesheet does not exist or cannot be read: C:/Users/User/Documents/Projects/Trips/riak.css
Build.gradle:
plugins {
id("org.asciidoctor.jvm.convert") version "3.3.2"
...
kotlin("jvm") version "1.5.10"
kotlin("plugin.spring") version "1.5.10"
}
val asciidoctorExtensions: Configuration by configurations.creating
dependencies {
...
asciidoctorExtensions("org.springframework.restdocs:spring-restdocs-asciidoctor")
}
val snippetsDir by extra { file("build/generated-snippets") }
tasks.test {
useJUnitPlatform()
outputs.dir(snippetsDir)
mustRunAfter(tasks.flywayMigrate.get())
}
tasks.asciidoctor {
asciidoctorExtensions
sourceDir("src/main/docs")
inputs.dir(snippetsDir)
attributes["snippets"] = file(snippetsDir)
attributes["environment-${project.properties["spring.profiles.active"]}"] = true
dependsOn(tasks.test.get())
}
Index.adoc:
:toc: left
:sectlinks:
:sectnums:
:sectnumlevels: 5
:toc: left
:toclevels: 2
:page-layout: docs
:source-highlighter: highlightjs
:stylesheet: riak.css
...
include::errors.adoc[]
include::synchronization.adoc[]
include::app-user-settings.adoc[]
Errors.adoc:
[[errors, Errors]]
== Errors
...
[[not_serializable_date]]
==== Incorrect dateformat
include::{snippets}/send{sp}not{sp}serializable{sp}date/response-body.adoc[]
App-user-settings.adoc:
[[app_user_settings, AppUserSetting(s)]]
== AppUserSetting(s)
[.lead]
...
=== Create
...
[.tabs]
--
operation::create{sp}a{sp}app{sp}user{sp}setting[snippets='request-fields,request-body,curl-request,http-request,httpie-request']
--
What am I doing wrong / what do I have to change to have it work correctly?

You'll find a working example for Gradle here: https://github.com/spring-projects/spring-restdocs/blob/main/samples/rest-notes-spring-hateoas/build.gradle
Please note: There is no need to set the snippets attribute: It is set automatically by the spring-restdocs-asciidoctor extension.

Related

Cannot serve with SQLJocky (Undefined class 'SHA1' & Other errors)

if I try to serve my dart application get these error:
Serving `web` on http://localhost:80 [INFO]
------------------------------------------------------------------------ [INFO] Starting Build [INFO] Updating asset graph completed, took 15ms [WARNING] build_web_compilers|entrypoint on web/main.dart: Unable to read sqljocky|lib/sqljocky.ddc.js, check your console or the `.dart_tool/build/generated/sqljocky/lib/sqljocky.ddc.js.errors` log file. [INFO] Running build completed, took 22.2s [INFO] Caching finalized dependency graph completed, took 622ms [SEVERE] build_web_compilers|ddc on package:sqljocky/sqljocky.module: Error compiling dartdevc module:sqljocky|lib/sqljocky.ddc.js
[error] Undefined class 'SHA1'. (package:sqljocky/src/auth/auth_handler.dart, line 24, col 24) [error] Undefined class 'SHA1'. (package:sqljocky/src/auth/auth_handler.dart, line 28, col 20) [error] Undefined class 'SHA1'. (package:sqljocky/src/auth/auth_handler.dart, line 32, col 20) [error] Invalid override. The type of 'ConnectionPool._removeConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._removeConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/connection_pool.dart, line 85, col 3) [error] Invalid override. The type of 'ConnectionPool._releaseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._releaseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/connection_pool.dart, line 89, col 3) [error] Invalid override. The type of 'ConnectionPool._reuseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._reuseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/connection_pool.dart, line 105, col 3) [error] Invalid override. The type of '_QuitHandler.processResponse' ('(Buffer) → dynamic') isn't a subtype of '_Handler.processResponse' ('(Buffer) → _HandlerResponse'). (package:sqljocky/src/handlers/quit_handler.dart, line 14, col 3) [error] Invalid override. The type of 'Query._releaseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._releaseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/query.dart, line 170, col 3) [error] Invalid override. The type of 'Query._reuseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._reuseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/query.dart, line 179, col 3) [error] Invalid override. The type of 'Query._removeConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._removeConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/query.dart, line 185, col 3) [error] Invalid override. The type of 'Transaction._releaseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._releaseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/transaction.dart, line 85, col 3) [error] Invalid override. The type of 'Transaction._reuseConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._reuseConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/transaction.dart, line 89, col 3) [error] Invalid override. The type of 'Transaction._removeConnection' ('(_Connection) → dynamic') isn't a subtype of '_ConnectionHelpers._removeConnection' ('(dynamic) → dynamic'). (package:sqljocky/src/transaction.dart, line 93, col 3)
Please fix all errors before compiling (warnings are okay). }
[SEVERE] Failed after 22.8s
I'm not using any function of SQLJocky, these are my imports:
import 'dart:async';
import 'dart:convert';
import 'package:angular/angular.dart';
import 'package:angular_components/angular_components.dart';
import 'package:sqljocky/sqljocky.dart';
import 'package:sqljocky/utils.dart';
import 'package:options_file/options_file.dart';
My pubspec.yaml:
name: MyDartPage
description: A web app that uses AngularDart Components
# version: 1.0.0
# homepage: https://www.example.com
# author: Mattia <email#example.com>
environment:
sdk: '>=2.0.0-dev.66.0 <2.0.0'
dependencies:
angular: any
angular_components: any
sqljocky: any
dev_dependencies:
angular_test: any
build_runner: any
build_test: any
build_web_compilers: any
test: any
before it looked like this:
name: MyDartPage
description: A web app that uses AngularDart Components
# version: 1.0.0
# homepage: https://www.example.com
# author: Mattia <email#example.com>
environment:
sdk: '>=2.0.0-dev.66.0 <2.0.0'
dependencies:
angular: ^5.0.0-beta
angular_components: ^0.9.0-beta
sqljocky: ^0.14.0
dev_dependencies:
angular_test: ^2.0.0-beta
build_runner: ^0.9.0
build_test: ^0.10.2
build_web_compilers: ^0.4.0
test: ^1.0.0
but I had to change it due this errors:
Because every version of build_runner depends on crypto >=0.9.2 <3.0.0
and crypto >=0.9.2 <2.0.1 depends on convert ^1.0.0, every version of
build_runner requires convert ^1.0.0 or crypto ^2.0.1. And because
build_runner >=0.6.1 depends on convert ^2.0.1 and sqljocky >=0.7.0
depends on crypto ^0.9.0, build_runner >=0.6.1 is incompatible with
sqljocky >=0.7.0. So, because MyDartPage depends on both sqljocky
^0.14.0 and build_runner ^0.9.0, version solving failed.
My dart version it's:
Dart VM version: 2.0.0-dev.67.0 (Tue Jul 3 18:17:07 2018 +0200) on
"windows_x64"
How can I fix both errors?
I solved using SQLJocky5 but on Dart 2 I had to make a PR to fix that:
https://github.com/dart-db/sqljocky5/pull/10

Google cloud compute engine freeze

Today I found out that my vm instance in the google cloud had an issue.
I could not connect via gcloud compute ssh. The only solution was to shut the vm down and restart it.
I guess I found the right log file where the error happened.
/var/log/daemon.log
Nov 23 17:39:01 globo-de systemd[1]: Started Clean php session files.
Nov 23 18:09:01 globo-de systemd[1]: Starting Clean php session files...
Nov 23 18:09:03 globo-de systemd[1]: Started Clean php session files.
Nov 23 18:39:01 globo-de systemd[1]: Starting Clean php session files...
Nov 23 18:39:04 globo-de systemd[1]: Started Clean php session files.
Nov 23 18:56:49 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 18:57:43 globo-de google-accounts: ERROR Exception calling the response handler. [Errno 12] Cannot allocate memory.#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/metadata_watcher.py", line 196, in WatchMetadata#012 handler(response)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 259, in HandleAccounts#012 self.oslogin.UpdateOsLogin(enable=False)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 79, in UpdateOsLogin#012 status = self._GetStatus()#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 60, in _GetStatus#012 retcode = self._RunOsLoginControl('status')#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 47, in _RunOsLoginControl#012 return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT, action])#012 File "/usr/lib/python2.7/subprocess.py", line 168, in call#012 return Popen(*popenargs, **kwargs).wait()#012 File "/usr/lib/python2.7/subprocess.py", line 390, in __init__#012 errread, errwrite)#012 File "/usr/lib/python2.7/subprocess.py", line 916, in _execute_child#012 self.pid = os.fork()#012OSError: [Errno 12] Cannot allocate memory
Nov 23 18:58:02 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 18:59:35 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 18:59:54 globo-de google-accounts: ERROR Exception calling the response handler. [Errno 12] Cannot allocate memory.#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/metadata_watcher.py", line 196, in WatchMetadata#012 handler(response)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 259, in HandleAccounts#012 self.oslogin.UpdateOsLogin(enable=False)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 79, in UpdateOsLogin#012 status = self._GetStatus()#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 60, in _GetStatus#012 retcode = self._RunOsLoginControl('status')#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 47, in _RunOsLoginControl#012 return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT, action])#012 File "/usr/lib/python2.7/subprocess.py", line 168, in call#012 return Popen(*popenargs, **kwargs).wait()#012 File "/usr/lib/python2.7/subprocess.py", line 390, in __init__#012 errread, errwrite)#012 File "/usr/lib/python2.7/subprocess.py", line 916, in _execute_child#012 self.pid = os.fork()#012OSError: [Errno 12] Cannot allocate memory
Nov 23 19:03:53 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 19:07:52 globo-de google-accounts: ERROR Exception calling the response handler. [Errno 12] Cannot allocate memory.#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/metadata_watcher.py", line 196, in WatchMetadata#012 handler(response)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 259, in HandleAccounts#012 self.oslogin.UpdateOsLogin(enable=False)#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 79, in UpdateOsLogin#012 status = self._GetStatus()#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 60, in _GetStatus#012 retcode = self._RunOsLoginControl('status')#012 File "/usr/lib/python2.7/dist-packages/google_compute_engine/accounts/oslogin_utils.py", line 47, in _RunOsLoginControl#012 return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT, action])#012 File "/usr/lib/python2.7/subprocess.py", line 168, in call#012 return Popen(*popenargs, **kwargs).wait()#012 File "/usr/lib/python2.7/subprocess.py", line 390, in __init__#012 errread, errwrite)#012 File "/usr/lib/python2.7/subprocess.py", line 916, in _execute_child#012 self.pid = os.fork()#012OSError: [Errno 12] Cannot allocate memory
Nov 23 19:09:37 globo-de google-ip-forwarding: WARNING Exception running ['ip', 'route', 'ls', 'table', 'local', 'type', 'local', 'scope', 'host', 'dev', 'eth0', 'proto', '66']. [Errno 12] Cannot allocate memory.
Nov 23 19:11:32 globo-de systemd[1]: phpsessionclean.service: Failed to fork: Cannot allocate memory
Nov 23 19:11:56 globo-de systemd[1]: phpsessionclean.service: Failed to run 'start' task: Cannot allocate memory
Nov 23 19:12:24 globo-de systemd[1]: Failed to start Clean php session files.
Nov 23 19:12:50 globo-de systemd[1]: phpsessionclean.service: Unit entered failed state.
Nov 23 19:13:37 globo-de systemd[1]: phpsessionclean.service: Failed with result 'resources'.
Nov 23 19:14:58 globo-de systemd[1]: apt-daily.service: Failed to fork: Cannot allocate memory
Nov 23 19:16:13 globo-de systemd[1]: apt-daily.service: Failed to run 'start' task: Cannot allocate memory
What can I do to prevent that from happening again?
I guess the problem was that the google-cloud-compute engine vm had no swap file. So I created one with the following commands I found on google.
sudo dd if=/dev/zero of=/var/swap bs=2048 count=524288
sudo chmod 600 /var/swap
sudo mkswap /var/swap
sudo swapon /var/swap
Then I added the following line to /etc/fstab to make it permanent.
/var/swap none swap sw 0 0
Another solution is to avoid swapping setting vm.swappiness to 0.
# sysctl -w vm.swappiness=0
However, it sounds me more like an OS image issue than google clouds.

FIWARE IDM installation error

I tried to install Fiware IDM in Ubuntu 12.04 from scratch (just only Ubuntu 12.04 was installed, no any more packages). I have followed the guide https://github.com/ging/fi-ware-idm/wiki/Installation-guide
Installation finished OK, but when I try to start fi-lab home page, http://localhost:8000, I've got the following error:
DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
DeprecationWarning: The oslo namespace package is deprecated. Please use oslo_config instead.
Validating models...
0 errors found
July 09, 2015 - 13:17:37
Django version 1.6.11, using settings 'openstack_dashboard.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
DEBUG:idm_logger:Creating a new internal keystoneclient connection to https://127.0.0.1:5000/v3.
InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
WARNING:py.warnings:InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
Recoverable error: SSL exception connecting to https://127.0.0.1:5000/v3/auth/tokens
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/juan/idm/horizon/.venv/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/home/juan/idm/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
self.load_middleware()
File "/home/juan/idm/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware
mw_instance = mw_class()
File "/home/juan/idm/horizon/.venv/local/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in __init__
for url_pattern in get_resolver(None).url_patterns:
File "/home/juan/idm/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 365, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/juan/idm/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 360, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/home/juan/idm/horizon/.venv/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/home/juan/idm/horizon/openstack_dashboard/urls.py", line 36, in <module>
from openstack_dashboard.dashboards.idm_admin.user_accounts \
File "/home/juan/idm/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/views.py", line 27, in <module>
from openstack_dashboard.dashboards.idm_admin.user_accounts \
File "/home/juan/idm/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/forms.py", line 202, in <module>
class UpdateAccountForm(forms.SelfHandlingForm, UserAccountsLogicMixin, fiware_auth.TemplatedEmailMixin):
File "/home/juan/idm/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/forms.py", line 209, in UpdateAccountForm
choices=get_account_choices())
File "/home/juan/idm/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/forms.py", line 179, in get_account_choices
use_idm_account=True),
File "/home/juan/idm/horizon/openstack_dashboard/fiware_api/keystone.py", line 783, in get_basic_role
exceptions.handle(request)
File "/home/juan/idm/horizon/horizon/exceptions.py", line 324, in handle
messages.error(request, message or log_entry)
File "/home/juan/idm/horizon/horizon/messages.py", line 83, in error
fail_silently=fail_silently)
File "/home/juan/idm/horizon/horizon/messages.py", line 41, in add_message
if not horizon_message_already_queued(request, message):
File "/home/juan/idm/horizon/horizon/messages.py", line 28, in horizon_message_already_queued
if request.is_ajax():
AttributeError: 'NoneType' object has no attribute 'is_ajax'
Does anybody know whether we should install additional packages?
For development purposes, change this variable
from
OPENSTACK_KEYSTONE_URL = "https://%s:5000/v3" % OPENSTACK_HOST to
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
inside idm/horizon/openstack_dashboard/loca/local_settings.py (arround 130th line)

SourceTree HG fails - AttributeError: 'NoneType' object has no attribute 'islocalrepo'

'hg status' failed with code 1:'*** failed to import extension hgext.hgsubversion from /Applications/SourceTree.app/Contents/Resources/mercurial_local/hgext/hgsubversion: 'module' object has no attribute 'canonpath'
** Unknown exception encountered with possibly-broken third-party extension sourcetree_auth
** which supports versions unknown of Mercurial.
** Please disable sourcetree_auth and try your action again.
** If that fixes the bug please report it to the extension author.
** Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]
** Mercurial Distributed SCM (version 3.2.3)
** Extensions loaded: strip, mq, rebase, transplant, extdiff, progress, sourcetree_auth, sourcetree_checklink, hgattic, hgflow, gpg, fetch
Traceback (most recent call last):
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/hg_local", line 35, in <module>
mercurial.dispatch.run()
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial/dispatch.py", line 28, in run
sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial/dispatch.py", line 71, in dispatch
ret = _runcatch(req)
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial/dispatch.py", line 140, in _runcatch
return _dispatch(req)
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial/dispatch.py", line 817, in _dispatch
repo = hg.repository(ui, path=path)
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial/hg.py", line 128, in repository
peer = _peerorrepo(ui, path, create)
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial/hg.py", line 115, in _peerorrepo
obj = _peerlookup(path).instance(ui, path, create)
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/mercurial/hg.py", line 89, in _peerlookup
return thing(path)
File "/Applications/SourceTree.app/Contents/Resources/mercurial_local/hgext/hgsubversion/__init__.py", line 185, in _lookup
if util.islocalrepo(url):
AttributeError: 'NoneType' object has no attribute 'islocalrepo'
'
This was raised in the following places;
https://bitbucket.org/tortoisehg/thg/issue/3592/nonetype-object-has-no-attribute
http://sourceforge.net/p/tortoisehg/mailman/message/31934003/
https://groups.google.com/forum/#!topic/thg-dev/T7s17_hMTmw
http://trac-hacks.org/ticket/10439
https://jira.atlassian.com/browse/SRCTREE-2891
https://answers.atlassian.com/questions/11467884/comments/11963332
Due to a critical security patch, the fix is to do the following;
Preferences -> mercurial -> extensions -> uncheck hgsubversion
This is explained by Atlassian as per this article.
Credits to Pedro Campos for the heads up

Jersey, grizzly - Message body writer exceptions while packaging a Java POJO as MediaType.APPLICATION_JSON

I have a Grizzly http server to implement a jersey-REST API server. I am attempting to make a rest API to #GET
#Produces(MediaType.APPLICATION_JSON)
I am running into exceptions like
A message body writer for Java class com.demo.beans.MyBlob, and Java type class com.demo.beans.MyBlob, and MIME media type application/json was not found
The same code was working when I was returning a string as JSON. Now it doesnt work when I attempt to return a java object as JSON. There were many questions in SO, but all of them were almost older than an year; I tried to implement them - but issue was not fixed. I am suspecting this might have been due to newer versions of grizzly... Can any one help ?
Link to github project: https://github.com/seshumadhav/java-projects/tree/master/grizzlySpringJersey
Imp versions info copied from my pom:
<!-- Jersey: javax.ws -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly2</artifactId>
<version>1.17.1</version>
</dependency>
<!-- >>> For message body exception error. JSONConfiguration.FEATURE_POJO_MAPPING; This did not work -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.17.1</version>
</dependency>
<!-- Grizzly2 -->
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-servlet</artifactId>
<version>2.2.16</version>
</dependency>
Detailed exception trace below
Dec 27, 2013 6:25:35 PM org.glassfish.grizzly.servlet.WebappContext deploy
INFO: Starting application [DEMO REST Server WebappContext] ...
Dec 27, 2013 6:25:35 PM org.glassfish.grizzly.servlet.WebappContext log
INFO: [DEMO REST Server WebappContext] Initializing Spring root WebApplicationContext
Dec 27, 2013 6:25:35 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Dec 27, 2013 6:25:35 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Fri Dec 27 18:25:35 IST 2013]; root of context hierarchy
Dec 27, 2013 6:25:36 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
Dec 27, 2013 6:25:36 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#c893391: defining beans [resourceFoo,springRunner,myBean,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
Dec 27, 2013 6:25:36 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 421 ms
Dec 27, 2013 6:25:36 PM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
INFO: Using default applicationContext
Dec 27, 2013 6:25:36 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, resourceFoo, of type com.demo.web.ResourceFoo as a root resource class
Dec 27, 2013 6:25:36 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.17.1 02/28/2013 12:47 PM'
Dec 27, 2013 6:25:36 PM org.glassfish.grizzly.servlet.WebappContext initServlets
INFO: [DEMO REST Server WebappContext] Servlet [com.sun.jersey.spi.spring.container.servlet.SpringServlet] registered for url pattern(s) [[/*]].
Dec 27, 2013 6:25:36 PM org.glassfish.grizzly.servlet.WebappContext deploy
INFO: Application [DEMO REST Server WebappContext] is ready to service requests. Root: [/].
Dec 27, 2013 6:25:37 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [localhost:3388]
Dec 27, 2013 6:25:37 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
In order to test the server please try the following urls:
http://localhost:3388/smc/time to see time for smc
http://localhost:3388/bsv/time to see time for bsv
Press enter to stop the server...
Dec 27, 2013 6:25:44 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: A message body writer for Java class com.demo.beans.MyBlob, and Java type class com.demo.beans.MyBlob, and MIME media type application/json was not found
Dec 27, 2013 6:25:44 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are:
application/json ->
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
Dec 27, 2013 6:25:44 PM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class com.demo.beans.MyBlob, and Java type class com.demo.beans.MyBlob, and MIME media type application/json was not found
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1479)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.glassfish.grizzly.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:147)
at org.glassfish.grizzly.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:106)
at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:252)
at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpHandlerChain.service(HttpHandlerChain.java:196)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547)
at java.lang.Thread.run(Thread.java:744)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class com.demo.beans.MyBlob, and Java type class com.demo.beans.MyBlob, and MIME media type application/json was not found
... 30 more
Dec 27, 2013 6:25:48 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: A message body writer for Java class com.demo.beans.MyBlob, and Java type class com.demo.beans.MyBlob, and MIME media type application/json was not found
Dec 27, 2013 6:25:48 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are:
application/json ->
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
Dec 27, 2013 6:25:48 PM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class com.demo.beans.MyBlob, and Java type class com.demo.beans.MyBlob, and MIME media type application/json was not found
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1479)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.glassfish.grizzly.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:147)
at org.glassfish.grizzly.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:106)
at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:252)
at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpHandlerChain.service(HttpHandlerChain.java:196)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547)
at java.lang.Thread.run(Thread.java:744)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class com.demo.beans.MyBlob, and Java type class com.demo.beans.MyBlob, and MIME media type application/json was not found
... 30 more
I'd suggest adding a JSON provider to your pom:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey.version}</version>
</dependency>
You may need to enable the com.sun.jersey.api.json.POJOMappingFeature. This can be done programmatically:
ResourceConfig rc = // choose your method of setting up your ResourceConfig
rc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
or via a web.xml file:
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
Check out the Jersey 1.17 documentation for further detail.
Also, I'd like to suggest using Jersey 2 if at all possible. Note, however, if you decide to go this route the above suggestions will not map directly to Jersey 2.