• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

itext "Exception in thread "main" java.io.FileNotFoundException: value"

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. I'm new to java and itext and I'm trying to make pdf with digital signature. The code below makes new pdf (ORIGINAL) but then i get error for file not found. Any idea? thanks a lot and sorry for the long post.



this is error


 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On line 103 you try to open a file that has the name stored in the path variable.
The path variable is set on line 99 and is the value set to the PRIVATE property.
The value being assigned to the path variable is 'value'. You can see this is the exception message.
Exception in thread "main" java.io.FileNotFoundException: value

So my guess would be that your properties are not set up properly. have a look in
C:/Program files/iText/book/results/part3/chapter12/key.properties
to see what the PRIVATE key's value is.
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your time. key.properties is the file that i have to make by myself. It's made in notepad and it has this values:
#Favorite Things
#Tue Jan 22 13:50:59 CET 2013
keystorepassword=****
keypassword=****
value=PRIVATE
path=C\:/Program files/iText/book/results/part3/chapter12

i have made it from this code:


in itext book author wrote for key.properties file: "The path to my personal key store and certificate, along with the
corresponding passwords that are used in the examples, are stored in a properties
file on my OS. For obvious reasons, this file is not distributed with
the examples."

Any idea on this?

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Branko Kranjcevic wrote:Thanks for your time. key.properties is the file that i have to make by myself. It's made in notepad and it has this values:
#Favorite Things
#Tue Jan 22 13:50:59 CET 2013
keystorepassword=****
keypassword=****
value=PRIVATE
path=C\:/Program files/iText/book/results/part3/chapter12


Are you sure about the line I've highlighted ? The results you showed earlier would suggest it is actually
PRIVATE=value

But that's irrelevent, because it would appear on line 99 of your code you are reading the wrong value from the properties file.
I think you should probably be reading the 'path' value.
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I've changed it to PRIVATE=value but the error is still on ..
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Branko Kranjcevic wrote:Yes I've changed it to PRIVATE=value but the error is still on ..


As I said, that is irrelevant. The problem is that you are getting the value of the wrong property at line 99.
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joanne Neal wrote:

Branko Kranjcevic wrote:Yes I've changed it to PRIVATE=value but the error is still on ..


As I said, that is irrelevant. The problem is that you are getting the value of the wrong property at line 99.



Any suggestions how to fix it?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At present you're getting the value of property "PRIVATE". But the value of that property isn't the path (which is what you want to retrieve). What do you need to do to fix that?
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:At present you're getting the value of property "PRIVATE". But the value of that property isn't the path (which is what you want to retrieve). What do you need to do to fix that?



change "private" to path?
 
Bartender
Posts: 3323
86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rather than guess think about it logically.
1. The variable 'path' is used to open a FileInputStream so it should contain the path to the file you want to open.
2. Which property in your properties file contains the path to the file to open?
3. Are you setting the 'path' variable to this properties value?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Branko Kranjcevic wrote:

Ulf Dittmer wrote:At present you're getting the value of property "PRIVATE". But the value of that property isn't the path (which is what you want to retrieve). What do you need to do to fix that?



change "private" to path?


Don't just guess. Experiment. What happened when you tried that ?

Edit: Or you could think about it logically Both are good ways of learning.
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for suggestions. I've changed what you think should be changed and i get error on:
Exception in thread "main" java.lang.NullPointerException
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In which line? Which object is null? Post the full stack trace.
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:In which line? Which object is null? Post the full stack trace.



here it is:

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:In which line? Which object is null?



If you want us to help you then you need to make it as easy as possible by giving as much information as you have.
 
Tony Docherty
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Print out the value of 'path' - I think you will find is it null.

Can you show the line(s) of code you changed so we can see what you have done.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Branko Kranjcevic wrote:Thank you for suggestions. I've changed what you think should be changed and i get error on:
Exception in thread "main" java.lang.NullPointerException


If the only thing you have changed is which property you fetch on line 99, then you need to check that the value you are getting is now correct.
Add

after line 99 to see if it is now getting the correct value.
If it isn't then you need to work out why. Are you getting the correct property ? Does that property exist in the properties file with the correct value ?

Edit: I was a bit slow there wasn't I
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joanne Neal wrote:

Branko Kranjcevic wrote:Thank you for suggestions. I've changed what you think should be changed and i get error on:
Exception in thread "main" java.lang.NullPointerException


If the only thing you have changed is which property you fetch on line 99, then you need to check that the value you are getting is now correct.
Add

after line 99 to see if it is now getting the correct value.
If it isn't then you need to work out why. Are you getting the correct property ? Does that property exist in the properties file with the correct value ?

Edit: I was a bit slow there wasn't I



I have done this and i get value: null, here is the whole message :


I'm a bit slow, because I'm a beginner and I'm working with two codes for signing pdf. Maybe I'll post that other code that gives me error too

Edit: and when i change this line to this:


I get this message:
 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Branko Kranjcevic wrote:I get this message:


And did you read the error message ? What do you think it might mean ?
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked my permissions for files and they are all on..
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also for all directories above it, starting at the root, i.e. C: ?
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Also for all directories above it, starting at the root, i.e. C: ?



Yes, error is still on
 
Tony Docherty
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure this is a file and not a directory?
If it is a file check to make sure no other applications have locked the file.
 
Branko Kranjcevic
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found new and better code for digital signature from the same author. It works very good. But I still want this code to work too, so I will send question to the code author about this key.properties file. It's very suspicious to me. I will notice on progress.. Thank you all very much for your time and replies.
 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic