geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Mulder <ammul...@alumni.princeton.edu>
Subject Re:Re: Setting property Files to classpath
Date Fri, 12 Aug 2005 13:55:00 GMT
	Can you check at each step of the way, to see whether "in",
"filename", "fileURL", and "xsdURL" are non-null?  It may be the case, for
example, that it can successfully read the main config file out of the
dir/JAR, but then cannot locate the other files which that config file
refers to.

Aaron

On Fri, 12 Aug 2005, dinesh g wrote:
> Hi,
> 
> Here is the dependency i am giving in
> geronimo-application.xml (i created this file only for
> giving this dependency)
> 
> <dependency>
>            <uri>twe/properties</uri>
> </dependency>
> 
> <dependency>
>             <uri>twe/properties.jar</uri>
> </dependency>
> 
> One is a jar file and the other is the folder itself. 
> 
> The code snippet is a bit complicated one. I will give
> a simplified version -
> 
> InputStream in = ConfigReader.class                   
>       .getResourceAsStream(CONFIG_PROPERTIES);
> 
> Properties configprops = new Properties();
> configprops.load(in);
> String filename =
> configprops.getProperty("xmlfilename");
> URL fileURL =
> ConfigReader.class.getResource(filename);
> String xsdFilename = 
>     configprops.getProperty("xsdfilename");
> URL xsdURL = 
> ConfigReader.class.getResource(xsdFilename);
> _instance = new ConfigReader(fileURL, xsdURL);
> 
> 
>            configHash = new HashMap();
>            DocumentBuilderFactory factory =
> DocumentBuilderFactory.newInstance();
>            factory.setValidating(false);
>            factory.setNamespaceAware(true);
> 
>            DocumentBuilder builder =
> factory.newDocumentBuilder();
>            Document document =
> builder.parse(fileURL.openStream());
> 
> //here a null pointer exception is thrown probably
> //because it could not locate the file
> 
>            Element root =
> document.getDocumentElement();
>            loadProperties(root);
> ....
> ....
> ....
> 
> }
> 
> 
> 
> >I'd expect either one of these to work.  Could you
> >show the xml 
> >dependency and the code snippet where you read the
> >properties file?
> 
> >thanks
> >david jencks
> 
> >On Aug 11, 2005, at 11:22 PM, dinesh g wrote:
> 
> > Hi...
> >
> > I have some property files in a folder. These files
> > are used by the  application to look up the JNDI
> > namings and some other properties. These files need
> to
> > be in the classpath. In JBoss i just needed to add
> > this folder to the classpath for these files to be
> > picked up by the application. But i am not able to
> get
> > these files to be picked up by Geronimo.
> >
> > I tried adding the folder as a dependency and also
> > making a jar of the contents of the folder and then
> > adding the jar as a dependency.  But nothing seems
> to
> > be working. How do I add this property folder (or
> the
> > individual files within the folder) into the
> classpath
> > ?
> >
> > Thanks for your time...
> >
> > Regards,
> > Dinesh.G
> >
> >
> > 	
> >
> 
> 
> 	
> 
> 	
> 		
> ____________________________________________________
> Send a rakhi to your brother, buy gifts and win attractive prizes. Log on to http://in.promos.yahoo.com/rakhi/index.html
> 

Mime
View raw message