OnlyJava is your source for Blog Aggregation in the Java industry

Tech Team Lead News

View This Blog Frequency: 0.0 posts / day

 

OWASP DependencyCheck returns 403 Forbidden accessing NVD API using API key

 Mark As Read    

IntroductionRecently, the NVD (National Vulnerability Database) which the Owasp dependency check plugin uses to get its data from to check for vulnerabilities, has introduced the use of an API key. That's for them to better control access and throttling - imagine how many companies and organizations are using that API, each time a dependency check ...

Tech Team Lead News 64 days ago

Kotlin: how to mock a static Companion method using MockK

 Mark As Read    

IntroductionHow do you mock a static companion method in Kotlin using MockK?I wanted to mock this (static) method in a companion object in Kotlin in class MyClass: companion object { fun isNegativeAndFromSavingsAccount(amount: BigDecimal, accountType: accountType) = amount < BigDecimal.ZERO && accountType == AccountType.SAVINGS } Tr...

Tech Team Lead News 64 days ago

MapStruct library: setting a field with an expression to a ZonedDateTime

 Mark As Read    

IntroductionSetup:- Mapstruct 1.5.5- Kotlin 1.8- IntelliJ 2023.2.3 For a mapping between two classes, the source class did not have the mandatory (non-null, Kotlin!) target class field created. And I wanted to fill it with the current ZonedDateTime class, with the timezone of Amsterdam/Europe. And that specific ZoneId is a constant in my Applicati...

Tech Team Lead News 169 days ago

SpringDoc OpenAPI Swagger generated Swagger API shows incorrect class with same name

 Mark As Read    

IntroductionWhen you have multiple classes with the same name in your classpath, SpringDoc with Swagger API annotations potentially picks the wrong class with the same name when generating the Swagger UI documentation.Suppose you have these classes:org.example.BookDtoorg.example.domain.BookDto And you specified your endpoint like this, where you wa...

Tech Team Lead News 210 days ago

Too many open files in AWS Lambda serverless troubleshooting

 Mark As Read    

IntroductionOne of my Kotlin lambdas was throwing Too many open files exceptions and thus logging errors, but only nightly, when it got bursts of SQS messages to process. To find out what was causing these errors, I followed these steps:Read up on what can be the causesDetermine what/where in the code is not closing the file descriptorsFind a solut...

Tech Team Lead News 212 days ago

Unknown application error occurred Runtime.Unknown - Startup issue AWS Serverless Lambda

 Mark As Read    

IntroductionTrying to invoke a deployed AWS Serverless Lambda on AWS, I was getting this error CloudWatch when trying to invoke the lambda via an SQS event, published by another service in my landscape: 2023-08-15T15:20:44.047+02:00 START RequestId: ab924ff5-236c-5b09-8a29-12a0b9447e41 Version: $LATEST2023-08-15T15:20:45.223+02:00 Unknown applicati...

Tech Team Lead News 212 days ago

OWASP Dependency Check plugin suppressions.xml examples

 Mark As Read    

IntroductionOne of the features of the OWASP dependency check plugin is to be able to suppress reported vulnerabilities, for example because they are false-positives for your configuration, or no new version is available yet, so you want to suppress the alert for a certain period of time.Those suppressions you specify in the suppressions.xml file. ...

Tech Team Lead News 365 days ago

Datadog: Malformed _X_AMZN_TRACE_ID value Root - also known as X-Amzn-Trace-Id

 Mark As Read    

IntroductionSince 14 March 2023 suddenly my AWS lambdas started to log this error:datadog: Malformed _X_AMZN_TRACE_ID value: Root=1-6411cb3d-e6a0db584029dba86a594b7e;Parent=8c34f5ad8f92d510;Sampl ed=0;Lineage=f627d632:0Note that the lambda processing was finishing normally, this metrics logging to Datadog is happening apparently in the background.Se...

Tech Team Lead News 405 days ago

AWS SAM CLI FileNotFoundError: WinError 3: The system cannot find the path specified .class class Kotlin 1.7 Windows 10

 Mark As Read    

IntroductionThe AWS SAM CLI command sam.cmd build MyFunction --template C:\techie\workspace\my-function\local\template.yaml --build-dir C:\techie\workspace\my-function\local\.aws-sam\build --debug fails in an IntelliJ commandline terminal due to this FileNotFoundError: [WinError 3] The system cannot find the path specified error.Setup- Windows 10 P...

Tech Team Lead News 434 days ago

Where to find .gitattributes on Windows 10/11 using Git, IntelliJ 2022 and WSL Ubuntu to fix CRLF (\r\n) command not found: convert to LF line endings on checkout

 Mark As Read    

