Keycloak conflict (core and adapter) - jetty

When trying to run my webapplication in both an embedded jetty (locally) and a 'normal' jetty instance (remotely), I think I encounter some class collision.
java.lang.ClassCastException:
org.keycloak.adapters.RefreshableKeycloakSecurityContext cannot be cast to org.keycloak.KeycloakSecurityContext
The class KeycloakSecurityContext is both defined in the keycloak-jetty-adapter dependency and in the keycloak-core dependency in my project. (same version, 3.4.3 Final)
I've tried using scope 'provided' on the adapter or excluding the keycloak-core dependency from my adapter, but to no effect.
Any suggestions how to handle this combination?

I had similar issues with Keycloak. You need to make sure that libraries are not duplicated.
You download from Keycloak the adapters and place them under tomcat/lib in tomcat/wildfly.
In pom.xml you need to specify the tag without versions. This will make sure that "dependencies that are required for compiling the project code, but that will be provided at runtime by a container running the code".
(For IntelliJ) To make sure that your project can import Keycloak specific classes you need add them into your project. So CTRL+Shift+Alt+S -> under libraries you need to add the same jars you added at point 1.

For me I had to add the scope provided on the keycloak-core maven dependency. It corrected the error.

Related

flatpak define dependency in manifest

How to add another flatpak packages as a dependency to my app?
I want my app to be able to call mpv, so it would be nice to install io.mpv.Mpv along with my app.
I think it is not possible. The classical way is to write the mpv compilation rule in your application manifest so that it can then be used by your application. You can find the mpv manifest here, so that you can include/adapt this code for your application manifest.

Setting up RestKit 0.10.1 for testing while using CocoaPods?

I am trying to setup a testing environment for RestKit while using CocoaPods and I can't seem to be able to include RestKit's testing framework.
I followed Unit Testing with RestKit but I wasn't able to include any of my podfiles.
Then I found this article about setting up CocoaPods with a small section about testing:
When trying to execute the unit tests of CookPix, I got this issue
LoggerClient.h not found As described above, pod install changes your
Xcode project main target (I guess it takes the one named like the
project) to base the target configuration on the Pods.xcconfig file.
This lets Xcode found the headers of your dependencies and compile
your project with the right flags as well.
However it does not change the configuration of all targets and in our
case, the unit tests target. To fix that, click on your Xcode project,
then again on the Xcode project on the secondary panel, then on the
Info tab. Change the "Based on Configuration file" attribute of your
unit tests target to Pods. This should fix the dependencies of your
unit tests target.
This fixed the issue of including my pod files but I can't get RestKit's test framework installed. The compiler can't find this file because the pod doesn't install it.
#import <RestKit/Testing.h>
By looking at the CocoaPod spec it looks like it should be included. This is the relevant line in my Podfile.
pod 'RestKit', '0.10.1'
I also tried:
pod 'RestKit/Testing', '0.10.1'
With the same results.
I haven't investigated why this works but to include RestKit's testing files you must put
pod 'RestKit/Testing', '0.10.1'
before
pod 'RestKit', '0.10.1'
and clear out your pods directory and do a pod install. Or you might be able to skip this step if you are running Cocoapods 0.14.0.rc1 in which case you might be able to use pod update.

Do Policy Intersection in WSO2ESB Class Mediator

I've created a Class Mediator in which I want to intersect two policies. I've created the Class Mediator with Carbon Studio for Eclipse, which automatically adds some predefined libs to the build path of my project.
One of the libs is neethi-2.0.4.wso2v1.jar.
If I want to use the intersect-method I get an exception. If I have a look at the source I see that the intersect-method just throws an "UnsupportedOperationException".
So the given neethi lib is useless for intersection, therefore I want to use the newest Neethi lib (aka neethi-3.0.2.lib) for intersection inside my class mediator.
Could you tell me how I can include third party libs, especially in my use case these ones, that should override the once used inside the esb( neethi-2.0.4.wso2v1.jar).
Thanks
Developer Studio adds these libs to your project classpath, so that developers do not get build errors in the source code.
Therefore those libraries are only for the development time and available only with Dev Studio. They are not the libraries used in the runtime of the server.
Runtime libraries are provided by the WSO2 Carbon Server runtime. So this UnsupportedOperationException is thrown by the server is occurred due to the version of the neethi in the server does not support it. So you need to upgrade the library in the server runtime.
But as you can see, WSO2 have forked the neethi codebase and have some custom implementations on the forked source. So IMO, simply upgrading the version would not help.
Anyway you need to actually upgrade the library and see whether you face any issues with it.
To upgrade the versions, you can either create a Java Library artifact for newer Neethi library and include it in the CAR file and deploy the CAR file or copy the new Neethi library to <CARBON_HOME>/repository/components/lib location while the server is running.
You can find the current Neethi library in the <CARBON_HOME>/repository/components/plugins location. If you find some error or exception similar to "Linkage Error", then try to remove the older version of the library. But it would cause some other exceptions.
So IMO the bottom line is, you will face some issues with the version upgrade. But yes of course you can give a try and see, whether we can overcome them. Give it a try and post your observations here. We will try our best to assist you.

