Java Web Start app logging permission denied - java

My java app runs fine stand-alone. But when I run it as a Java Web Start app, it starts up but fails when I click a certain button. I couldn't figure out how to debug it so thought I'd add logging. That caused permission denied error and wouldn't even start up.
To try and solve that problem, I added
permission java.util.logging.LoggingPermission "control"
to the C:\Program Files\Java\jre1.8.0-171\lib\security\java.policy file and the C:\Program Files\Java\jdk1.8.0-171\jre\lib\security\java.policy file. Restarted the Apache HttpServer and tried again. Same result.
Next I added the following line to the same two files:
permission java.security.AllPermission;
Same result.
Next I self-signed the jar file. Same result.
Next I added
<security><all-permissions/></security>
to the dynamically generated .jnlp file. This time I got a new message:
"unsigned application requesting unrestricted access to system"
A jarsigner verify confirms the jar file has been signed:
jarsigner -verify myjarfile.jar
jar verified.
I don't know what else to try. Suggestions?

First of all, there needed to be a ";" after "control". I don't know if that would have fixed the problem in itself but I found a parsing error for it in the log file. Meanwhile, I had changed all my "logger" commands back to System.out.println commands.
Next I checked "Enable tracing" and "Enable logging" in the Advanced tab of the Java Control Panel.
Then, in a DOS shell, I navigated to the location of myjnlp.jnlp file and entered the following commands:
set JAVAWS_TRACE_NATIVE=1
set JAVA_TOOL_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
javaws myjnlp.jnlp
That caused log files to be created in the home directory at C:\Users\Greg\AppData\LocalLow\Sun\Java\Deployment\log
where I could then see what was going on.
Unfortunately a new problem. See code below:
File source = new File(localFilename);
File dest = new File("C:/E360/CadIntegration/" +localFilename);
try {
Files.copy(source.toPath(),dest.toPath());
msg = "Because IP was blank, file was copied to C:/E360/CadIntegration";
} catch (IOException ex) {
msg = "problem copying " +source.toPath() +" to " +dest.toPath();
System.out.println("uploadCadChanges: " +msg +", IOException is "+ex.getMessage());
}
If I run the app using javaws, it works perfectly, the file is copied over successfully. But if I run it from the web page it fails with the IOException and ex.getMessage() just says "CadChanges.txt". Real helpful.
I found the reason. When run from a web page, the current working directory is changed to current dir = C:\Program Files (x86)\Google\Chrome\Application\67.0.3396.99 but when run from javaws, it isn't. The solution was to pass the current directory to the .jnlp file via an argument tag and have the app change the cwd to it.

Related

Rundeck config file not found when service starts up

I have installed RD 4.8 CE on a Windows 2019 server + MariaDB. The application is up and I can login with the admin account. Service is Windows integrated.
I'm trying now to allow AD users to login and perform activities. I haven't found much documentation on how to configure RD on Windows. So I'm grabbing from here and there. So far I have done the following:
Created a file called jass-multiauth.conf in server/config/ folder as listed below:
multiauth {
com.dtolabs.rundeck.jetty.jaas.JettyCombinedLdapLoginModule sufficient
debug="true"
contextFactory="com.sun.jndi.ldap.LdapCtxFactory"
providerUrl="ldaps://xxxxxxxxxxx:636"
bindDn="CN=xxxxxx,OU=Service Accounts,OU=Admin Users and Groups,OU=xxx,DC=xxx,DC=xxx,DC=xxx"
bindPassword="x$xx<x>xx"
authenticationMethod="simple"
forceBindingLogin="true"
userBaseDn="OU=Admin Users,OU=Admin Users and Groups,OU=xxx,DC=xxx,DC=xxx,DC=xxx"
userRdnAttribute="sAMAccountName"
userIdAttribute="sAMAccountName"
userPasswordAttribute="unicodePwd"
userObjectClass="user"
roleBaseDn="OU=Groups,OU=Admin Users and Groups,OU=xxxx,DC=xxx,DC=xxx,DC=xxx"
roleNameAttribute="cn"
roleMemberAttribute="member"
roleObjectClass="group"
cacheDurationMillis="300000"
timeoutRead="10000"
reportStatistics="true"
supplementalRoles="user";
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required
debug="true"
file="E:/rundeck/server/config/realm.properties";
};
when I restart rundeck service the AD users are not recognized and no error at all is displayed in the log. I can however login with the admin account. So to troubleshoot this I added:
java %RDECK_CLI_OPTS% %RDECK_SSL_OPTS% -Drundeck.jaaslogin=true -Dloginmodule.conf.name=jaas-multiauth.conf -Djava.security.auth.login.config=E:\rundeck\server\config\jaas-multiauth.conf -Dloginmodule.name=multiauth -jar rundeck.war --skipinstall -d >> %CURDIR%\var\logs\service.log 2>&1
to the start-rundeck.bat file and in fact when I launch it I see an error which is quite weird:
[2022-12-22T18:58:09,409] ERROR config.GrailsApplicationPostProcessor - Error loading spring/resources.groovy file: java.io.IOException: E:\rundeck\server\config\jaas-multiauth.conf (No such file or directory)
java.lang.SecurityException: java.io.IOException: E:\rundeck\server\config\jaas-multiauth.conf (No such file or directory)
the file is there, path is correct and permission is set as on any other file in same directory. I deleted the file and created it again, but same error.
Also, I have a question: I understand that I should not edit the profile file. Hence, when the problem above is fixed, considering that the rundeck service is Windows integrated, where shall I put the line:
java %RDECK_CLI_OPTS% %RDECK_SSL_OPTS% -Drundeck.jaaslogin=true -Dloginmodule.conf.name=jaas-multiauth.conf -Djava.security.auth.login.config=E:\rundeck\server\config\jaas-multiauth.conf -Dloginmodule.name=multiauth -jar rundeck.war --skipinstall -d >> %CURDIR%\var\logs\service.log 2>&1
to refer the jass-multiauth.conf file?
Your multiauth config file is saved as jass-multiauth.conf but the launcher script is looking for jaas-multiauth.conf (jass =! jaas). That is the reason of "No such file or directory" error. Rename the file as jaas-multiauth.conf and relaunch the Rundeck service.

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...)