IntroductionProblem: when checking out a project in IntelliJ in Windows, all files are checked out with Window's newline CRLF (\r\n).But if you then open a terminal in IntelliJ which runs WSL (Ubuntu) and you want to run a bash script like this shell script, you'll get this error:#!/bin/shset -e[unrelated stuff deleted]It will fail with: ./deploy.s...

Tech Team Lead News 490 days ago

Docker build with Git command running in CircleCI failing with: Fatal: No names found, cannot describe anything, invalid argument, for "-t, --tag" flag: invalid reference format

 Mark As Read    

IntroductionContext: Docker, CircleCI, Github.The Docker build command docker build -f .circleci/Dockerfile -t $AWS_ACCOUNT_ID.ecr.$AWS_DEFAULT_REGION.amazonaws.com/${CIRCLE_PROJECT _REPONAME}:`git describe --tags` -t $AWS_ACCOUNT_ID.ecr.$AWS_DEFAULT_REGION.amazonaws.com/${CIRCLE_PROJECT _REPONAME}:${CIRCLE_BUILD_NUM} -t $AWS_ACCOUNT_ID.ecr.$AWS_DEFA...

Tech Team Lead News 493 days ago

Flyway FlywayValidateException Validate failed: Migrations have failed validation. Detected failed migration to version 1 solution, please remove any half-completed changes then run repair to fix the schema history

 Mark As Read    

