Cannot Create New file: The device is not ready - java

I am Creating a new File using Java but am getting tis exception:
Exception in thread "main" java.io.IOException: The device is not ready
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:947)
at pdfconverter.PdfConverter.main(PdfConverter.java:96)
Java Result: 1
In My line 96 is this Condition:
if (!logfile.exists()) {
logfile.createNewFile();//line 96
}
I have used this amny times before and I do not understand what's going on Because I am logged in as Administrator. Please Help.

The problem was the Path, which was not found because someone had renamed the drive letter from F to D. Sorry for not noticing that In time.

If this kind of error occurred in your net-beans while you deploying an app then open this path C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.3\conf\Catalina\localhost (it might be different as your tomcat installation dir). There is web.xml you should open it and check docBase="D:\xyz\web\target\web" is configured by proper project base directory or not.

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

I followed the steps of Google's help, but the credentials do not work [duplicate]

When running the Java quickstart sample at https://developers.google.com/drive/web/quickstart/java?hl=hu in NetBeans, I'm receiving the error code:
Jun 04, 2015 12:12:11 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for everybody:
C:\Users\Quibbles\credentials\drive-api-quickstart
What am I doing wrong?
Edit: This is the complete error message.
Jun 04, 2015 5:11:39 PM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for owner: C:\Users\Quibbles\.credentials\drive-api-quickstart
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
at DriveQuickstart.authorize(DriveQuickstart.java:64)
at DriveQuickstart.getDriveService(DriveQuickstart.java:87)
at DriveQuickstart.main(DriveQuickstart.java:96)
Java Result: 1
Had the same issue and wasted hours before realizing that "unable to change permissions for owner: C:\Users\Quibbles.credentials\drive-api-quickstart"
is just a warning.
The real issue is the null pointer here.
InputStream in =
DriveQuickstart.class.getResourceAsStream("/client_secret.json");
This line was the issue in my case. "in" was null and hence the null pointer.
InputStream in = new FileInputStream("<Full Path>\\client_secret.json");
This resolved my issue.
The actual problem is a bug in Google's API code for setPermissionsToOwnerOnly
The code was written to only work on Linux/Unix based systems and not Windows ACL based systems.
You can ignore the warning or write your own DataStore class that sets the permissions correctly for Windows.
I'm going to try to file a bug with Google on it too.
I was facing same issue in Eclipse. Here’s a solution:
Run eclipse in admin mode
Clear the directory
C:/Users/<username>.credentials/calendar-java-quickstart.json
Copy the .json file the bin directory, e.g. bin/main/resources/client_secret.json
You are free to run now.
Basically if you already enabled de Drive API and created credentials.json file at Google Drive API Rest, now you need :
1 - Remove the tokens directory generated in you last execution. In this directory contains a file StoredCredential.
2 - Change de SCOPE to DriveScopes.DRIVE like sample bellow:
private static List SCOPES = Collections.singletonList(DriveScopes.DRIVE);
3 - Re run the program. It will be request that you login in your google account to give the access consent.
4 - It will be generated a new one tokens directory in your project and now with with read and write permissions at google Drive.
This work for me.
I just ran into the same issue with the https://developers.google.com/google-apps/calendar/quickstart/java example. I suspect that the issue is that you are running it in Windows and the JVM that you are running it does not have Adminsitrator rights for changing the file permissions in Windows.
See Run Java application as administrator on Windows
Had the same problem when running the example given in the tutorial "https://developers.google.com/drive/v2/web/quickstart/java". Followed the instruction ditto as given the in the tutorial, but kept getting this permission exception. Eventually, managed to sort it out by moving the "client_secret.json" to the "\build\classes\main\classes" folder. Also, before building the project with "gradle -q run" for the first time, delete any files in the "C:\Users\userName\.credentials" folder.
Just make sure that client_secret.json is under main/resources/ directory.
InputStream in =
DriveQuickstart.class.getResourceAsStream("/json/client_secret.json");
Was able to resolve the issue by deleting the StoredCredentials files under the token folder. I had to reauthenticate again with google the next time the program was executed.

why glassfish 4.1 runs in netbeans 8.0 but in eclipse luna does not

