Change System properties for h2 database - java

I tried to run a jar file from mainframes USS.
java -jar Batch.jar Batch.cfg
I got the below h2 exception. Looks like I don't have necessary permission to write it to /test.trace.db. I would like to change the directory so that I don't need to worry about the access. How can I specify the directory for the trace file with java -jar command?
org.h2.message.DbException: Log file error: "/test.trace.db", cause: "java.io.FileNotFoundException: /test.trace.db (EDC5111I Permission denied.)" [90034-190]

According h2 documentation, you need to update system property h2.clientTraceDirectory.
Something like java -Dh2.clientTraceDirectory=mydir -jar Batch.jar Batch.cfg

Related

Cannot open sever.jar file

So I was trying to make a 1.17.1 minecraft server on my mac. I couldn't open my 1.17.1_server.jar with Java 8 so I download Java 16.0.2.
Unfortunately, everytime I was opening the 1.17.1_server.jar file, I got
"The Java JAR file "1.17._server.jar" could not be launched." .
I first thought that it was because the file was launch by Java 8 instead of 16.
So I went into the terminal and run :<path to java> -jar 1.17.1_server.jar
I then got this : Error: Unable to access jarfile 1.17.1_server.jar
Finally i tried to put the path of the jar file in the command...
So I've run : path to java -jar path to server
and got this :
[main/ERROR]: Failed to load properties from file: server.properties
[15:57:35] [main/WARN]: Failed to load eula.txt
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
So why I have to agreed Eula if i've never launched it ? Does it think that he already been launched ?
As stated in the error message
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
You have to open the file and check yes
Okay find the solution: my eula and server properties file were in my user folder dk why (never moved them so...)

Wix pre-processor rejecting class files with `$anon$` in them from a Scala application

I'm trying to automate the build process of my Scala application for producing a msi installer.
When doing so, windows claims that certain files cannot be found. Here is the command that gets run
[21:39:01.842] Running C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe in C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull
and further down, i start seeing errors like this:
C:\Users\runneradmin\AppData\Local\Temp\jdk.jpackage6105194214114584024\config\bundle.wxf(56) : error LGHT0103 : The system cannot find the file 'C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull\app\classes\com\krystal\bull\gui\FileMenu$anon$2.class'.
C:\Users\runneradmin\AppData\Local\Temp\jdk.jpackage6105194214114584024\config\bundle.wxf(71) : error LGHT0103 : The system cannot find the file 'C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull\app\classes\com\krystal\bull\gui\dialog\ViewEventDialog$anon$10$anon$21$anonfun$lessinit$greater$1.class'.
C:\Users\runneradmin\AppData\Local\Temp\jdk.jpackage6105194214114584024\config\bundle.wxf(81) : error LGHT0103 : The system cannot find the file 'C:\Users\RUNNER~1\AppData\Local\Temp\jdk.jpackage6105194214114584024\images\win-msi.image\krystalbull\app\classes\com\krystal\bull\gui\SettingsMenu$anon$5.class'.
You can see more instances of this error in the build log here:
https://github.com/bitcoin-s/krystal-bull/runs/2697961906?check_suite_focus=true#step:8:11
My question is this:
What are the limitations in the windows file system or the program candle.exe that prevent the pre-processor from reading Scala files that include things like $anon$
Is there a valid syntax guide somewhere?
Will I need to manually rename all of these files?

H2 java.lang.ClassNotFoundException for trigger passed in classpath

I'm starting the h2 server using this command:
java -Xms256M -Xmx512M -Xss1024K -cp "C:\workspaces\ProjectA\ModuleA\target;C:\Program Files (x86)\H2\bin\h2-1.4.199.jar" org.h2.tools.Server -tcp -tcpPort 80 -tcpAllowOthers -baseDir C:/database/h2/data
where in C:\workspaces\ProjectA\ModuleA\target I got jar where is my trigger class(I checked with the total commander, and I'm 100% sure it is there)
Then I open my h2 database and try to run sql on table for which I have set up trigger, but it throws:
Caused by: org.h2.message.DbException: Class "com.test.projecta.trigger.Trigger" not found [90086-199]
at org.h2.message.DbException.get(DbException.java:194).
Why is it thrown? As I understand trigger should be added to classpath and it is, so why it is not seen?
Solved: It was the problem with the way I was connecting to the database.I was specifying JDBC URL like jdbc:h2:C:\database\h2\data\database instead of doing it this way jdbc:h2:tcp://localhost:80/database

Distributedfilesystem class use local instead of distributed classes

I have this line in my code:
DistributedFileSystem.get(conf).delete(new Path(new URI(otherArgs[1])), true);
otherArgs[1] has this value: hdfs://master:54310/input/results
I receive this exception:
Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS:hdfs://master:54310/input/results, expected: file:///
at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:354)
at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:55)
at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:367)
at org.apache.hadoop.fs.ChecksumFileSystem.delete(ChecksumFileSystem.java:430)
at <package>.<classname>.main(Degree.java:137)
Note: I tried to use new Path(otherArgs[1]) without URI but got the exact same error !
Thanks,
-K
It looks like you have not set fs.default.name in core-site.xml.
check this link
If you have already set that, make sure the config files are in classpath
You can also set the fs.default.name property from your driver
conf.set("fs.default.name", "hdfs://yourserver:port");
It turns out that I was running my jar using "hadoop -jar " instead of "hadoop jar ". All conf files are correct and in place.
Problem solved but i still have no idea why using "-jar" made it run as a local (pseudo distributed) !

On other pc java.sql.SQLException: No suitable driver found for jdbc:sqlserver

I wrote an app and it works fine by me. But on other pc-s it throws an exception.
java.sql.SQLException: No suitable driver found for jdbc:sqlserver
I give it (only the app.jar file) to my college, and he gets this error. I give him a jdbcdriver.jar file and, nothing changed.
However I use jre7, I added a line to the code:
Class.forName("com.mysql.jdbc.Driver");
And than he gets another exception:
Error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
What can I do to run this app properly on other pc-s?
Put the jar file, containing the MySql Driver on the classpath when starting your application.
The switch is called -cp or -classpath like this:
java -cp ".;mysql.jar" my.package.Main
assuming you start your application from the root directory which is named my.package.Main. The classpath separator is the one for Windows. For unix based OSs you need to use : i guess.

Categories