I am writing jdbc code in Servlet
But I am getting an error
java.lang.ClassNotFoundException: org.sqlite.JDBC
I have included a sqlitejdbc-v056.jar file
Still I am getting an error.
If i write the same code in separate java file and run it as a java application,
it works properly but it is not working on server
p.s.- I am using Weblogic server.
I have found a solution on my problem.
We have to add the .jar file in lib folder in WEB-INF folder in our workspace
-"Workspace/WebContent/WEB-INF/lib/"
Also we need to include it in 'plugins' folder of eclipse.
-"eclipse/plugins/"
Related
I am trying to deploy spring application war file in tomcat. When we place war file in tomcat webapps folder, the folder with same name was created. But when we access by using host:8080/warname is displaying 404 found error.
I have updated the Packaging as War and Tomcat dependency in pom.xml file as well. But still facing 404 found error. Anyone help me with this if any configuration changes missing in my end.
Also please help me with tell war folder structure in the tomcat to identify war file deployed properly in our end.
jfx:run not recognized external .jar on eclipse
My project contains \lib folder containting my .jar that i included like a file jar on my eclipse project. A simple java application run make the application running without any problem, but when i use jfx:run, an error occured : enter image description here
It seems that the class on my included .jar is not recongized. Any help please!!
How does add jar work in hive? when I add a local jar file,
add jar /users/course/jars/json-serde-1.3.1.jar;
hive query fails and says it could not find the jar in hdfs, same directory.
Job Submission failed with exception 'java.io.FileNotFoundException(File does not exist: hdfs://localhost:9000/users/course/jars/json-serde-1.3.1.jar)
Then I put the jar into hdfs, add jar using that hdfs filepath.
add jar hdfs://localhost/users/course/jars/json-serde-1.3.1.jar;
Now, hive query says
File does not exist: hdfs://localhost:9000/private/var/folders/k5/bn104n8s72sdpg3tg7d8kkpc0000gn/T/a598a513-d7c9-4d55-9280-b6554487cac7_resources/json-serde-1.3.1.jar
I have no idea why it keeps looking for the jar in wrong places.
I believe Hive looks for the JAR locally, not on HDFS.
So if my home directory on the gateway server is
pwd
/home/my_username/
And the JAR is sitting locally at:
/home/my_username/hive_udfs/awesomeness.jar
Then I'd go into the hive shell and run:
add jar /home/my_username/awesomeness.jar
At least, that works for me in my environment. HTH. Good luck! :)
I have a .jar file executing on a aws ec2 instance which contains the following code:
List<String> lines = FileUtils.readLines(new File("googlebooks-eng-all-1gram-20120701-k"));
the file exists in projectname/res and also in /projectname directly. I included /res in the build path. Also I see that the file exists inside the jar file at the root if I export the .java file in eclipse.
If I run the jar localy on my pc it works fine. But if I run it on a ec2 instance it says:
java.io.FileNotFoundException: File 'googlebooks-eng-all-1gram-20120701-k' does not exist
How can that be?
On your PC it is reading from the actual file on the filesystem - that is what new File means - a file on the filesystem.
To access a resource in a jar file you need to call getResourceAsStream or something similar instead.
I am facing a problem in running a jar file from my servlet.
I have to run a jar file of another java application with arguments in a separate sevlet in web project in Eclipse.
I use the code as
Runtime.getRuntime().exec("java -jar myproject.jar param1 param2 abc.xml");
In above code, on running the above jar file with parameters param1 and param2 , it will store output in abc.xml.
But the problem is that i dont know how to give the path of myproject.jar in code.
I copied myproject.jar to the project directory and it does not give any output.
I have tried to use
I dont know how to give path of jar file and where to put the jar file and where the out put file will come .
This code works fine with simple core java application where i put my myproject.jar file in the core java project directory and the output file abc.xml is created in the core java project directory.
Please guide me.
Thanks in advance.
This is not the right way of invoking Java code contained in some JAR in the classpath (I assume that you have placed it in /WEB-INF/lib). Just import and invoke the code contained in that JAR file directly.
import com.packagefromjar.SomeMainClassInJar;
// ...
SomeMainClassInJar.main(new String[] { "param1", "param2", "/path/to/abc.xml" });
Or if that API is well designed, then just use its entry classes directly instead of calling a main() method.