Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

We are a Community full of Java developers. You can come here to connect other devs, get help, help others and do many more things!

Join

java-help

❓︱qotw-answers

Minecraft plugin returns error

So, i want to make a simple plugin, that prints some text into console, and after build, i get error [20:16:08 ERROR]: Error occurred while enabling LogConsole v1.0 (Is it up to date?) java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "ru.mrksbgg.logConsole.LogConsole.getCommand(String)" is null...
No description

Blocking/Preventing certain GIT actions on repositories

I've implemented a combination of Git Hooks both client side and server side to prevent the merging between specific branches. As of right now, the server side pre-receive hook is able to prevent the push to remote, but the commits from the merge command is still staged locally, thus having to reset HEAD~n. I am looking for a cleaner way to prevent
git merge x
git merge x
if I am invoking that command from
branch y
branch y
and only
branch y
branch y
, to be staged locally. Can the client side pre-commit hook somehow check for this? Any suggestions?...

Hotswap file not found error. Running works fine.

My Project runs just fine. Even the "missing" code works. But when I want to hotswap it fails with errors like this one with a lot of files. /home/spieler/IdeaProjects/BBsentials-Server/main/src/main/java/de/hype/bbsentials/server/discord/events/staticimplementations/commands/commands/development/TestDiscordCommand.java:17: Fehler: Failed to parse source file: src/main/java/de/hype/bbsentials/server/discord/events/staticimplementations/commands/commands/development/TestDiscordCommand.java (Datei oder Verzeichnis nicht gefunden) public class TestDiscordCommand extends AbstractSingleCommand { ^...

Jwt Auth Issue

```@Configuration @EnableWebSecurity public class SecurityConfiguration { @Autowired...

How I make Spotless follows my checkstyle configuration?

I have some annoying conflicts between Checkstyle and Spotless and I dunno what is the best approach to do ?

VS Code Setting

This may seem silly but it's been really annoying to deal with for a while now. Whenever I use overloaded methods (for example the println or the add method on ArrayList) that can have either different type or number of arguments, I get this box (see image) that lets me arrow between different versions. Does anyone know how to remove this? It takes priority on up/down arrow keys which makes moving between lines of code very frustrating since I frequently use the arrow keys to navigate my code. L...
No description

Should mock objects be in a single class?

Hey so should different mock objects be in a single class for different tests? is this good practice? or should they be in their respective test classes

How to get built jar during test-time (JUnit)

I'm making an integration testing framework for Minecraft plugins which uses JUnit. My plan is to send a built plugin file during test-time to a docker container, which in term runs a server with that specific plugin file, which will be loaded using the servers class loader. This file should not include test resources The problem I'm facing is that there's large differences in buildscripts for projects; it would not be feasible to just run something like ./gradlew build and retrieve the file from it's directory, as there's also maven, and multimodule projects and much more that I don't know about. What is the least painful approach to generate or fetch this file?...

Scanner Bug (Tried Everything)

So I ask users through input through these two methods: ```java public static String whileLoopInputString (Predicate<String> checkCase, String inputMessage, String errorMessage, Scanner scanner) { String input = ""; ...

stripe dependency not being recognized?

for some reason I keep getting errors here
No description

How to define 3 authentication ways config - httpBasic, userDetailsService, JsonLoginFilter()

I'm creating an app where a user can authenticate using three ways httpBasic, userDetailsService, JsonLoginFilter(). A user should be authenticated using Spring's default /login path. But the type is one of three: httpBasic: There must be 2 users in memory database for testing. Simple user with user role and admin user with its role. ...

Help me with spring JDBC

Hello, I'm using spring data JDBC to manage two entities, but I am getting a rather strange exception when testing the UserRepository. Spring is trying to map the "users_key" attribute of the "expense" table, but this attribute is nonexistent. I'm sure the core problem is in the mapping of the "expense" attribute of the User entity, because when I annotate the attribute as @Transient, the exception doesn't occur. Below are the images of the entities, the SQL script to generate the tables, the test code, the repository and the stack trace...
No description

production vs development

is it necessary to change the structure of db while in production? as i was not getting a single exception and was working fine in development but when i deployed it, Db has started giving me errors

What is the meaning of lazy-initialization in Spring Boot properties file ?

In one of our projects in company. A teammate did this long time ago, and I don't get why ? The property documentation says :
Whether initialization should be performed lazily. - default value is false
```yml spring:...

Trying to connect to MS Access

I'm trying to connect to MS access and keep getting the following error:
No description

fetch subclasses and their associations with one query

demo for simplicity and to avoid being sued :GnuTrolling: so the question is whether its possible to fetch all the associations to their respective classes when calling the find all method without eager fetching and avoiding n+1 and without extra queries for getting the associations...

What are the initial values of the primitives that are encapsulated in an object?

What are the initial values of the primitives that are encapsulated in an object, and what are the initial values of the primitives that are not encapsulated in an object?

Can spring @autowire one of the parameters in a constructor and not autowire the other one?

I mean that if I say new TestObject(autowirethis, notautowirethisbutinitiateit); can i make it so i provide one of the values and dont provide the other one?

403 error issue

```@RestController @RequestMapping("/api/auth") public class SignUpAndLoginController { @Autowired...
No description