I´m trying to work with eclipse and export my web apps made in netbeans, i just add a new server, download glassfish tools, and shows me an error:
Unable to start server due following issues:
Launch process failed with exit code 1
Launching GlassFish on Felix platform
ERROR: Error creating bundle cache. (java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFoundException: C:\Program Files (x86)\glassfish-4.1\glassfish\domains\domain1\osgi-cache\felix\cache.lock (Acceso denegado))
java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFoundException: C:\Program Files (x86)\glassfish-4.1\glassfish\domains\domain1\osgi-cache\felix\cache.lock (Acceso denegado)
any help?
I guess this is a problem with the access rights.
If the file cache.lock is in the folder which is mentioned in the error message, you should check if it is in use by another process.
Even if you start Eclipse as Administrator, it may not start Glassfish as Administrator.
To fix the problem, you can move your Glassfish installation to a folder where you have write access without the Adminstrator account. Update the location of the Glassfish installation in Eclipse. This should make it work.
Check if cache.lock is being used/if it currently exists.
Check if glassfish is currently running.

SOLR configuration troule

I am following the tutorial "Running Nutch and Solr on Windows Tutorial" (Part 1) from Youtube and trying to configure properly Solr. I make the change in the C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\solr\WEB-INF\web.xml file as explained in the tutorial - putting the solr home path:
<env-entry-value>C:\cygwin64\home\solr\example\solr</env-entry-value>
And I gain in the browser:
HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure: Error opening new searcher,
trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init
failure: Error opening new searcher at
org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:745) at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:307) at ...
When I copy the content of the folder C:\cygwin64\home\solr\example\solr to a new folder at C:\solr and the change the solr path to:
<env-entry-value>C:\solr</env-entry-value>
it works fine. It is the same situation when I Set the Java system property solr.solr.home my Solr Home:Windows > Start > Monitor Tomcat > Java Tab > Java Options -> Enter the following entry:
-Dsolr.solr.home=c:\solr
It works fine in this cae, but not when I put:
-Dsolr.solr.homeC:\cygwin64\home\solr\example\solr
I want solr to work under cygwin as in the tutorial, since it might be needed in that folder later, and I can't get it where could be the problem. Thanks in advance.
I solved the problem, it was about file permissions at Cygwin folder, the Solr coludn't create folders. I changed manually the access rights.

ZMQ - libzmq.so.3: cannot open shared object file: No such file or directory

I'm trying to embed zeroMQ in my app, I followed this guideline to install ZMQ, so till here everything works fine.
I have this line of code in my app:
ZMQ.Context m_context = ZMQ.context(1);
but above line of code raise below exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libjzmq-812339378390536247.lib: libzmq.so.3: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at org.zeromq.EmbeddedLibraryTools.loadEmbeddedLibrary(EmbeddedLibraryTools.java:136)
at org.zeromq.EmbeddedLibraryTools.<clinit>(EmbeddedLibraryTools.java:22)
at org.zeromq.ZMQ.<clinit>(ZMQ.java:38)
at com.castaclip.verticals.Messenger.<init>(Messenger.java:125)
at com.castaclip.verticals.PushMessenger.<init>(PushMessenger.java:30)
at com.castaclip.verticals.pushserver.App.setup(App.java:60)
at com.castaclip.verticals.pushserver.App.main(App.java:41)
The error is exactly pointing to this line.
P.S: its a little bit difficult to fully explain this question.. if you have any question plz let me know. thanks.
If you've successfully built libzmq and jzmq in that order, I would run:
$ sudo ldconfig
to update the system library cache. Then I would check to see if LD_LIBRARY_PATH is defined like Raffian mentioned, or set your library path explicitly to something like:
$ java -Djava.library.path=/usr/lib:/usr/local/lib
Finally I tried to figure out the problem.
I was using zeromq-2.1.10 and this was part of the problem.
So I installed zeromq-3.2.3 from the source and problem resolved.
I encountered a mystifying instance of this message when I:
# java -Djava.library.path=/usr/hf/zmq/lib/ -cp '/usr/hf/lib/*:.' com.zmqtest.MA
Exception in thread "main"
java.lang.UnsatisfiedLinkError: /usr/hf/zmq/lib/libjzmq.so:
libzmq.so.3: cannot open shared object file: No such file or directory
which was fixed with a solution that makes no sense at all to me:
# LD_LIBRARY_PATH=/usr/hf/zmq/lib/ java -Djava.library.path=/usr/hf/zmq/lib/ -cp '/usr/hf/lib/*:.' com.zmqtest.MA
wierd.

Categories