Unable to Configure CAS Database Authentication - cas

Following this tutorial I am unable to configure database configuration.
Using the cas-overlay, I've added settings to the cas.properties file, but when I run the project it fails to authenticate.
I don't think the settings are loading completely, because my cas.authn.jdbc.query[0].passwordEncoder.type=BCRYPT setting doesn't take.
I'm coming to this pretty green, so I feel like there is a gap in the documentation.

I figured out my problem. It wasn't necessarily the cas.properties file was wrong. I was actually missing a dependency that imports JDBC support.
Their documentation kind of reads like it is supported, but makes an assumption the reader knows to add the dependency.
Added this to my overlay pom.xml
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-jdbc</artifactId>
<version>${cas.version}</version>
</dependency>

Related

maven-connector-java, module not found

Successfully I did my first JDBC program using MariaDB, Maven, Java-11.
Now I have to access MySQL and just exchanged the MariaDB dependency by
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
I figured out, that com.mysql.jdbc and com.mysql.cj and other modules are hosted in the mysql-connector-java-8.0.28.jar.
Hence, in module-info.java I exchanged
requires org.mariadb.jdbc;
by
requires com.mysql.jdbc;
I also tried
requires com.mysql.cj;
but still, the maven-compiler-plugin:3.9.0 complains
module not found
What did I miss, here?
khmarbaise has put me on the right track: I almost forgot that there are legacy jar files around not prepared for easy integration into JPMS. To include the jar file mysql-connector-java-8.0.28.jar, which comes without a module-info.class, I had to enter
requires java.sql;
requires mysql.connector.java;
to my module-info.java.
The module name mysql.connector.java is derived from the name of its jar file by omitting the version info and substituting the dashes by dots.

Cannot resolve type problems with eclipse

It seems that I got the wires crossed & ask you to point me the right direction.
I have a problem with the Eclipse IDE for Enterprise Java Developers (version: 2019-06 (4.12.0), build id: 20190614-1200). There is a code part where I get the error message MysqlDataSource cannot be resolved to a type. Searching the Web, I found out that this class is included in the download of mysql-connector-java JAR 8.0.14 with all dependencies. I added it over the 'Fix project setup…', where I added the JAR file to the libraries of the Java Build Path.
Unfortunately, the error message does not vanish. Can you see what I am doing wrong?
Edit 1:
With the hint from another Website, I found out that the hibernate JAR included was the source files JAR. So, I corrected it the hibernate-entitymanager JAR, clicked "Clean…" under "Project", but to no avail: the EntityManager is still unlocatable. (Well, after several tries, the first error message to resolve is no more with MySQL.)
As I learned from somebody on another Web site, the following lines have to be added to the pom.xml file:
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.2.Final</version>
</dependency>
or
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>

How to configure custom main class using YAML in wildfly swarm application

I am trying to build a Wildfly Swarm application using custom main class specified in plugin configuration ( as shown below )
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>2018.3.3</version>
<configuration>
<mainClass>rnd.web.service.rest.App</mainClass>
</configuration>
</plugin>
But during build/run is show deprecation warning/information (see below) with reference to documentation. But the documentation does not provide any details on how to implement it.
Custom main() usage is intended to be deprecated in a future release
and is no longer supported, please refer to
http://docs.wildfly-swarm.io for YAML configuration that replaces it.
If someone has encountered and implemented it. Please share the approach and correct reference.
As the deprecation warning says, it's not the <mainClass> setting that's deprecated, it's the entire usage of custom main method. All the configuration you do in your main method, you should be able to do with the YAML configuration. If you find something missing, then that's a bug.

Encrypt a Java application with Cloud KMS example

https://codelabs.developers.google.com/codelabs/cloud-bookshelf-java-cloud-kms/index.html#0
I'm getting following error after downloading additional Bookshelf app files ( Step 7)
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.3.8.v20160314:run-exploded (default-cli) on project bookshelf-3: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.3.8.v20160314:run-exploded failed: An API incompatibility was encountered while executing org.eclipse.jetty:jetty-maven-plugin:9.3.8.v20160314:run-exploded: java.lang.NoSuchMethodError: com.google.cloud.ServiceOptions.(Ljava/lang/Class;Ljava/lang/Class;Lcom/google/cloud/ServiceOptions$Builder;Lcom/google/cloud/ServiceDefaults;)
https://codelabs.developers.google.com/codelabs/cloud-bookshelf-java-cloud-kms/index.html#0
like Tim mentioned, you're getting this error because that codelab is currently instructing users to download an older version of the KMS library (v1beta1). You can see this in the pom.xml file in the GCS bucket downloaded, for the google-api-services-cloudkms artifact, whose version is v1beta1-rev1-1.22.0.
To fix the issue, edit the pom.xml file in the bucket to point to the current v1 version, you can find the current version here: https://mvnrepository.com/artifact/com.google.apis/google-api-services-cloudkms. At the time I'm writing this, its v1-rev41-1.23.0.
Current:
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-cloudkms</artifactId>
<version>v1beta1-rev1-1.22.0</version>
</dependency>
Fix
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-cloudkms</artifactId>
<version>v1-rev41-1.23.0</version>
</dependency>
You're also going to need to resolve all of the v1beta1 references inside src/main/java/com/example/getstarted/util/CloudKeyManagementServiceHelper.java
For more information and guides on how to use Google Cloud KMS Java, I'd suggest looking at our java samples.
Thanks

osgi.wiring.package; (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0))))

I am trying to use com.google.maps in my OSGi bundle. I've added the dependency like this:
<dependency>
<groupId>com.google.maps</groupId>
<artifactId>google-maps-services</artifactId>
<version>0.1.7</version>
</dependency>
However, when I try to deploy this bundle to AEM, I get an error:
Unable to resolve 392.38: missing requirement [392.38] osgi.wiring.package; (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0))))
How can I resolve this?
go to maven central: http://search.maven.org
Advanced search
Write to the By Classname section: com.google.gson
In the list of results, find the ones that might be good for you
Download the jars and check the manifest header if the required package is exported
If you do that, you will find the following maven dependency:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
Alternatively, you can use JPM website for the search as it indexes all OSGi related MANIFEST headers and it mirrors the whole maven central repo. After you find the artifact that is necessary for you, there is a good chance that it is from maven central originally (so you do not have to set alternate repositories in your maven project). You can check the origin of the bundle in the details page.