I exported a project that reads 2 configuration files. However, when I execute the jar, it gets this error:
Error: java.io.FileNotFoundException: config/dbConnection.config (No such file or directory)
Error: java.io.FileNotFoundException: config/test.config (No such file or directory)
com.smart.ets.services.ServiceException: com.smart.ets.services.ConfigErrorException
at com.smart.ets.services.TransactionServiceImpl.getConfigData(TransactionServiceImpl.java:30)
at com.smart.ets.controllers.Simulator.getTransactionSimulationResults(Simulator.java:41)
at com.smart.ets.controllers.Simulator.main(Simulator.java:26)
Caused by: com.smart.ets.services.ConfigErrorException
... 3 more
mickey91#mickey-espiritu:~/Documents/Dropbox$ java -jar ETS.jar
Error: java.io.FileNotFoundException: config/dbConnection.config (No such file or directory)
Error: java.io.FileNotFoundException: config/test.config (No such file or directory)
com.smart.ets.services.ServiceException: com.smart.ets.services.ConfigErrorException
at com.smart.ets.services.TransactionServiceImpl.getConfigData(TransactionServiceImpl.java:30)
at com.smart.ets.controllers.Simulator.getTransactionSimulationResults(Simulator.java:41)
at com.smart.ets.controllers.Simulator.main(Simulator.java:26)
Caused by: com.sm
art.ets.services.ConfigErrorException
... 3 more
Any way to fix this? It works if I run the project(not the jar file of the project)
You neglect to mention how you're accessing the files, but from the error it looks like you're trying to access them as files--but they're not, they're resources on the classpath.
As such, you should be using getResourceAsStream. The name of the resource would be the package-relative path.
Related
I get the following Exceptions while running my web application in tomcat server:
1:
SEVERE: Failed to load keystore type JKS with path {myWorkspace}.metadata.plugins\org.eclipse.wst.server.core\tmp1\bin/keystore due to {myWorkspace}.metadata.plugins\org.eclipse.wst.server.core\tmp1\bin\keystore (The system cannot find the file specified)
java.io.FileNotFoundException: {myWorkspace}.metadata.plugins\org.eclipse.wst.server.core\tmp1\bin\keystore (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:146)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:385)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:291)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManager..........................
2:
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8444"]
java.io.FileNotFoundException: {myWorkspace}.metadata.plugins\org.eclipse.wst.server.core\tmp1\bin\keystore (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:146)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:385)...........................
3:
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base {myWorkspace}.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps{workspcae name} does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:138)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5002)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5182)
Your application requires a file(A keystore in your case) that is not present inside the war file or maybe you're referring to a folder where you need to copy the .jks file.
Make sure to check the path that you are providing for the keystore(.jks) file is correct.
I have a spring boot app which is giving the below error on creating Persistence EntityManager factory.
Persistence.createEntityManagerFactory
The war file is available under
/opt/test/app/app.war
and WEB-INF/classes also present in this war file.
But classloader is failing with the below error.
Is there any permission missing?
oggerName="org.hibernate.orm.url" threadName="main" txnId="" HHH10000002: File or directory named by URL [file:/opt/test/app/app.war!/WEB-INF/classes] could not be found. URL will be ignored
java.io.FileNotFoundException: /opt/test/app/app.war!/WEB-INF/classes (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:103)
at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.resolveJarFileReference(JarFileBasedArchiveDescriptor.java:165)
at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:51)
at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:47)
at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:75)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:98)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:199)
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:34)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:165)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:114)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:71)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
Docker file reference,
FROM alpine/jdk1.8:latest
RUN mkdir -p /opt/test/app
COPY app.war /opt/test/app/app.war
CMD java -jar /opt/test/app/app.war
In the pom.xml, change the packaging to jar
C:\Users\sunka\Desktop\CS DEPT\fall 2k16\information structures>jar
-xvf week2.zip
java.io.FileNotFoundException: week2.zip (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.tools.jar.Main.run(Main.java:307)
at sun.tools.jar.Main.main(Main.java:1288)
When I am trying to unzip using jar -xvf, I am getting file not found exception. I used the same command in my office, it was working. I made sure that zip file and jar file are present in the directory.
Check if you in same directory where you have zip file placed.
Because if JAVA path is set properly and your are giving right zip file name with correct path it works fine.
I wrote a Puppet to install Play 2.1.1 on Virtual Machine running CentOS 6.2.
The Puppet executed the following two commands:
/usr/bin/wget http://downloads.typesafe.com/play/2.1.1/play-2.1.1.zip
/usr/bin/unzip play-2.1.1.zip
When I run play command inside the package, it shows the following error message:
java.io.FileNotFoundException: ~/play-2.1.1/framework/sbt/boot/update.log (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:209)
at java.io.FileOutputStream.<init>(FileOutputStream.java:160)
at java.io.FileWriter.<init>(FileWriter.java:90)
at xsbt.boot.Update.<init>(Checks.java:51)
at xsbt.boot.Launch.update(Launch.scala:275)
at xsbt.boot.Launch$$anonfun$jnaLoader$1.apply(Launch.scala:120)
at scala.Option.getOrElse(Option.scala:108)
at xsbt.boot.Launch.jnaLoader$2f324eef(Launch.scala:115)
at xsbt.boot.Launch.<init>(Launch.scala:94)
at xsbt.boot.Launcher$.apply(Launch.scala:290)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:31)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.io.FileNotFoundException: ~/play-2.1.1/framework/sbt/boot/update.log (No such file or directory)
I didn't change a single line of code in the play-2.1.1 directory. I googled around for the error message, but did not find any useful answer. Could anyone point out what is the problem?
If the file does not exist and cannot be created,FileOutputStream will raise a FileNotFoundException (yes, this seems weird, but see the javadoc).
This error probably means that the user that started play does not have the proper permissions to create ~/play-2.1.1/framework/sbt/boot/update.log or its parent directories.
Please go easy on me. I just started linux and hadoop at the same time. I have almost zero experience with linux and a complete beginner with hadoop.
I downloaded the file hadoop-1.1.1-bin.tar.gz from here:
http://www.motorlogy.com/apache/hadoop/common/hadoop-1.1.1/
I was able to unpack it.
I am following a tutorial that tells me to run:
bin/hadoop jar hadoop-*-examples.jar
I am getting this error:
agordon#Ubuntu32:/hadoop/hadoop-1.1.1$ bin/hadoop jar hadoop-*-examples-1.0.3.jar
Exception in thread "main" java.io.IOException: Error opening job jar: hadoop-*-examples-1.0.3.jar
at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
Caused by: java.io.FileNotFoundException: hadoop-*-examples-1.0.3.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.jar.JarFile.<init>(JarFile.java:152)
at java.util.jar.JarFile.<init>(JarFile.java:89)
at org.apache.hadoop.util.RunJar.main(RunJar.java:88)
What am i doing wrong? thank you for your guidance.
Instead of hadoop-*-examples.jar use the full name of the jar file.