I get the error:
java.io.IOException: This server does not support operations to modify file attributes.
at com.sshtools.j2ssh.sftp.SftpSubsystemClient.getOKRequestStatus(Unknown Source)
at com.sshtools.j2ssh.sftp.SftpSubsystemClient.setAttributes(Unknown Source)
at com.sshtools.j2ssh.sftp.SftpSubsystemClient.changePermissions(Unknown Source)
at com.sshtools.j2ssh.SftpClient.chmod(Unknown Source)
at com.sshtools.j2ssh.SftpClient.put(Unknown Source)
at com.sshtools.j2ssh.SftpClient.put(Unknown Source)
at com.sshtools.j2ssh.SftpClient.put(Unknown Source)
at com.sshtools.j2ssh.SftpClient.put(Unknown Source)
After some digging I found out that the SftpClient.put command does an automatic chmod after it uploads a file. Is there a way for me to disable this?
I know for sure the initial .put works as expected because when I check the remote server for the file, it is present and all bytes accounted for.
Related
I am trying to connect a java program to a database. I have sajdbc4.jar in the build path and it worked before, but now I keep getting this error when I try to make the connection:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no dbjdbc12 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at sybase.jdbc4.sqlanywhere.IDriver.try_load(IDriver.java:455)
at sybase.jdbc4.sqlanywhere.IDriver.(IDriver.java:396)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at java.sql.DriverManager$2.run(Unknown Source)
at java.sql.DriverManager$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.sql.DriverManager.loadInitialDrivers(Unknown Source)
at java.sql.DriverManager.(Unknown Source)
at Main.main(Main.java:26)
Can someome please help me? Can't find anything abount this issue online.
For windows find this file in your computer:
dbjdbc12.dll
For linux find this file:
libdbjdbc12.so
Put the location of this file on the java.library.path either with a command line option:
java -Djava.library.path=DIRECTORYWITHDLL ...
or using System.setProperty in your code:
System.setProperty("java.library.path","DIRECTORYWITHDLL");
For Linux, you need to add the dbjdbc12.so to java.library.path using:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/some/path/that/contain/dbjdbc12.so
this is the same for dbjdbc16 also.
Since, sybase.jdbc4 driver need this file. Please refer- https://blogs.sap.com/2014/05/02/connecting-to-sql-anywhere-using-jdbc-2/#:~:text=jar%20is%20in%20the%20classpath,Connection%20con%20%3D%20DriverManager.
Similarly, for windows add dbjdbc12.dll file.
For SQL Anywhere 17 libdbjdbc17.so was not suffiecient, it was then complaning about the next file:
failed: java.lang.UnsatisfiedLinkError: /usr/local/tomcat/native-jni-lib/libdbjdbc17.so: libdbtasks17_r.so: cannot open shared object file: No such file or directory
So I ended up adding all files from the lib64 folder from the Database client (after I installed it on some other linux machine) to my tomcat lib path and it worked.
I use GWT 2.7 with super dev mode. When it comes to an exception the stack trace looks like the following:
SEVERE: UncaughtExceptioncom.github.nmorel.gwtjackson.client.exception.JsonDeserializationException: Unknown property 'uploadImageId'
at Unknown.AHc_g$(Unknown Source)
at Unknown.vHc_g$(Unknown Source)
at Unknown.OHc_g$(Unknown Source)
at Unknown.VHc_g$(Unknown Source)
at Unknown.aIc_g$(Unknown Source)
at Unknown.gIc_g$(Unknown Source)
at Unknown.rDc_g$(Unknown Source)
at Unknown.qDc_g$(Unknown Source)
at Unknown.vNb_g$(Unknown Source)
at Unknown.nNb_g$(Unknown Source)
at Unknown.oNb_g$(Unknown Source)
at Unknown.pNb_g$(Unknown Source)
at Unknown.gNb_g$(Unknown Source)
at Unknown.fNb_g$(Unknown Source)
at Unknown.$Cc_g$(Unknown Source)
at Unknown.ZCc_g$(Unknown Source)
at Unknown.zOm_g$(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.ZDe_g$(Unknown Source)
at Unknown.aEe_g$(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.anonymous(Unknown Source)
I have a GWT project running in a GWT-PhoneGap environment on my iPhone and I use the Safari Console for Debugging.
How can I get the full stack track deobfuscated with SuperDevMode?
Edit: I also use the following flag:
-XmethodNameDisplayMode Full
It does not work.
As of GWT 2.7.0, this isn't possible. You might want to follow this GWT bug.
The -XmethodNameDisplayMode Full only applies to the browser's dev tools. So if you set this parameter and set a breakpoint in the source code, the method names of the call stack will be displayed correctly in dev tools. This doesn't affect the call stack produced by log output (which is what you posted in your question).
Try setting the compiler option style to PRETTY or DETAILED
-style Script output style: DETAILED, OBFUSCATED or PRETTY (defaults to OBFUSCATED)
see GWT compiler options
I am seeing below errors in java console when trying to launch an applet. We are running on Apache 2.2 and WebSphere application server 7.0.0.27. any pointers please?
JNLParseException[ Could not parse launch file. Error at line 26.]
at com.sun.javaws.jnl.XMLFormat.throwNewException(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$300(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: JNLParseException[ Could not parse launch file. Error at line 26.], bail out
There is a neat tool for checking jnlp errors: JaNeLA (available on my share drive).
According to the Exception, you have a XML Syntax error in your jnlp file.
You could use a XML Editor to validate the file (as XML Copy Editor). Also you can put the JNLP file in your question.
I would like to use this applet this applet in a html document. In the example on this site they use :
<applet code="de.wim.outldd.examples.DragDropTest_Applet"
width="150" height="150" alt="Applet1" archive="soutldd.jar">
</applet>
It does not work when I try it. My HTML document is in the middle of the extracted directory. How can I use the applet in html, somebody please try this.
THe error in the console
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at de.wim.outldd.OutlookDD.init(OutlookDD.java:73)
at de.wim.outldd.examples.DragDropTest_Applet$1.run(DragDropTest_Applet.java:29)
at java.security.AccessController.doPrivileged(Native Method)
at de.wim.outldd.examples.DragDropTest_Applet.<init>(DragDropTest_Applet.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission java.io.tmpdir read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at de.wim.outldd.OutlDDNativeLib.loadDllFromResource(OutlDDNativeLib.java:135)
at de.wim.outldd.OutlDDNativeLib.loadDll(OutlDDNativeLib.java:104)
at de.wim.outldd.OutlDDNativeLib.<clinit>(OutlDDNativeLib.java:62)
... 19 more
Exception: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
Your applet is trying to read the temp directory value from the java.io.tmpdir system property which is previleged. Applets run in a sandbox environment with restricted permissions beacause of security reasons. To fix it, override the default security policy to allow your applet to read the property by setting the property permission - java.util.PropertyPermission, on the property. To override default permissions define the policy in your user home's .java.policy file. It is recommended that you edit your user specific policy file and not the global policy file under your JRE security directory. Refer the template below:
grant codeBase "<code base>" {
permission <type> "<target>", "<actions>";
permission <type> "<target>", "<actions>";
...
};
For eg.
grant codeBase "http://geosim.cs.vt.edu/geosim/-" {
permission java.util.PropertyPermission "java.io.tmpdir", "read";
...
};
Edited:
I noticed that you already have the applet link specified in your post at the top. So, I am giving a step by step guide to get you started.
Here you go -
Copy $JRE_HOME/lib/security/java.policy file to your user home (on windows it is c:\users\< user name>) as .java.policy file. Please note the preceding "." in the file name.
Add the following lines to the end of .java.policy file:
grant codeBase "http://www.wilutions.com/outldd/-" {
permission java.security.AllPermission;
};
Run the applet in an appletviewer as follows and see if it works.
appletviewer http://www.wilutions.com/outldd/example.html
Please note that I am specifying all permissions to the applet for sake the of geting you started but it is potentially insecure to grant all permmissions. You should grant only the required permissions. So, I leave it to you to figure it out.
Have you followed the guide found here and are you sure the specified paths are correct in relation to your directory/html page?
Also what about applet JAR file soutldd.jar path is this correct?
go to Java preferences->advance and turn Java console on so that you can see what is happening on loading your applet in HTML.
in windows
java preferences: control panel -> java
is it possible to use java.util.Logging and log to a file in a java webstart application?
I have the following logging code:
Handler fh = new FileHandler("myapp.log");
Logger.getLogger(MyApp.class.getName()).addHandler(fh);
and got the following exception:
java.security.AccessControlException: access denied (java.util.logging.LoggingPermission control)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.util.logging.LogManager.checkAccess(Unknown Source)
at java.util.logging.Handler.checkAccess(Unknown Source)
at java.util.logging.FileHandler.(Unknown Source)
at whoisapiclient.WhoisAPIClientApp.main(WhoisAPIClientApp.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
The access control exception says this:
"access denied (java.util.logging.LoggingPermission control)"
The javadoc for the permission class says this:
"Currently there is only one named LoggingPermission. This is "control" and it grants the ability to control the logging configuration, for example by adding or removing Handlers, by adding or removing Filters, or by changing logging levels."
What you are doing clearly falls under the "control" permission.
You will need to sign your application if it is to create/add its own log handlers.
Incidentally, if you did manage to work around the LoggingPermission("control"), you would then run into another access issue in opening the log file.
Both problems are solved by signing the application. You've then got the problem that the user has to accept / trust your signing key. But that is fair enough! As far as the Java security sandbox can tell, what you are doing could potentially damage the user's machine.
Have you tried specifying an absolute path? Perhaps the issue is that you don't have access to the current working directory of the application itself.