Java - GeoLite2 database corruption when creating .jar in Gradle - java

Recently I have been using GeoLite2 City database in my application to get information on the user location using their IP. The database works fine in my local machine, but when I compile it to a .jar using ./gradlew -Pprod clean bootJar I get this error when trying to access a component that uses the database:
InvalidDatabaseException
Could not find a MaxMind DB metadata marker in this file (<InputStream>). Is this a valid MaxMind DB file?
Searching for this error, I found this thread on StackOveflow that explained the need to disable resource filtering for binary files in Maven. Thing is, I'm using gradle, which as far as I know, does not have this resource and should not be facing this problem.
Regardless, I tried searching for a solution and tried implementing something based on this thread to fix the issue. I ended up adding this to my build.gradle:
processResources {
from('src/main/resources/data') {
include '**/*.mmdb'
}
}
That, however, also did not work. It seems like this should be a simple issue, but I have not been able to solve it and neither did I find someone with the same issue so far. Any help would be appreaciated!

You could try this (note: I did not test it)
processResources {
filesNotMatching("**/*.mmdb") {
}
}

Related

NoSuchFieldError MongoDB Error Spigot (Minecraft Server

This is the error im getting in the console
https://prnt.sc/UEwAWFplmUWn
Here is the line its refencing on console to the mongostorage class and the onEnable that is also referenced.
onEnable: https://prnt.sc/8dnYz-VG7fL8 (the string that is not visible is "database.password")
mongostorage: https://prnt.sc/xO2DnWPeV1wJ
And here is my coreConfig file: https://prnt.sc/o900NtzQt3YJ
(Im sorry if i referenced anything wrong i just started coding and this plugin is not mine i found it on github and idk how to get it to work)
As this mention, it seems there is multiple mongoDB version on same build path.
I suggest you to relocate your own implementation.
Also, prefer copy paste and use code block instead of showing picture of code or console logs.

Could not execute build using Gradle upon Creation of Liferay Module Project

I was trying to do the liferay sample project in this link but I encountered a problem in doing it. It prompts the error message below.
I tried the solution I found in this link but still encounters the problem.
Thank you.
It looks like a network issue to me. Are you perhaps behind a proxy?
In that case you should include the settings for your proxied connection in your gradle.properties file:
systemProp.http.proxyHost=YOUR_PROXY_HOST
systemProp.http.proxyPort=YOUR_PROXY_PORT
systemProp.https.proxyHost=YOUR_PROXY_HOST
systemProp.https.proxyPort=YOUR_PROXY_PORT
Hope that helps

Adding new aggregate function in Presto fails

I am trying to build custom aggregate functions for presto. I have created a FAT Jar and deployed the jar into the plugin directory. When I restart presto, it is always giving me this error :
java.lang.AbstractMethodError
at com.facebook.presto.server.PluginManager.installPlugin(PluginManager.java:183)
at com.facebook.presto.server.PluginManager.loadPlugin(PluginManager.java:175)
at com.facebook.presto.server.PluginManager.loadPlugin(PluginManager.java:158)
Unfortunately, I do not see any verbose error message which will give me a clue on what is actually missing here. I used presto-ml plugin as an example and implemented getFunctions() in plugin implementation. Is there a way to figure out what is missing?
I did check the source code of PLuginManager.java. I am just looking for a way to debug this in a better way.

ORMLite + H2 error: "No database files have been found in directory..."

I am very new to working with databases in Java. I am running an eclipse project that implements ORMLite over H2.
The problem is that as long as I have just my test project my code works fine. That is to say, my code creates a new database file and populates it with tables which then get data inserted into them.
But, when I import another project into my work-space I get the following message on the console whenever I try to run ANY project:
No database files have been found in directory C:\Users\crimsonsky\workspace\Common
This isn't an error, but it does terminate the run of the code before any of my code had a chance to run.
I'm guessing this is some sort of configuration problem but I can't resolve it.
can anyone help? I've tried looking for the message in the documentation of both H2 and ORMLite but found no reference to it.
It sounds like there is something wrong in your project entry point (AKA public static void main(string[] args)). The project is trying to start from one of the h2 classes. I would recheck the import process. Make sure you are running everything from where you wanted

Why is IntelliJ saying: Package secure does not exist?

I've setup my Play Framework 1.2.1 project to run from within IntelliJ using the instructions from the following post on Google groups:
http://groups.google.com/group/play-framework/msg/54cfe212cbae218e
However, following the tutorial at http://www.playframework.org/documentation/1.2.2/guide8, I'm getting the following error from the IDE:
/Library/WebServer/Documents/devschool.play/app/controllers/Security.java
package Secure does not exist
/Library/WebServer/Documents/devschool.play/app/controllers/Application.java
cannot find symbol class Secure
When I run the application with > play run, everything works fine, but I prefer running it from the IDE. Please note that the project was running perfectly from the IDE before I added the secure module.
Is there a way to fix this? I have a hunch it's to do with an external source, but not being a Java expert, I'm not entirely sure how to do this.
Can anyone please assist?
You should run the following commands:
play dependencies
play idealize
The first one will resolve the dependencies from the Secure module.
The second will update the IntelliJ "classpath" and the red lines/errors regarding the Secure module will disappear.
Okay, so the project is compiling and running okay after unchecking the "Make" checkbox from the Edit Configurations dialog box.
To get the IDE to find the code, you simply need to Attach Sources. On the Mac, press Command + ; and add the sources under the Libraries section.
From the second link you posted, there is a class called Security, it looks like this:
public class Security extends Secure.Security {
static boolean authenticate(String username, String password) {
return true;
}
}
Security extends Secure.Security, which is another class named Security in the Secure package. This error is saying that it cannot find the package Secure. Make sure you are including everything in your classpath properly.
Make sure you run play idealize after adding modules to dependencies.yml or adding dependencies to the application.conf(which is deprecated by the way)
Adding modules in application.conf is deprecated and shouldn't be used anymore. Instead use dependencies.yml and add
- play -> secure
So now my dependencies.yml looks like:
# Application dependencies
require:
- play
- play -> secure
I then ran:
play dependencies
play idealize
and there was a delay but eventually Intellij recognized the module. Not sure exactly if the last commands were necessary.
(Reposting an answer by Sascha Kleiber from the relevant page of the Play tutorial: http://www.playframework.org/documentation/1.2.4/guide8)

Categories