Clojure, Lein, JavaFx, native deps

Context
I want to use JavaFx with clojure.
I am aware of http://nailthatbug.net/2011/06/clojure-javafx-2-0-simple-app/
Question:
Is there a way to make JavaFX work with Clojure using native-deps in lein instead?
Thanks!
I've created a simple Clojure and JavaFX example on Github. Testing on Ubuntu I had to install the JavaFX runtime into my local Maven repository, using the deploy:deploy-file target (install:install-file did not work for me).
mvn deploy:deploy-file -DgroupId=local.oracle -DartifactId=javafxrt -Dversion=2.2.0 -Dpackaging=jar -Dfile=/usr/lib/jvm/java-7-oracle-amd64/jre/lib/jfxrt.jar -Durl=file:/home/raju/.m2/repository
Make sure you have the following arguments set correctly:
-Dfile={full path to jfxrt.jar in jre/lib folder}
-Durl=file:{full path to Maven repository, e.g. $HOME/m2.repository}
In the project.clj, I added the dependency based on the -DgroupId and -DartifactId values when installing the JAR into the repository. If you use change these values, make sure to change the dependency accordingly:
[local.oracle/javafxrt "2.2.0"]
Java was able to load the binary libraries without any problems. If Java reports problems loading a binary library, e.g.
Caused by: java.lang.UnsatisfiedLinkError: Can't load library:
/usr/lib/jvm/javafx-sdk/rt/lib/amd64/libglass.so
check out these two question on SO:
What is LD_LIBRARY_PATH and how to use it?
java.lang.UnsatisfiedLinkError no *****.dll in java.library.path
Because JavaFx has native dependencies your option are limited to, ]
shipping these dependencies with your project (including them),
creating a package that you can depend on which has them (providing them),
or having your package require the user to install them in some other way.
Because the tutorial you link to covers the case where the user of your package/program installs JavaFx on their own, by using robert.hook and depending on the end-user's package manager to provide the actual native dependencies. I'll cover how to have your package/program include the dependencies.
native-deps can be used to ship native dependencies with your package. You just need to add all the .so, .dll, .etc files in the appropriate directories. I think the projects github page does a better job than I of explaining the structure.
The link in the question is broken so I can't see your example, but with Java 8, JavaFX is now part of the standard JDK/JRE. I therefore expect the native dependency issue to be irrelevant at this point.
Not sure if this will work for others, but this appears (so far) to have worked for me:
mvn install:install-file -DgroupId=javafx -DartifactId=javafx -Dversion=2.1.0 -Dpackaging=jar -Dfile=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/jfxrt.jar
I have no idea why this works, but I believe jfxrt.jar has the files I need. Then, after this, I kindle it in project.clj as
[javafx "2.1.0"]
in the :dependencies (not :native-deps) section.
[Having written this, I really have no idea why this even appears to work.]

writing and installing your own leiningen plugin

I have been able to run a custom plugin from within my projects project.clj, and even leiningen/plugin.clj (ie just a private plugin) - but when I go to put this plugin in its own project - I am unable to get it to work at all.
Following the advice, I should create a new project, and have a namespace of leiningen.myplugin etc etc... but the jar that I produce doesn't seem to provide the new task in the project (either via jar, or via clojars).
http://nakkaya.com/2010/02/25/writing-leiningen-plugins-101/
https://github.com/technomancy/leiningen/blob/stable/doc/PLUGINS.md
Anyone who has published a plugin care to confirm if the above is correct - or is there some crucial step I am missing? (I assume my task goes in core.clj in the plugin project)
Do you have the :eval-in-leiningen option set to true in the project.clj?
In addition if you want to use the task all around with your leiningen without having to add it to the dev dependencies of the project where you need to use it you need to use lein plugin install
Or did i miss something about your problem
Note that eval-in-leiningen doesn't need to be used for very simple project-specific plugins or tasks, and it can sometimes wreak build havoc. You can enable a Leiningen task for a given project by just using .lein-classpath for that project. More information here:
Project-level Leiningen Plugin