Dear all,
The following jsp demostrates the problem I encountered when properties file is 
accessed.  When ClassLoader is used, the properties file cannot be retrieved but when 
I use the resourcebundle class.  the properties get be retrieved without problems.  
since the classloader call is used by a third party product bc4j and i couldn't do a 
modification on this and to change the mechanism.  I have tried to put all the 
properties into the ./lib directory as well as specifying them in the server.xml lib 
tag.  please help!  Please email to me if u have any solution.!  Many many thanks!

Karl.

<%@ page language = "java" contentType="text/html;charset=BIG5"%> 
<%@ page import = "java.io.*, java.util.*, oracle.jbo.*, javax.naming.*, 
oracle.jdeveloper.html.*, oracle.jbo.html.databeans.*"%> 
<% 
       String result = "" ; 
       String result1 = "" ; 

       try { 
               ResourceBundle bundle = ResourceBundle.getBundle( 
                       "connections"); 
               result1=bundle.getString("CM_Connection1") ; 
               InputStream  in = ClassLoader.getSystemResourceAsStream( 
                       "connections.properties"); 

               if(in == null) { 
                       result = "ClassLoader is wrong" ; 
               }else { 
                       result = "ClassLoader is correct" ; 
               } 
       } catch (Exception ex) { 
       } 
%> 

-----Original Message-----
From: "Michael J. Cannon" <[EMAIL PROTECTED]>
Date: Wed, 22 Aug 2001 15:28:58 -0500
To: Orion-Interest <[EMAIL PROTECTED]>
Subject: Re: Reading Properties File


> Excellent solution for all of our toolkits.  A great service.  Thank you,
> Marcel.
> ----- Original Message -----
> From: "Marcel Schutte" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 22, 2001 12:57 PM
> Subject: Re: Reading Properties File
> 
> 
> > See the attached files. We use them to read properties files off the
> > applications classpath. The properties files should be in the same
> directory
> > as the ProjectPropertiesHelper class.
> > This method works in both orion1.5.2 and weblogic6.1
> >
> > Hope this helps,
> > Marcel
> >
> > ----- Original Message -----
> > From: "Naresh Sharma" <[EMAIL PROTECTED]>
> > To: "Orion-Interest" <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 22, 2001 8:50 AM
> > Subject: Reading Properties File
> >
> >
> > > Hello Everybody,
> > >
> > >
> > > I have to read a properties file inside my EJB's method(I know the about
> > > EJB specs. restriction).
> > >
> > > As far as I know, to read a properties file in Orion we can specify the
> > > name of properties file with -p switch at orion server starting, or copy
> > > the properties file in <ORION_HOME>\lib directory(this directory is
> > > included in classpath setting through the manifest file).
> > >
> > >     This solution works for me only if i read the properties file using
> > > getResource method of java.lang.Classloader for getting the
> > > URL of the resource, but if i use getSystemResource it fails.
> > >
> > > 1) So what's the difference in between getResource and getSystemResource
> > > method of java.lang.Classloader?? I read the java docs for these methods
> > > but it is still not very clear to me.
> > >
> > >
> > > Secondly, But In our application we don't want anything like above
> > > solution, we wish to include the Properties file in system classpath,
> > > and then our EJB should be able to read the properties file.
> > >
> > > 2) Is this is the right way ??   I tried but it was unsuccessful. May be
> > > i am missing something. I couldn't figure out why getSystemResource
> > > method is failing in this scenario, where system Classpath contains the
> > > conf file.
> > >
> > >
> > > any clue??
> > >
> > >
> > > Thanks
> > > Naresh
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> 
> 
> 

-- 

_______________________________________________
FREE Personalized E-mail at Mail.com 
http://www.mail.com/?sr=signup 

Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free! 
http://www.net2phone.com/cgi-bin/link.cgi?143 


Reply via email to