IntroductionSetup:Spring boot 2.7.4Kotlin 1.7.20Flyway dependencies:plugins { id "org.flywaydb.flyway" version "9.6.0"}project(":application") { dependencies { dependencies { implementation "org.flywaydb:flyway-core:9.6.0" implementation "org.flywaydb:flyway-mysql:9.6.0" }}With only this Flyway script V1__initial_script ...

Tech Team Lead News 511 days ago

Spring JDBC and MySql using UUIDs in Java and VARCHAR(36) in database incorrect string value solution

 Mark As Read    

Introduction Using H2 as initial embedded database for a Spring Boot application worked fine. H2 is very forgiving in many situations and of course only tries to emulate the real target database, in this case MySql 8.0.So after connecting my Spring Boot application to MySql, this error started to appear when inserting a row in a table with a java.u...

Tech Team Lead News 525 days ago

Migrating Java 17 Spring Boot 2.7.3 application to Kotlin 1.7.20

 Mark As Read    

IntroductionThis blogpost describes the challenges encountered when migrating a Java 17 Spring Boot 2.7.3 application to Kotlin 1.7.20. Other libraries/tools used in the project:- Swagger (OpenAPI 3.0.3)- Spring boot 2.7.3- Liquibase- H2 in mem + file based- JUnit5 with Mockito and Mockito-Kotlin- MySql 8.0- Actuator- Maven 3Tip: after migration of...

Tech Team Lead News 559 days ago

Kotlin for Java Developers course summary

 Mark As Read    

IntroductionThis is my summary of relevant lessons learned during a Kotlin for Java developers course.SummaryGeneral- When running standalone, needs Kotlin runtime- Toplevel functions: not explicitly defined in a class, e.g fun main() method- Useful other info: https://kotlinlang.org- val number: Int and val number = 25 So has type inference. B...

Tech Team Lead News 575 days ago

Connection refused Spring Boot application to MySql in Docker solution

 Mark As Read    

IntroductionThe Spring Boot Java application was initially using the H2 embedded database, first the in-memory version (losing all data each run), then the file based version. The database structure is created using Liquibase.Then the requirement was to have the Spring Boot Java application still not dockerized (just started with mvn spring-boot:ru...

Tech Team Lead News 588 days ago

Configuring MySQL test-containers in your Spring Boot Java Integration Tests

 Mark As Read    

IntroductionIn your Integration Tests (IT) you often try to use the H2 in-memory database, to improve the speed of your integration tests. But on the other hand you want to mimic the production database as much as possible in your integration-tests.Setting H2 in MySQL database compatibility mode tries to emulate MySQL as much as possible, but only ...

Tech Team Lead News 749 days ago

Sentry in Spring Boot application reports uncaught exception while @RestControllerAdvice is handling exception

 Mark As Read    

IntroductionEven when you have a @RestControllerAdvice configured and you know it gets invoked, it can be that Sentry.io's monitoring library still reports it as an (uncaught) exception. Reason for this is that when you configure Sentry as specified without setting its order in the exception-handler-resolver chain, it's by default set as lowest, so...

Tech Team Lead News 850 days ago

Spring @Scheduled using DynamoDB AWS X-Ray throws SegmentNotFoundException: failed to begin subsegment

 Mark As Read    

IntroductionAWS X-Ray is designed to automatically intercept incoming web requests, see at this introduction. And also here. But when you start your own thread (either via a Runnable or plain new Thread() or @Scheduled), X-Ray cannot initialise itself: there are no web requests to intercept for it. Then it throws an exception like this: Suppressin...

Tech Team Lead News 1252 days ago

PACT provider test with Serverless Java 11 Lambda and JUnit 5 (Jupiter)

 Mark As Read    

IntroductionThis blogpost shows how to create a Pact provider test using:Pact 4.0.0AWS Serverless LambdaJava 11JUnit 5 (Jupiter)Example Provider TestBelow is the example test class. Note how a mock service is used to simulate the endpoint defined (also) in serverless.yml. package com.ttlnews.pact.tests.provider;import au.com.dius.pact.provider.juni...

Tech Team Lead News 1480 days ago

Snyk .snyk ignore file with multiple entries format

 Mark As Read    

"Snyk enables you to find, and more importantly fix known vulnerabilities in your open source." Some vulnerabilities you'd want to ignore, because for example they are (for you) either false positives, or there is no workaround for them (yet). You can specify them via the so-called CLI snyk ignore command, or in the UI manually, or via a .snyk igno...

Tech Team Lead News 1666 days ago

PACT Consumer Driven Contract Testing: how to allow any body in the response

 Mark As Read    

Consumer Driven Contract testing is a way to ensure that services (such as an API provider and a client) can communicate with each other. Without contract testing, the only way to know that services can communicate is by using expensive and brittle integration tests.PACT is a contract testing tool. For response matching you want to be as loose as...

Tech Team Lead News 1733 days ago

Lessons learned - Jackson, API design, Kafka

 Mark As Read    

IntroductionThis blogpost describes a bunch of lessons learned during a recent project I worked on.They are just a bunch grouped together, too small to "deserve" their own separate post :)Items discussed are: Jackson, JSON, API design, Kafka, Git.Lessons learnedPretty print (nicely format) JSON in a Linux shell prompt:cat file.json | jqYou might ha...

Tech Team Lead News 1751 days ago

What's not so good about my new Dell XPS 15 laptop (+ a bunch of good things)

 Mark As Read    

Recenty I got a new laptop, again a Dell. I decided to go for a thin "ultrabook", the XPS 15, 16G RAM, 512G SSD. A good review you can find here. I didn't take the 4K version on purpose, since some reviews say it is struggling a bit with that. Plus some software just can't handle it, like Remote Desktop, so you have to scale down anyway.Here is a...

Tech Team Lead News 1751 days ago

Logback DBAppender sometimes gives error on AWS Aurora: IllegalStateException: DBAppender cannot function if the JDBC driver does not support getGeneratedKeys method *and* without a specific SQL dialect

 Mark As Read    

LOGBack DBAppender IllegalStateExceptionSometimes when starting a Spring Boot application with Logback DBAppender configured for PostgreSQL or AWS Aurora in logback-spring.xml, it gives this error:java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:16 - RuntimeException in Act...

Tech Team Lead News 1751 days ago

Upgrading Dell M4700 from 500G HDD to 1T Samsung Evo 850 SSD v-nand

 Mark As Read    

Below is a list of things encountered when upgrading a Dell Precision M4700 laptop with Windows 7 with a 500G HDD to a 1 terabyte Samsung Evo v-nand 850 SSD.Used HDClone 7 Free Edition to make a copy of the current harddisk. Copied onto a Samsung T5 external SSD. HDClone very nicely copies over everything, even from a live (running) Windows 7 mach...

Tech Team Lead News 1751 days ago

How to prevent Chromium from rebooting a Raspberry Pi 3 model B Rev 1.2

 Mark As Read    

I tried to use a Raspberry Pi 3 model B Rev 1.2 as a dashboard for monitoring a couple of systems using Chromium as browser.Tip: use this to have it never turn off the display:sudo xset s offsudo xset -dpmssudo xset s noblank I had only two tabs open all the time and was using the Revolver browser extension to rotate the tabs. One tab had the defa...

Tech Team Lead News 1751 days ago

Gitlab maven:3-jdk-8 Cannot get the revision information from the scm repository, cannot run program "git" in directory error=2, No such file or directory

 Mark As Read    

IntroductionIn a Gitlab project setup the most recent Docker image for maven was always retrieved from the internet before each run by having specified image: maven:3-jdk-8 in the gitlab-ci.yml. The image details can be found here.Of course this is not a best-practice; your build can suddenly start failing at a certain point because an update to th...

Tech Team Lead News 1751 days ago

gitlab-runner cache key bug: cache not being created anymore in gitlab steps

 Mark As Read    

IntroductionBesides auto-updating also to the most recent version of the Docker image of maven:3-jdk-8, the Gitlab runners were also always updated to the most recent version.Again not best-practice and again I learned the hard way: builds suddenly starting to fail.The issue and workarounds/solutions Because suddenly indeed the docker image build o...

Tech Team Lead News 1751 days ago

Lessons learned using AWS Kinesis to process business events and commands (messages)

 Mark As Read    

IntroductionWhen using AWS Kinesis as the means of communicating business events, several challenges arise. For the basic key concepts of Kinesis see here. Of course the "normal" use case to use Kinesis is described as here in the section "When should I use Amazon Kinesis Data Streams, and when should I use Amazon SQS?" Another comparison between K...

Tech Team Lead News 1751 days ago

ProvisionedThroughputExceededException using KCL (Kinesis Client Library)

 Mark As Read    

ProvisionedThroughputExceededExceptionWhen using the Amazon Kinesis Client Library (KCL) one would not expect the table created by KCL itself to keep track of its streams, shards and checkpoints to ever be under-configured.But it can be! Then you get the ProvisionedThroughputExceededException. Normally it will recover by retrying itself. But if it ...

Tech Team Lead News 1751 days ago

ReadProvisionedThroughputExceeded using Kinesis

 Mark As Read    

ReadProvisionedThroughputExceededWhen using Kinesis it is possible you'll get an ReadProvisionedThroughputExceeded when not carefully designing the shards consumption of messages.That exception indicates "The number of GetRecords calls throttled for the stream over the specified time period".A cause for this can be you have to many consumer applica...

Tech Team Lead News 1751 days ago

Maven Failsafe plugin build error: SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

 Mark As Read    

When you get this exception during running mvn clean verify, which executes both the Surefire and Failsafe plugin (for which the last one uses the Surefire plugin!):SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?it can mean several things. For example as the message says maybe s...

Tech Team Lead News 1751 days ago

Lessons learned Docker microservices architecture with Spring Boot

 Mark As Read    

IntroductionDuring my last project consisting of a Docker microservices architecture, built with Spring Boot, using RabbitMQ as communication channel, I learned a bunch of lessons, here's a summary of them.ArchitectureBelow is a high level overview of the architecture that was used.DockerRun 1 process/service/application per docker container (or pu...

Tech Team Lead News 2569 days ago

OpenVPN how to route all IPV4 traffic through the OpenVPN tunnel

 Mark As Read    

IntroductionOriginally I was connected from a Windows 10 machine via OpenVPN to a network (segment?) for "our" project. I could access all servers and websites related to it. But when switching to another project (using the same OpenVPN settings) I could only access the new project's servers when at the premise of that project. At home or from any...

Tech Team Lead News 2653 days ago

Nodejs Express enabling HSTS and cookie secure attribute

 Mark As Read    

To enable HSTS (adds Strict-Transport-Security header to the response) for Node + Express using Helmet, this should be sufficient to add to your app.js:var hsts = require('hsts')app.use(hsts({ maxAge: 15552000 // 180 days in seconds}))But a few things didn't work for me. First of all I had to add the force: true attribute. Also I was using an old...

Tech Team Lead News 2688 days ago

Kubernetes Software Components Architecture Diagram

 Mark As Read    

For a recent innovative project we were able to work with Kubernetes 1.3 as tool for automating deployment, scaling, and management of containerized applications. In our case (micro)services. A lot of documentation is available, but I was missing a as-complete-as-possible architecture picture of all components within k8s. Or sometimes the link bet...

Tech Team Lead News 2699 days ago

Migrating from MySQL 5.5 to 5.6.4 to have milliseconds/fractional seconds support

 Mark As Read    

Before MySQL version 5.6.4, MySQL does not support milliseconds (more precise: fractional seconds) in TIME, TIMESTAMP and DATETIME!In a project I was on, timestamps are used for versioning of entities via the JPA @Version annotation. So it's essential for correct optimistic locking, otherwise changes with a millisecond or bigger difference won't ge...

Tech Team Lead News 2840 days ago

Vaadin TextFields in a Table empty/null value not propagated for required field

 Mark As Read    

Setup- Vaadin 7.0.4- Table- TextFieldProblemWhen you create a table in Vaadin with a .setTableFieldFactory(), and you have a Field which is set to .setRequired(true), and a user puts in an empty value for that field after first putting in a non-empty value, the field won't be set to that empty value when iterating through the table to read the curr...

Tech Team Lead News 2840 days ago

Fairphone is in!

 Mark As Read    

Yes it's in (well already for over a month), the Fairphone! Since I was one of the first 10.185 backers, a special edition with an extra message:

Tech Team Lead News 2840 days ago

Android and iOS app discovery and search engines overview

 Mark As Read    

IntroductionRecently a friend of mine asked how to check if an app or type of app with certain functionality already exists. He had a great idea for an app (he thinks :) so wanted to figure out: does such an app already exist?Entering the name of an app is not sufficient of course, you want to search on offered functionality too, since the name of ...

Tech Team Lead News 2840 days ago

Vaadin 7 + Spring 3 + JPA project summary and lessons learned

 Mark As Read    

This blogpost is a short summary of the Vaadin 7.0 project I did last year, including tools used, lessons learned and a bunch of screenshots to show the results.Tools usedSpring 3.2 including annotation based configuration, Spring Task*Executor frameworkJPA2 with Hibernate 4.2 + JPA modelgen, including Envers for auditingJMS 2Vaadin 7.0.1JAXB 2.1Sp...

Tech Team Lead News 2840 days ago

JasperReports/iReports dynamically show and hide fields conditionally

 Mark As Read    

IntroductionWith JasperReports and its visual designer iReports you can have (blocks of) fields collapse based on certain conditions.You can use a subreport, but that's not necessary. This post describes how to show/hide fields without subreports.HowBasically you have to do two things:Put the elements (static text, textfields etc) you want to hide ...

Tech Team Lead News 2840 days ago

Recreate Vagrant box when original .box is gone from vagrantcloud

 Mark As Read    

IntroductionSuppose you've setup a cool Vagrant image based upon a box from the Vagrant Hashicorp cloud. But suddenly one day the URL is gone! So the original box is gone. E.g this one, which gives a 404 page: https://atlas.hashicorp.com/box-cutter/boxes/ubuntu1404-desktopYour 'vagrant up' still works, vagrant will just complain it can't find the b...

Tech Team Lead News 2840 days ago

JBoss EAP 6.2.0 + Camel + CXF + JSF 2.2.8 Project Summary

 Mark As Read    

IntroductionThis blogpost is a short summary of a project I did a short while ago in 2014.Tools usedOracle's jdk1.8.0_05 with target 7JBoss EAP 6.2.0Testng 6.8 (instead of JUnit)Camel 2.13CXF (for calls to external webservices)Less (CSS similar a bit to SASS)Spring 4.0LombokMockito 1.0Hamcrest 1.3DBUnit 2.5Embedded tomcat 7 for integration tests wi...

Tech Team Lead News 2840 days ago

iOS9 / iOS 9 / iOS 9.1 / ATS 9: An SSL error has occurred and a secure connection to the server cannot be made due to old sha1 signed certificate

 Mark As Read    

In iOS 9 and higher apps, a higher level of ciphers is required for a certificate for Forward Secrecy.Before iOS 9, it was possible to let a site within a webview forward/redirect to another SSL protected site.For example it was possible to let another site redirect to this one in iOS 8: https://www.securesuite.co.uk/But since iOS 9 it is not allow...

Tech Team Lead News 2840 days ago

com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /10.255.235.17 (Timeout during read)

 Mark As Read    

In a recent project, seemingly randomly, this exception occurred when doing a CQL 'select' statement from a Spring Boot project to Cassandra:com.datastax.driver.core.exceptions.NoHostAvailableException : All host(s) tried for query failed (tried: /10.255.235.17 (Timeout during read), /10.255.235.16 (Timeout during read))...After a lot of research, s...

Tech Team Lead News 2840 days ago

Tomcat 7 request processing threading architecture and performance tuning

 Mark As Read    

Tomcat has many parameters for performance tuning (see http://tomcat.apache.org/tomcat-7.0-doc/config/http.html), but for some attribute descriptions it is not a 100% clear how some properties affect each other.A pretty good explanation regarding acceptCount and maxThreads can be found here: http://techblog.netflix.com/2015/07/tuning-tomcat-for-hig...

Tech Team Lead News 2840 days ago
Java
Welcome!
OnlyJava aggregates blogs for the Java industry.
Custom Feeds
Add any RSS feed to the information you read daily.
Blocked Feeds
Block feeds to remove blogs you’re not interested in.
Account Settings
Customize the site by adding or removing feeds.

About Us

OnlyJava is your source for all your Java news.

Have a Suggestion for Us?
Know of a Java blog that we're missing? Let us know!

Share OnlyJava.com