• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to read a file  RSS feed

 
saravana kumar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a file inboxConfig.xml which is under projectname/context.
my project path is showing as C:\eclipse.

here is the code i written to read xml file

public class XMLReader {
public void getInboxDetails(){
try {
System.out.println("project path"+new File(".").getCanonicalPath());


DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();

Document doc = docBuilder.parse (new File("inboxConfig.xml"));

// normalize text representation doc.getDocumentElement ().normalize ();



i am getting the following error when i tried to read this file. can someone help me to solve this problem ?



java.io.FileNotFoundException: C:\eclipse\inboxConfig.xml (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at com.tdbn.util.XMLReader.getInboxDetails(XMLReader.java:22)
at com.tdbn.services.LoginServiceImpl.verifyLogin(LoginServiceImpl.java:35)
at com.tdbn.login.Home.login(Home.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tapestry.listener.ListenerMap.invokeTargetMethod(ListenerMap.java:257)
at org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46)
at org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(ListenerMap.java:97)
at org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered(ListenerMap.java:102)
at org.apache.tapestry.form.Form.renderComponent(Form.java:423)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)





Thanks
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what the question is. It seems to be looking for

C:\eclipse\inboxConfig.xml

Is the file really there? Can you put it there? Or are you trying to get the program to pick it up from somewhere else?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!