FTPClient - 550 permission denied

i'm running java 1.7.0_21 on a windows 7 machine, and i try to delete a file on a ftp ubuntu-server. The following code snippet, shows what i do. the strange thing is, the file has the read, write and execute permission. the containing folder too. when i ask the bPermisison i receive true, but i can not delete this file....
The replyString gives the error 550 permission denied.
The same code snipped (and implementation) works fine on another ftp server.
I searched really long, but i didn't find any hint. does somebody know what's going wrong?
Thanks for any help.
String sFilePath = FileUtil.concatPath(sParamRemotedir, oFTPFile.getName(), "/");
boolean bPermission = FTPFile.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION);
boolean bDeleted = oFTPClient.deleteFile(sFilePath);
sReplyString = oFTPClient.getReplyString();
if(bRetrieveOK && !bDeleted) {
m_oDialogError.show(ErrorText.ERROR_TRASYSTHREAD_FTPMOVE_DELETEERROR, oFTPFile.getName(), oFTPClient.getReplyString());
bOK = false;
}
I too had the similar problem. Once I did the following everything is fine now.
With FTP it is not sufficient be owner of files and directories. The service and daemon FTP must be correctly configured in order to write and create files etc.
In Ubuntu:
Edit /etc/vsftpd.conf
sudo gedit /etc/vsftpd.conf
And in the line
#write_enable=YES
Remove # in front i.e.,
write_enable=YES
Finally restart the service:(this is very important)
sudo service vsftpd restart

Creating a directory on client machine using applet

I have a self signed applet running in the browser, this applet should create a directory on the client machine using this code.
boolean success = (new File("myDir")).mkdirs();
if (!success) {
System.err.println("Directory creation failed");
}
However, when I run it in the browser (under Apache) and after accepting all the security warnings I can't find myDir directory on my machine.
Am I doing something wrong?
I guess you are not looking at the right place...
Given your code snippet, this directory will be created in the current working directory. To be sure where that is on your machine just try to see what the following code gives out :
System.out.println(System.getProperty("user.dir"));
You're not giving it an absolute path so it's creating myDir in the working directory that the browser runs it in, probably a temp dir, or even a "sandbox" area in some browsers.
Because you run applet in sandbox, so You cannot access into user machine resource.
Please see document:
Applet security

Deployment in tomcat

i am getting a problem
i have deployed a war file, when i run localy through tomcat it works fine but when i run on another system by giveing my system ip and then project folder e.g
http:\192.168.0.145\DllTest it loads the applet but when i click on a button to load the functionality it is throwing an exception
Exception in thread "AWT-EventQueue-3" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: http:\192.168.0.145:8080\DllTest\lib\jinvoke.dll
while it is working fine localy but not in another system. Please tell me what is the problem.
Is it a rights issue or something else.
You cannot load a DLL on an external host. It has to be an absolute disk file system -as the exception message already hints. Your best bet is to download it manually, create a temp file and load it instead.
File dllFile = File.createTempFile("jinvoke", ".dll");
InputStream input = new URL(getCodeBase(), "lib/jinvoke.dll").openStream();
OuptutStream output = new FileOutputStream(dllFile);
// Write input to output and close streams the usual Java IO way.
// Then load it using absolute disk file system path.
System.loadLibrary(dllFile.getAbsolutePath());
dllFile.deleteOnExit();

Categories