Hi
My program is trying to load properties but it is saying it can not read a line of it. Does anyone have an idea why not?

dbProperties.load(dbPropInputStreasm);

but error

Exception in thread "main" java.lang.NullPointerException
        at java.util.Properties$LineReader.readLine(Properties.java:418)
        at java.util.Properties.load0(Properties.java:337)
        at java.util.Properties.load(Properties.java:325)
error here  -------> at model.dao.DerbyDAO.loadDBProperties(DerbyDAO.java:160)
        at model.dao.DerbyDAO.<init>(DerbyDAO.java:115)
        at model.dao.DerbyDAO.<init>(DerbyDAO.java:108)
        at view.SchoolJDesktopPane.login(SchoolJDesktopPane.java:168)
        at view.SchoolJDesktopPane.<init>(SchoolJDesktopPane.java:116)
        at view.Main.createJDesktopPane(Main.java:35)
        at view.Main.main(Main.java:30)

Method

private Properties loadDBProperties() {
        InputStream dbPropInputStream = null;
        dbPropInputStream = DerbyDAO.class.getResourceAsStream("ModelResources.properties");
        dbProperties = new Properties();
        try {
            dbProperties.load(dbPropInputStream);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return dbProperties;
    }

properties

# To change this template, choose Tools | Templates
# and open the template in the editor.

#DAO=model.dao.JDBCSchoolofdbDAO
DA0=model.dao.DerbyDAO



#/////////////////////////////////////////////////


# DAO=jsfdb.model.dao.JDBCSubscriberDAO


#/////////////////////////////////////////////////

# Sample ResourceBundle properties file

derby.driver=org.apache.derby.jdbc.EmbeddedDriver
derby.url=jdbc:derby:
db.table=ADDRESS
db.schema=APP

#JavaCompEnv=java:comp/env
JavaCompEnv=jdbc/schoolofdb

DataSource=jdbc:mysql://localhost:3306/schoolofdb 
user=root
password=xxxxxx

query.query=SELECT u FROM User u
#////////////////// user group    ///////////////////
SelectUserGroup=SELECT \
groupName FROM usergroup AS ug,usergroup_mapping AS ugm WHERE  ugm \
.uid=? AND ugm.groupid=ug.groupid

#/////////////////   user tables  ///////////////////

SelectAdmin=SELECT \
admin_uid,\
admin_password,\
admin_lname,\
admin_mname,\
admin_fname,\
admin_gender,\
admin_age,\
admin_start_date,\
admin_end_date,\
admin_address,\
admin_state,\
admin_zip,\
admin_area_code,\
admin_phone,\
admin_pay_rate \
FROM admin \
WHERE uid=?


SelectInstr=SELECT \
instr_uid,\
instr_password,\
instr_lname,\
instr_mname,\
instr_fname,\
instr_gender,\
instr_start_date,\
instr_end_date,\
instr_age,\
instr_address,\
instr_state,\
instr_zip,\
instr_area_code,\
instr_phone,\
instr_location,\
instr_rate,\
instr_pay_rate,\
book_num \
FROM instructor \
WHERE uid=?



SelectPayee=SELECT \
 payee_uid,\
 payee_password,\
 payee_lname,\
 payee_mname,\
 payee_fname,\
 payee_gender,\
 payee_age,\
 payee_area_code,\
 payee_phone,\
 payee_address,\
 payee_state,\
 payee_zip,\
 stu_uid \
FROM payee \
WHERE uid=?



SelectStudent=SELECT \
stu_uid,\
stu_password,\
stu_lname,\
stu_mname,\
stu_fname,\
stu_gender,\
stu_age,\
stu_start_date,\
stu_end_date,\
stu_address,\
stu_state,\
stu_zip,\
stu_area_code,\
stu_phone,\
payee_uid \
FROM student \
WHERE uid=?


#//subscriber//////////////////////////
SelectStatement=SELECT \
    subscriberPassword, \
    subscriberName, \
    managerFlag, \
    developerFlag, \
    administratorFlag, \
    subscriptionType \
    FROM subscribers \
    WHERE subscriberEmail=?

InsertStatement=INSERT INTO subscribers ( \
    subscriberEmail, \
    subscriberPassword, \
    subscriberName, \
    managerFlag, \
    developerFlag, \
    administratorFlag, \
    subscriptionType ) \
    VALUES (?, ?, ?, ?, ?, ?, ?)

UpdateStatement=UPDATE subscribers SET \
    subscriberPassword=?, \
    subscriberName=?, \
    managerFlag=?, \
    developerFlag=?, \
    administratorFlag=?, \
    subscriptionType=? \
    WHERE subscriberEmail=?

DeleteStatement=DELETE FROM subscribers \
    WHERE subscriberEmail=?

UserException=Subscription failed. \
    Please try another email address.
ProfileException=Must Select a Profile \
   
UnenrollException=Unsubscription failed. \
    Please contact the Webmaster.
LoginException=Login failed. \
    Please contact the Webmaster.
UnknownUserException=Unknown subscriber. \
    Please Register.
IncorrectPasswordException=Incorrect password. \
    Please try to login again.
IncorrectProfileException=Profile incorrect.\
    Please try choosing profile again.


#derby create table
strCreateAdminTable=DROP TABLE IF EXISTS admin \
CREATE TABLE admin \
( \
admin_uid CHAR(11),\
admin_password CHAR(11),\
admin_lname CHAR(20),\
admin_mname CHAR(20),\
admin_fname CHAR(20),\
admin_gender CHAR(1),\
admin_age INT(2),\
admin_start_date DATE,\
admin_end_date DATE,\
admin_address CHAR(20),\
admin_state CHAR(2),\
admin_zip INT(5),\
admin_area_code INT(3),\
admin_phone INT(11),\
admin_pay_rate INT(4),\
PRIMARY KEY(admin_uid)\
)\
INSERT INTO admin (admin_uid,admin_fname,admin_password) VALUES ('ag','Garth','a') \
INSERT INTO admin (admin_uid,admin_fname,admin_password) VALUES ('aw','Wayne','a')


strCreateBookingTable =DROP TABLE IF EXISTS booking \
CREATE TABLE booking \
( \
book_num INT(4) AUTO_INCREMENT,\
book_instrument_type CHAR(11),\
book_start_time INT(4),\
book_end_time INT(4),\
book_date DATE,\
book_location CHAR(11),\
book_status CHAR(6),\
book_cancel_date DATE,\
book_refund_memo BOOLEAN,\
stu_uid CHAR(11),\
instr_uid CHAR(11),\
payment_num INT(4),\
PRIMARY KEY (book_num) \
)
#
# FOREIGN KEY (payee_uid) REFERENCES payee (payee_uid),
# FOREIGN KEY (stu_uid) REFERENCES student (stu_uid)
#
#
# Dumping data for table `booking`
#
# INSERT INTO booking (pymt_method) VALUES ('cash')
# INSERT INTO booking (pymt_method) VALUES ('credit')

strCreateInstrAvailableTable =DROP TABLE IF EXISTS instr_available \
CREATE TABLE instr_available \
( \
instr_uid CHAR(11),\
available_date DATE,\
avalable_start_time INT(4),\
available_end_time INT(4),\
PRIMARY KEY (instr_uid) \
)

#
# FOREIGN KEY (payee_uid) REFERENCES payee (payee_uid)
#FOREIGN KEY (stu_uid) REFERENCES student (stu_uid)
#Dumping data for table `user`
#INSERT INTO user (pymt_method) VALUES ('cash')
#INSERT INTO user (pymt_method) VALUES ('credit')



strCreateInstructorTable =DROP TABLE IF EXISTS instructor \
CREATE TABLE instructor \
( \
instr_uid CHAR(11),\
instr_password CHAR(11),\
instr_lname CHAR(20),\
instr_mname CHAR(20),\
instr_fname CHAR(20),\
instr_gender CHAR(1),\
instr_start_date DATE,\
instr_end_date DATE,\
instr_age INT(3),\
instr_address CHAR(20),\
instr_state CHAR(2),\
instr_zip INT(5),\
instr_area_code INT(3),\
instr_phone INT(11),\
instr_location CHAR (11),\
instr_rate INT(4),\
instr_pay_rate INT(4),\
book_num INT(6),\
PRIMARY KEY(instr_uid) \
)\
INSERT INTO instructor \
(instr_uid,\instr_fname,\instr_password) VALUES ('ij','Johanne','i') \
INSERT INTO instructor \
(instr_uid,\instr_fname,\instr_password) VALUES ('im','Mozart','i')

strCreateInstrumentTable =DROP TABLE IF EXISTS instrument \
CREATE TABLE instrument \
( \
instrument_type CHAR(11),\
instr_uid CHAR(11),\
PRIMARY KEY (instrument_type) \
)
#
# FOREIGN KEY (payee_uid) REFERENCES payee (payee_uid),
# FOREIGN KEY (stu_uid) REFERENCES student (stu_uid)
#
#
# Dumping data for table `user`
#
# INSERT INTO user (pymt_method) VALUES ('cash')
# INSERT INTO user (pymt_method) VALUES ('credit')

strCreateLocationTable =DROP TABLE IF EXISTS location \
CREATE TABLE location \
( \
location CHAR(11),\
PRIMARY KEY (location)\
)
#
# FOREIGN KEY (payee_uid) REFERENCES payee (payee_uid),
# FOREIGN KEY (stu_uid) REFERENCES student (stu_uid)
#
#
# Dumping data for table `user`
#
# INSERT INTO user (pymt_method) VALUES ('cash')
# INSERT INTO user (pymt_method) VALUES ('credit')

strCreatePayeeTable =DROP TABLE IF EXISTS payee \
CREATE TABLE payee \
( \
payee_uid CHAR(11),\
payee_password CHAR(11),\
payee_lname CHAR(20),\
payee_mname CHAR(20),\
payee_fname CHAR(20),\
payee_gender CHAR(1),\
payee_age INT(3),\
payee_area_code INT(3),\
payee_phone INT(11),\
payee_address CHAR(20),\
payee_state CHAR(2),\
payee_zip CHAR(6),\
stu_uid CHAR(11),\
PRIMARY KEY(payee_uid)\
)\
INSERT INTO payee (payee_uid,payee_fname,payee_password) VALUES ('ps','Suzies mom','p') \
INSERT INTO payee \
(payee_uid,payee_fname,payee_password) VALUES ('pj','Johnie dad','p')

strCreatePaymentTable =DROP TABLE IF EXISTS payment \
CREATE TABLE payment \
( \
pymt_num INT(4) AUTO_INCREMENT,\
pymt_method CHAR(20),\
pymt_amount INT(6),\
pymt_date DATE,\
payee_uid CHAR(11),\
stu_uid CHAR(11),\
PRIMARY KEY (pymt_num)\
) \
INSERT INTO payment (pymt_method) VALUES ('cash') \
INSERT INTO payment (pymt_method) VALUES ('credit')
#
# FOREIGN KEY (payee_uid) REFERENCES payee (payee_uid),
# FOREIGN KEY (stu_uid) REFERENCES student (stu_uid)
#


strCreatePayRollTable =DROP TABLE IF EXISTS payroll \
CREATE TABLE payroll \
( \
instr_uid CHAR(11),\
period_start DATE,\
period_end DATE,\
PRIMARY KEY (instr_uid) \
)
#
# FOREIGN KEY (payee_uid) REFERENCES payee (payee_uid),
# FOREIGN KEY (stu_uid) REFERENCES student (stu_uid)
#

#
# Dumping data for table `user`
#
# INSERT INTO user (pymt_method) VALUES ('cash')
# INSERT INTO user (pymt_method) VALUES ('credit')

strCreateStudentTable =DROP TABLE IF EXISTS student \
CREATE TABLE student \
( \
stu_uid CHAR(11),\
stu_password CHAR(11),\
stu_lname CHAR(20),\
stu_mname CHAR(20),\
stu_fname CHAR(20),\
stu_gender CHAR(1),\
stu_age INT(3),\
stu_start_date DATE,\
stu_end_date DATE,\
stu_address CHAR(20),\
stu_state CHAR(2),\
stu_zip INT(5),\
stu_area_code INT(3),\
stu_phone INT(11),\
payee_uid CHAR(11),\
PRIMARY KEY(stu_uid)\
) \
INSERT INTO student (stu_uid,stu_fname,stu_password) VALUES ('sj','Johnny','s') \
INSERT INTO student (stu_uid,stu_fname,stu_password) VALUES ('ss','Suzie','s')

strCreateUserTable =DROP TABLE IF EXISTS user \
CREATE TABLE `user` \
( \
`uid` char(8) NOT NULL,\
`password` varchar(20) NOT NULL,\
 PRIMARY KEY  (`uid`) \
)\
ENGINE=InnoDB DEFAULT CHARSET=latin1\
SET character_set_client = @saved_cs_client\
LOCK TABLES `user` WRITE \
INSERT INTO `user` VALUES \
('aw','a'),\
('sj','s'),\
('im','i'),\
('ps','p') \
UNLOCK TABLES \

strCreateUserGroupTable =DROP TABLE IF EXISTS `usergroup` \
SET @saved_cs_client     = @@character_set_client \
SET character_set_client = utf8 \
CREATE TABLE `usergroup` \
(\
`groupid` varchar(10) NOT NULL,\
`groupName` varchar(20) NOT NULL,\
PRIMARY KEY  (`groupid`) \
) \
ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC \
SET character_set_client = @saved_cs_client \
LOCK TABLES `usergroup` WRITE \
INSERT INTO `usergroup` VALUES ('adm','admin'),('std','student'),('instr','instructor'),('pye','payee')\
UNLOCK TABLES 


strCreateUserGroupMappingTable =DROP TABLE IF EXISTS `usergroup_mapping` \
SET @saved_cs_client     = @@character_set_client \
SET character_set_client = utf8\
CREATE TABLE `usergroup_mapping` \
( \
`uid` char(11) NOT NULL, \
`groupid` varchar(10) NOT NULL, \
PRIMARY KEY `uid` (`uid`), \
CONSTRAINT `uid` FOREIGN KEY (`uid`) REFERENCES `user` (`uid`), \
CONSTRAINT `groupid` FOREIGN KEY (`groupid`) REFERENCES `usergroup` (`groupid`) \
) \
ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC \
SET character_set_client = @saved_cs_client \
LOCK TABLES `usergroup_mapping` WRITE \
INSERT INTO `usergroup_mapping` VALUES ('aw','adm'),('sj','std'),('im','instr'),('ps','pye'),('ag','adm') \
UNLOCK TABLES

getResourceAsStream is not finding the file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.