I'm sure the stackTrace of the thrown exception would give you more
information ;)
The code as written would try to load the file myprop.prop from the
current working directory. This will be where you executed startup.sh
from. If it's not there then you'll probably get a FileNotFoundException.
Jon
Luong Phan wrote:
> Hi all,
>
> Thanks for your advices. The error is that files
> startup.sh and shutdown.sh are not executable. Now I
> can start Tomcat.
>
> But I meet the following problem:
> - I use the mysql supported already by Redhat Linux
> 7.3 O/S to store my database.
> - The jakarta-tomcat-3.2.4 is used to be the server.
> - I use mysql-connector-java-3.0.6-stable-bin.jar for
> connection between mysql and JSP.
>
> - I put the my web application in the directory:
> jakarta-tomcat-3.2.4/webapps/myapp.
> - I put the mysql-connector-java-3.0.6-stable-bin.jar
> in directories: jakarta-tomcat-3.2.4/lib, and
> jakarta-tomcat-3.2.4/webapps/myapp/WEB-INF/lib
> - I create a properties file (myprop.prop contains
> DBURL, DBUserName, DBPassword, and DBDriver) and put
> it at directories: jakarta-tomcat-3.2.4/bin, and
> jakarta-tomcat-3.2.4/conf.
>
> After I start mysqlserver and tomcat, I type on the
> Mozilla browse: http://localhost:8080/myapp, the
> browser display my web page. When I link to a URL that
> call the JSP program:
>
>
> import
java.io.FileInputStream;
> import
java.io.IOException;
> import
java.sql.Connection;
> import
java.sql.DriverManager;
> import
java.sql.ResultSet;
> import
java.sql.SQLException;
> import
java.sql.Statement;
> import
java.util.Enumeration;
> import
java.util.Properties;
>
>
> public class MyData {
> private Connection connection;
> private Statement statement;
>
>
> public MyData() throws
> ClassNotFoundException,SQLException{
>
> String DBDriver=null;
> String url=null;
> String username=null;
> String password=null;
>
> Properties props = new Properties();
> String pFile="myprop.prop";
> try {
> props.load(new
> FileInputStream(pFile));
> } catch(IOException e) {
> System.err.println("Failed to load
> property file");
> }
> ...
> I get the following massage "Failed to load property
> file".
>
> Please help me!
>
> Thank you very much.
>
> LuongPhan
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)