• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Commons Digester: FileNotFound Exception

 
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

I am using the Apache Commons Digester as a way to load up and marshal XML config files. Am using Tomcat 5.5.9 and JDK 1.5.

I have an init servlet which loads an xml file config file (holding information to two more XML config files). I get the following exception at runtime:



My XMLConfigServlet:


ConfigHelper (This is where the exception actually occurs, look for my comment, in order, to pinpoint the actual line of code):


Here's the affiliates-rules file:



AffiliateBean:


The actual affiliates-config file itself:


Here's my web.xml file:


Why is it failing inside ConfigHelper? For some odd reason, it can't seem to find the contractor-config.xml file's location from the affiliates-config.xml file.

Sincerely,

James
[ January 26, 2007: Message edited by: James Dekker ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the account that is used to run the servlet contgainer have access privileges to "/temp"? Is it possibly run with a security manager that doesn't allow access?
[ January 26, 2007: Message edited by: Ulf Dittmer ]
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf,

If it didn't have access privileges then why would it return the correct element under the <name> tag in affiliates-config.xml?



For some odd reason, it seems as the marshalling conducted by Apache Commons Digester doesn't like File type objects?

Cheers,

James
[ January 27, 2007: Message edited by: James Dekker ]
 
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
Ah, I hadn't realized that it actually started to digest that file.

On closer inspection, I'm fairly certain that problem is that in AffiliateBean you're treating fileName as File, when it should be String. File can't be (de)serialized.
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf,

If that's the case, than my objective has failed... I need to tell it how to marshal the location...

Should I being using JAXB instead?

Thanks for your support,

James
 
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
JAXB is just a different way of binding XML to Java. It doesn't change the fact that File can't be (de)serialized.

What is the problem with binding the file name to a String (from which you can get a File object very easily)?
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf,

Do you mean using a cast for pulling the File object from the String?

Can you elaborate?

Thanks,

James
 
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
No, a File object can't be somehow saved as a string. I'm talking about "File f = new File(String)". It's the standard way of constructing a File object from a file name.
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf,

You were right! It had to do with changing the in AffiliateBean from File to String. Guess the Commons Digester doesn't take File properties.

Thank you,

James
 
He baked a muffin that stole my car! And this tiny ad:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic