myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Hong" <anthony.bin.h...@gmail.com>
Subject Re: getResource giving filenotfound
Date Fri, 03 Mar 2006 05:32:14 GMT
String filePath =
((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getRealPath("/WEB-INF/test.properties");
You can get correct file path.

On 3/3/06, David Schlotfeldt <tcphp@plauditdesign.com> wrote:
> I have a property file in WEB-INF. I thought this is how you get to it:
>
> URL configUrl =
> FacesContext.getCurrentInstance().getExternalContext().getResource("/WEB-INF/test.properties");
> ...
> configProperties.load(new FileInputStream(file));
>
>
> But I get this exception
>
> ============================
> Caused by: java.io.FileNotFoundException:
> jndi:\localhost\test.biz\WEB-INF\test.properties (The filename,
> directory name, or volume label syntax is incorrect)
>        at java.io.FileInputStream.open(Native Method)
>        at java.io.FileInputStream.<init>(FileInputStream.java:106)
>        at biz.test.site.TestFacade.<init>(TestFacade.java:129)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>        at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>        at java.lang.Class.newInstance0(Class.java:350)
>        at java.lang.Class.newInstance(Class.java:303)
>        at
> org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:274)
>        at
> org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:265)
>        at
> org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:50)
>        at
> org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:311)
>        at
> org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
>        at
> com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
>        at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
>        at com.sun.el.parser.AstValue.getValue(AstValue.java:85)
>        at
> com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
>        at
> com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
>        at
> com.sun.facelets.tag.TagAttribute.getObject(TagAttribute.java:233)
>        ... 39 more
> ==========================
>
> Why is it looking in jndi?
> What am I doing wrong?
>
> Thanks,
> David
>
>
>


--

Anthony Hong

Mime
View raw message