| Author |
File path after deployment
|
Gaurav Pawar
Ranch Hand
Joined: Sep 12, 2006
Posts: 37
|
|
The bean(model) in my struts application uses the following statements ... DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document domDoc = docBuilder.parse("Records.xml"); ... and further returns the values in XML file. THis executes fine as a standalone java application. After deploying my app in Tomcat while debugging the program stops at 'Document domDoc = docBuilder.parse("Records.xml");' I have placed Records.xml in the classes folder under WEB-INF. Any suggestions how I should specify tomcat specific path?? Thanks, Gaurav.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
There are undoubtedly other classes upon with this class is dependent. You need to find out what the dependencies are and either include the class files themselves in WEB-INF/classes or the jar files in WEB-INF/lib. In order to find out the dependencies, I'd start by looking at what is in the classpath of your stand-alone application.
|
Merrill
Consultant, Sima Solutions
|
 |
Gaurav Pawar
Ranch Hand
Joined: Sep 12, 2006
Posts: 37
|
|
Hey Thanks for the reply. Actually i have just 3 classes. 1. LoginAction.class 2. LoginForm.class 3. LoginBean.class and on xml file -- records.xml Login Bean reads the "records.xml" file, checks node values and returns result to the LoginForm. I have all these placed in WEB-INF/classes. Still do not get it right... Gaurav
|
 |
Gaurav Pawar
Ranch Hand
Joined: Sep 12, 2006
Posts: 37
|
|
Hi all, The solution to this is, Place the file in classes under webapps (this is what my requirement was) and then use the command InputStream in = myLALoginBean.class.getResourceAsStream("/Records.xml"); ---- followed by DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document domDoc = docBuilder.parse(in); Thanks, Gaurav Pawar
|
 |
 |
|
|
subject: File path after deployment
|
|
|