[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: Deployment classpath issue in EAR

johndubchak do-not-reply at jboss.com
Thu Oct 2 10:32:18 EDT 2008


Hi Peter,

Thanks for the reply.  I've tried two different methods to access the config file: 1) using the FileUtils and 2) getClass().getClassLoader().getResourceAsStream()

Here is the relevant code from each:

1)

public String getFileContents(String fileName) {
  |         StringBuffer contents = new StringBuffer();
  | 
  |         try {
  |             BufferedReader br = new BufferedReader(new
  |                                InputStreamReader(new FileInputStream(fileName)));
  |             String input = br.readLine();
  |             while (input != null) {
  |                 contents.append(input);
  |                 input = br.readLine();
  |             }
  |             br.close();
  |         } catch (Exception e) {
  |             log.error(e);
  |         }
  | 
  |         return contents.toString();
  | }

And then method 2:

InputStream is = getClass().getClassLoader().getResourceAsStream("/config.xml");

The InputStream is null.  Also, I am using JBoss AS 4.2.3.

Thanks,
John

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180046#4180046

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4180046



More information about the jboss-user mailing list